Simple test that opens and closes the main window and checks the window dimensions
(qtbot, monkeypatch)
| 5 | |
| 6 | |
| 7 | def test_MainWindow(qtbot, monkeypatch): |
| 8 | """ |
| 9 | Simple test that opens and closes the main window and |
| 10 | checks the window dimensions |
| 11 | """ |
| 12 | gpc = GlobalProcessingClasses() |
| 13 | gpc.initialize() |
| 14 | |
| 15 | window = MainWindow(gpc=gpc) |
| 16 | window.show() |
| 17 | |
| 18 | qtbot.addWidget(window) |
| 19 | qtbot.waitForWindowShown(window) |
| 20 | |
| 21 | monkeypatch.setattr(QMessageBox, "exec", lambda *args: QMessageBox.No) |
| 22 | window.close() |
| 23 | assert not window._is_closed, "Window was closed prematurely" |
| 24 | |
| 25 | monkeypatch.setattr(QMessageBox, "exec", lambda *args: QMessageBox.Yes) |
| 26 | window.close() |
| 27 | assert window._is_closed, "Window was not closed properly" |
nothing calls this directly
no test coverage detected