-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #285 from ales-erjavec/fixes/view-pinch-zoom
[FIX] view: Fix a type error with PyQt6
- Loading branch information
Showing
2 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from AnyQt.QtCore import QPointF, QRect | ||
|
||
from orangecanvas.gui.test import QAppTestCase | ||
from orangecanvas.canvas import view, scene | ||
|
||
|
||
class TestView(QAppTestCase): | ||
def setUp(self): | ||
super().setUp() | ||
self.scene = scene.CanvasScene() | ||
self.view = view.CanvasView(self.scene) | ||
self.view.resize(420, 420) | ||
self.scene.setSceneRect(0, 0, 400, 400) | ||
|
||
def tearDown(self): | ||
self.scene.clear() | ||
del self.view | ||
del self.scene | ||
super().tearDown() | ||
|
||
def test_view_pinch_zoom(self): | ||
# Missing QTest.touchEvent in PyQt; cannot properly simulate touch | ||
# events so test this the ugly way. | ||
anchor = QPointF(350, 350) | ||
self.view._CanvasView__setZoomLevel(5.0, anchor) | ||
mapped = self.view.mapFromScene(anchor) | ||
self.assertTrue(self.view.viewport().rect().contains(mapped)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters