0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-13 11:11:49 +02:00

test(launch_window): add test for launching UI file that raises ValueError for QMainWindow

This commit is contained in:
2025-04-15 12:08:06 +02:00
parent 8efa93d2d2
commit 33a8a767f3

View File

@ -46,3 +46,15 @@ def test_launch_window_launch_ui_file(bec_launch_window):
# In real usage, the GUIServer would handle this in the sigint handler in case of a ctrl-c initiated shutdown.
res.close()
res.deleteLater()
def test_launch_window_launch_ui_file_raises_for_qmainwindow(bec_launch_window):
# Mock the file dialog to return a specific UI file path
# the selected file must contain a QMainWindow widget but can be any file
ui_file_path = os.path.join(base_path, "applications/alignment/alignment_1d/alignment_1d.ui")
# Call the method to launch the custom UI file
with pytest.raises(ValueError) as excinfo:
bec_launch_window.launch("custom_ui_file", ui_file=ui_file_path)
assert "Loading a QMainWindow from a UI file is currently not supported." in str(excinfo.value)