MCPcopy Create free account
hub / github.com/NSLS2/PyXRF / test_MainWindow

Function test_MainWindow

pyxrf/gui_module/tests/test_main_window.py:7–27  ·  view source on GitHub ↗

Simple test that opens and closes the main window and checks the window dimensions

(qtbot, monkeypatch)

Source from the content-addressed store, hash-verified

5
6
7def 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"

Callers

nothing calls this directly

Calls 4

initializeMethod · 0.95
MainWindowClass · 0.90
showMethod · 0.80

Tested by

no test coverage detected