diff --git a/src/sas/qtgui/MainWindow/UnitTesting/GuiManagerTest.py b/src/sas/qtgui/MainWindow/UnitTesting/GuiManagerTest.py index 380abf17ed..dddf1a6cf9 100644 --- a/src/sas/qtgui/MainWindow/UnitTesting/GuiManagerTest.py +++ b/src/sas/qtgui/MainWindow/UnitTesting/GuiManagerTest.py @@ -15,6 +15,7 @@ from sas.qtgui.MainWindow.AboutBox import AboutBox from sas.qtgui.MainWindow.WelcomePanel import WelcomePanel from sas.qtgui.Utilities.IPythonWidget import IPythonWidget +from sas.qtgui.Utilities.HidableDialog import HidableDialog from sas.qtgui.MainWindow.GuiManager import Acknowledgements, GuiManager from sas.qtgui.MainWindow.MainWindow import MainSasViewWindow @@ -122,22 +123,22 @@ def testQuitApplication(self, manager, mocker): mocker.patch.object(sys, 'exit') # Say No to the close dialog - mocker.patch.object(QMessageBox, 'question', return_value=QMessageBox.No) + mocker.patch.object(HidableDialog, 'exec', return_value=False) # Open, then close the manager manager.quitApplication() - # See that the MessageBox method got called - #assert QMessageBox.question.called + # See that the HidableDialog.exec method got called + assert HidableDialog.exec.called # Say Yes to the close dialog - mocker.patch.object(QMessageBox, 'question', return_value=QMessageBox.Yes) + mocker.patch.object(HidableDialog, 'exec', return_value=True) # Open, then close the manager manager.quitApplication() - # See that the MessageBox method got called - #assert QMessageBox.question.called + # See that the HidableDialog.exec method got called + assert HidableDialog.exec.called @pytest.mark.xfail(reason="2022-09 already broken") def testCheckUpdate(self, manager, mocker): diff --git a/src/sas/qtgui/MainWindow/UnitTesting/MainWindowTest.py b/src/sas/qtgui/MainWindow/UnitTesting/MainWindowTest.py index 2676bbb845..adb5b63317 100644 --- a/src/sas/qtgui/MainWindow/UnitTesting/MainWindowTest.py +++ b/src/sas/qtgui/MainWindow/UnitTesting/MainWindowTest.py @@ -11,6 +11,7 @@ from sas.qtgui.MainWindow.MainWindow import MainSasViewWindow from sas.qtgui.MainWindow.MainWindow import SplashScreen from sas.qtgui.Perspectives.Fitting import FittingPerspective +from sas.qtgui.Utilities.HidableDialog import HidableDialog class MainWindowTest: @@ -98,7 +99,7 @@ def testExit(self, qapp, mocker): """ # Must mask sys.exit, otherwise the whole testing process stops. mocker.patch.object(sys, 'exit') - mocker.patch.object(QtWidgets.QMessageBox, 'question', return_value=QtWidgets.QMessageBox.Yes) + mocker.patch.object(HidableDialog, 'exec', return_value=True) # Open, then close the main window screen_resolution = QtCore.QRect(0, 0, 640, 480) @@ -106,4 +107,4 @@ def testExit(self, qapp, mocker): tmp_main.close() # See that the MessageBox method got called - assert QtWidgets.QMessageBox.question.called + assert HidableDialog.exec.called diff --git a/src/sas/qtgui/Utilities/Preferences/UnitTesting/PreferencesPanelTest.py b/src/sas/qtgui/Utilities/Preferences/UnitTesting/PreferencesPanelTest.py index 2661571912..71ebcfa4b0 100644 --- a/src/sas/qtgui/Utilities/Preferences/UnitTesting/PreferencesPanelTest.py +++ b/src/sas/qtgui/Utilities/Preferences/UnitTesting/PreferencesPanelTest.py @@ -34,7 +34,7 @@ def data(self): def testDefaults(self, widget): """Test the freshly-opened panel with no changes made""" assert widget.stackedWidget.count() == widget.listWidget.count() - assert -1 == widget.stackedWidget.currentIndex() + assert 0 == widget.stackedWidget.currentIndex() def testPreferencesInteractions(self, widget): """Test the base interactions in window behavior"""