ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalc
Last change
on this file since 98b13f72 was
83eb5208,
checked in by Piotr Rozyczko <rozyczko@…>, 8 years ago
|
Putting files in more ordered fashion
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Rev | Line | |
---|
[27313b7] | 1 | import sys |
---|
| 2 | import unittest |
---|
| 3 | |
---|
| 4 | from PyQt4 import QtGui |
---|
| 5 | |
---|
| 6 | # set up import paths |
---|
[83eb5208] | 7 | import sas.qtgui.path_prepare |
---|
[27313b7] | 8 | |
---|
| 9 | # Local |
---|
[83eb5208] | 10 | from sas.qtgui.Plotting.WindowTitle import WindowTitle |
---|
[27313b7] | 11 | |
---|
| 12 | app = QtGui.QApplication(sys.argv) |
---|
| 13 | |
---|
| 14 | class WindowTitleTest(unittest.TestCase): |
---|
| 15 | '''Test the WindowTitle''' |
---|
| 16 | def setUp(self): |
---|
| 17 | '''Create the WindowTitle''' |
---|
| 18 | self.widget = WindowTitle(None, new_title="some title") |
---|
| 19 | |
---|
| 20 | def tearDown(self): |
---|
| 21 | '''Destroy the GUI''' |
---|
| 22 | self.widget.close() |
---|
| 23 | self.widget = None |
---|
| 24 | |
---|
| 25 | def testDefaults(self): |
---|
| 26 | '''Test the GUI in its default state''' |
---|
| 27 | self.widget.show() |
---|
| 28 | self.assertIsInstance(self.widget, QtGui.QDialog) |
---|
| 29 | self.assertEqual(self.widget.windowTitle(), "Modify Window Title") |
---|
| 30 | |
---|
| 31 | def testTitle(self): |
---|
| 32 | '''Modify the title''' |
---|
| 33 | self.widget.show() |
---|
| 34 | app.processEvents() |
---|
| 35 | # make sure we have the pre-set title |
---|
| 36 | self.assertEqual(self.widget.txtTitle.text(), "some title") |
---|
| 37 | # Clear the control and set it to something else |
---|
| 38 | self.widget.txtTitle.clear() |
---|
| 39 | self.widget.txtTitle.setText("5 elephants") |
---|
[83eb5208] | 40 | app.processEvents() |
---|
[27313b7] | 41 | # Retrieve value |
---|
| 42 | new_title = self.widget.title() |
---|
| 43 | # Check |
---|
| 44 | self.assertEqual(new_title, "5 elephants") |
---|
| 45 | |
---|
| 46 | if __name__ == "__main__": |
---|
| 47 | unittest.main() |
---|
Note: See
TracBrowser
for help on using the repository browser.