Exemple #1
0
    def test_zoom(self):
        webView = self._widget().webView
        self.assertEqual(webView.zoomFactor(), 1)
        zoom_out = QWheelEvent(webView.mapToGlobal(QPoint(10, 10)), -120,
                               Qt.NoButton, Qt.ControlModifier)
        zoom_in = QWheelEvent(webView.mapToGlobal(QPoint(10, 10)), 120,
                              Qt.NoButton, Qt.ControlModifier)

        QApplication.instance().sendEvent(webView, zoom_out)
        self.assertTrue(0.85 < webView.zoomFactor() < 0.95)

        QApplication.instance().sendEvent(webView, zoom_in)
        self.assertTrue(0.95 < webView.zoomFactor() < 1.05)

        QApplication.instance().sendEvent(webView, zoom_in)
        self.assertTrue(1.05 < webView.zoomFactor() < 1.15)
Exemple #2
0
 def _fade_out(self):
     event = QWheelEvent(QPoint(), -120, Qt.NoButton, Qt.AltModifier)
     self._parent.wheelEvent(event)
Exemple #3
0
 def _fade_in(self):
     event = QWheelEvent(QPoint(), 120, Qt.NoButton, Qt.AltModifier)
     self.__ide.wheelEvent(event)