1 | import sys |
---|
2 | import unittest |
---|
3 | |
---|
4 | from PyQt4.QtGui import * |
---|
5 | from PyQt4.QtTest import QTest |
---|
6 | from PyQt4.QtCore import * |
---|
7 | from mock import MagicMock |
---|
8 | |
---|
9 | # Local |
---|
10 | from GuiManager import GuiManager |
---|
11 | from UI.MainWindowUI import MainWindow |
---|
12 | |
---|
13 | app = QApplication(sys.argv) |
---|
14 | |
---|
15 | class GuiManagerTest(unittest.TestCase): |
---|
16 | '''Test the Main Window functionality''' |
---|
17 | def setUp(self): |
---|
18 | '''Create the tested object''' |
---|
19 | class MainSasViewWindow(MainWindow): |
---|
20 | # Main window of the application |
---|
21 | def __init__(self, reactor, parent=None): |
---|
22 | super(MainSasViewWindow, self).__init__(parent) |
---|
23 | |
---|
24 | # define workspace for dialogs. |
---|
25 | self.workspace = QWorkspace(self) |
---|
26 | self.setCentralWidget(self.workspace) |
---|
27 | |
---|
28 | self.manager = GuiManager(MainSasViewWindow(None), None) |
---|
29 | |
---|
30 | def tearDown(self): |
---|
31 | '''Destroy the GUI''' |
---|
32 | self.manager = None |
---|
33 | |
---|
34 | def testDefaults(self): |
---|
35 | '''Test the object in its default state''' |
---|
36 | pass |
---|
37 | |
---|
38 | def testUpdatePerspective(self): |
---|
39 | """ |
---|
40 | """ |
---|
41 | pass |
---|
42 | |
---|
43 | def testUpdateStatusBar(self): |
---|
44 | """ |
---|
45 | """ |
---|
46 | pass |
---|
47 | |
---|
48 | def testSetData(self): |
---|
49 | """ |
---|
50 | """ |
---|
51 | pass |
---|
52 | |
---|
53 | def testSetData(self): |
---|
54 | """ |
---|
55 | """ |
---|
56 | pass |
---|
57 | |
---|
58 | def testActions(self): |
---|
59 | """ |
---|
60 | """ |
---|
61 | pass |
---|
62 | |
---|
63 | def testActionLoadData(self): |
---|
64 | """ |
---|
65 | Menu File/Load Data File(s) |
---|
66 | """ |
---|
67 | # Mock the system file open method |
---|
68 | QFileDialog.getOpenFileName = MagicMock(return_value=None) |
---|
69 | |
---|
70 | # invoke the action |
---|
71 | |
---|
72 | # Test the getOpenFileName() dialog called once |
---|
73 | #self.assertTrue(QtGui.QFileDialog.getOpenFileName.called) |
---|
74 | #QtGui.QFileDialog.getOpenFileName.assert_called_once() |
---|
75 | |
---|
76 | |
---|
77 | # test each action separately |
---|
78 | |
---|
79 | if __name__ == "__main__": |
---|
80 | unittest.main() |
---|
81 | |
---|