Changeset 53c771e in sasview for src/sas/qtgui/MainWindow/UnitTesting/MainWindowTest.py
- Timestamp:
- Nov 9, 2017 8:45:20 AM (7 years ago)
- Branches:
- ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- dd150ef
- Parents:
- d6b8a1d
- git-author:
- Piotr Rozyczko <rozyczko@…> (11/08/17 09:22:45)
- git-committer:
- Piotr Rozyczko <rozyczko@…> (11/09/17 08:45:20)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/MainWindow/UnitTesting/MainWindowTest.py
r7fb471d r53c771e 1 1 import sys 2 2 import unittest 3 import logging 3 4 4 from PyQt 4 import QtGui5 from PyQt 4import QtTest6 from PyQt 4import QtCore5 from PyQt5 import QtGui, QtWidgets 6 from PyQt5 import QtTest 7 from PyQt5 import QtCore 7 8 from unittest.mock import MagicMock 8 9 … … 13 14 from sas.qtgui.MainWindow.MainWindow import MainSasViewWindow 14 15 from sas.qtgui.MainWindow.MainWindow import SplashScreen 16 from sas.qtgui.MainWindow.GuiManager import GuiManager 15 17 16 if not Qt Gui.QApplication.instance():17 app = Qt Gui.QApplication(sys.argv)18 if not QtWidgets.QApplication.instance(): 19 app = QtWidgets.QApplication(sys.argv) 18 20 19 21 class MainWindowTest(unittest.TestCase): … … 30 32 def testDefaults(self): 31 33 """Test the GUI in its default state""" 32 self.assertIsInstance(self.widget, Qt Gui.QMainWindow)33 self.assertIsInstance(self.widget.centralWidget(), Qt Gui.QWorkspace)34 self.assertIsInstance(self.widget, QtWidgets.QMainWindow) 35 self.assertIsInstance(self.widget.centralWidget(), QtWidgets.QMdiArea) 34 36 35 37 def testSplashScreen(self): 36 38 """ Test the splash screen """ 37 39 splash = SplashScreen() 38 self.assertIsInstance(splash, Qt Gui.QSplashScreen)40 self.assertIsInstance(splash, QtWidgets.QSplashScreen) 39 41 40 42 def testExit(self): … … 44 46 # Must mask sys.exit, otherwise the whole testing process stops. 45 47 sys.exit = MagicMock() 46 Qt Gui.QMessageBox.question = MagicMock(return_value=QtGui.QMessageBox.Yes)48 QtWidgets.QMessageBox.question = MagicMock(return_value=QtWidgets.QMessageBox.Yes) 47 49 48 50 # Open, then close the main window … … 51 53 52 54 # See that the MessageBox method got called 53 self.assertTrue(Qt Gui.QMessageBox.question.called)55 self.assertTrue(QtWidgets.QMessageBox.question.called) 54 56 55 57 if __name__ == "__main__":
Note: See TracChangeset
for help on using the changeset viewer.