Skip to content

Commit ed6615e

Browse files
committed
Increase test coverage a bit
1 parent aa623cc commit ed6615e

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

tests/test_app.py

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import pytestqt
1111
import cadquery as cq
1212

13-
from PyQt5.QtCore import Qt, QSettings
13+
from PyQt5.QtCore import Qt, QSettings, QPoint
1414
from PyQt5.QtWidgets import QFileDialog, QMessageBox
1515

1616
from cq_editor.__main__ import MainWindow
@@ -1846,3 +1846,37 @@ def test_autocomplete_keystrokes(main):
18461846
qtbot.wait(250)
18471847
# Check that the completion list is still visible
18481848
assert editor.completion_list.isVisible()
1849+
1850+
1851+
def test_viewer_orbit_methods(main):
1852+
"""
1853+
Tests that mouse movements in the viewer work as expected.
1854+
"""
1855+
1856+
qtbot, win = main
1857+
1858+
viewer = win.components["viewer"]
1859+
1860+
# Make sure the editor is focused
1861+
viewer.setFocus()
1862+
qtbot.waitExposed(viewer)
1863+
1864+
# Simulate a drag to rotate
1865+
qtbot.mousePress(viewer, Qt.LeftButton)
1866+
qtbot.mouseMove(viewer, QPoint(100, 100))
1867+
qtbot.mouseMove(viewer, QPoint(300, 300))
1868+
qtbot.mouseRelease(viewer, Qt.LeftButton)
1869+
1870+
# Simulate a drag to pan
1871+
qtbot.mousePress(viewer, Qt.MiddleButton)
1872+
qtbot.mouseMove(viewer, QPoint(100, 100))
1873+
qtbot.mouseMove(viewer, QPoint(300, 300))
1874+
qtbot.mouseRelease(viewer, Qt.MiddleButton)
1875+
1876+
# Simulate drag to zoom
1877+
qtbot.mousePress(viewer, Qt.RightButton)
1878+
qtbot.mouseMove(viewer, QPoint(100, 100))
1879+
qtbot.mouseMove(viewer, QPoint(300, 300))
1880+
qtbot.mouseRelease(viewer, Qt.RightButton)
1881+
1882+
assert True

0 commit comments

Comments
 (0)