Ignore:
Timestamp:
Nov 9, 2017 8:45:20 AM (6 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
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)
Message:

Converted unit tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/MainWindow/UnitTesting/MainWindowTest.py

    r7fb471d r53c771e  
    11import sys 
    22import unittest 
     3import logging 
    34 
    4 from PyQt4 import QtGui 
    5 from PyQt4 import QtTest 
    6 from PyQt4 import QtCore 
     5from PyQt5 import QtGui, QtWidgets 
     6from PyQt5 import QtTest 
     7from PyQt5 import QtCore 
    78from unittest.mock import MagicMock 
    89 
     
    1314from sas.qtgui.MainWindow.MainWindow import MainSasViewWindow 
    1415from sas.qtgui.MainWindow.MainWindow import SplashScreen 
     16from sas.qtgui.MainWindow.GuiManager import GuiManager 
    1517 
    16 if not QtGui.QApplication.instance(): 
    17     app = QtGui.QApplication(sys.argv) 
     18if not QtWidgets.QApplication.instance(): 
     19    app = QtWidgets.QApplication(sys.argv) 
    1820 
    1921class MainWindowTest(unittest.TestCase): 
     
    3032    def testDefaults(self): 
    3133        """Test the GUI in its default state""" 
    32         self.assertIsInstance(self.widget, QtGui.QMainWindow) 
    33         self.assertIsInstance(self.widget.centralWidget(), QtGui.QWorkspace) 
     34        self.assertIsInstance(self.widget, QtWidgets.QMainWindow) 
     35        self.assertIsInstance(self.widget.centralWidget(), QtWidgets.QMdiArea) 
    3436         
    3537    def testSplashScreen(self): 
    3638        """ Test the splash screen """ 
    3739        splash = SplashScreen() 
    38         self.assertIsInstance(splash, QtGui.QSplashScreen) 
     40        self.assertIsInstance(splash, QtWidgets.QSplashScreen) 
    3941 
    4042    def testExit(self): 
     
    4446        # Must mask sys.exit, otherwise the whole testing process stops. 
    4547        sys.exit = MagicMock() 
    46         QtGui.QMessageBox.question = MagicMock(return_value=QtGui.QMessageBox.Yes) 
     48        QtWidgets.QMessageBox.question = MagicMock(return_value=QtWidgets.QMessageBox.Yes) 
    4749 
    4850        # Open, then close the main window 
     
    5153 
    5254        # See that the MessageBox method got called 
    53         self.assertTrue(QtGui.QMessageBox.question.called) 
     55        self.assertTrue(QtWidgets.QMessageBox.question.called) 
    5456        
    5557if __name__ == "__main__": 
Note: See TracChangeset for help on using the changeset viewer.