source: sasview/src/sas/qtgui/MainWindow/UnitTesting/WelcomePanelTest.py @ c57ecca

Last change on this file since c57ecca was 464cd07, checked in by Piotr Rozyczko <rozyczko@…>, 7 years ago

Use singleton QApplication in unit tests to avoid issues on Ubuntu. SASVIEW-485

  • Property mode set to 100644
File size: 1.1 KB
RevLine 
[488c49d]1import sys
2import unittest
3
[adf81b8]4from PyQt4 import QtGui
[488c49d]5
[31c5b58]6# set up import paths
7import path_prepare
8
[488c49d]9# Local
[83eb5208]10from sas.qtgui.MainWindow.WelcomePanel import WelcomePanel
[488c49d]11
[464cd07]12if not QtGui.QApplication.instance():
13    app = QtGui.QApplication(sys.argv)
[488c49d]14
15class WelcomePanelTest(unittest.TestCase):
16    '''Test the WelcomePanel'''
17    def setUp(self):
18        '''Create the WelcomePanel'''
19
20        self.widget = WelcomePanel(None)
21
22    def tearDown(self):
23        '''Destroy the GUI'''
24        self.widget.close()
25        self.widget = None
26
27    def testDefaults(self):
28        '''Test the GUI in its default state'''
[adf81b8]29        self.assertIsInstance(self.widget, QtGui.QDialog)
[488c49d]30        self.assertEqual(self.widget.windowTitle(), "Welcome")
31       
32    def testVersion(self):
[adf81b8]33        '''Test the version string'''
[488c49d]34        version = self.widget.lblVersion
[adf81b8]35        self.assertIsInstance(version, QtGui.QLabel)
36
37        self.assertIn("SasView", version.text())
38        self.assertIn("Build:", version.text())
39        self.assertIn("UTK, UMD, NIST, ORNL, ISIS, ESS, ILL and ANSTO", version.text())
[488c49d]40       
41if __name__ == "__main__":
42    unittest.main()
Note: See TracBrowser for help on using the repository browser.