|
10 | 10 | import pytestqt
|
11 | 11 | import cadquery as cq
|
12 | 12 |
|
13 |
| -from PyQt5.QtCore import Qt, QSettings |
| 13 | +from PyQt5.QtCore import Qt, QSettings, QPoint |
14 | 14 | from PyQt5.QtWidgets import QFileDialog, QMessageBox
|
15 | 15 |
|
16 | 16 | from cq_editor.__main__ import MainWindow
|
@@ -1846,3 +1846,37 @@ def test_autocomplete_keystrokes(main):
|
1846 | 1846 | qtbot.wait(250)
|
1847 | 1847 | # Check that the completion list is still visible
|
1848 | 1848 | 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