1 | import sys |
---|
2 | import unittest |
---|
3 | import numpy |
---|
4 | |
---|
5 | from PyQt4 import QtGui |
---|
6 | from mock import MagicMock |
---|
7 | |
---|
8 | # set up import paths |
---|
9 | import path_prepare |
---|
10 | |
---|
11 | from sas.sasgui.guiframe.dataFitting import Data2D |
---|
12 | import sas.qtgui.Plotter2D as Plotter2D |
---|
13 | from UnitTesting.TestUtils import WarningTestNotImplemented |
---|
14 | |
---|
15 | # Local |
---|
16 | from sas.qtgui.ColorMap import ColorMap |
---|
17 | |
---|
18 | app = QtGui.QApplication(sys.argv) |
---|
19 | |
---|
20 | class ColorMapTest(unittest.TestCase): |
---|
21 | '''Test the ColorMap''' |
---|
22 | def setUp(self): |
---|
23 | '''Create the ColorMap''' |
---|
24 | self.plotter = Plotter2D.Plotter2D(None, quickplot=True) |
---|
25 | |
---|
26 | self.data = Data2D(image=[0.1]*4, |
---|
27 | qx_data=[1.0, 2.0, 3.0, 4.0], |
---|
28 | qy_data=[10.0, 11.0, 12.0, 13.0], |
---|
29 | dqx_data=[0.1, 0.2, 0.3, 0.4], |
---|
30 | dqy_data=[0.1, 0.2, 0.3, 0.4], |
---|
31 | q_data=[1,2,3,4], |
---|
32 | xmin=-1.0, xmax=5.0, |
---|
33 | ymin=-1.0, ymax=15.0, |
---|
34 | zmin=-1.0, zmax=20.0) |
---|
35 | |
---|
36 | self.data.title="Test data" |
---|
37 | self.data.id = 1 |
---|
38 | self.widget = ColorMap(parent=self.plotter, data=self.data) |
---|
39 | |
---|
40 | def tearDown(self): |
---|
41 | '''Destroy the GUI''' |
---|
42 | self.widget.close() |
---|
43 | self.widget = None |
---|
44 | |
---|
45 | def testDefaults(self): |
---|
46 | '''Test the GUI in its default state''' |
---|
47 | self.assertIsInstance(self.widget, QtGui.QDialog) |
---|
48 | |
---|
49 | WarningTestNotImplemented() |
---|
50 | |
---|
51 | def testOnReset(self): |
---|
52 | '''Check the dialog reset function''' |
---|
53 | WarningTestNotImplemented() |
---|
54 | |
---|
55 | def testInitDetectorData(self): |
---|
56 | '''Check the detector data generator''' |
---|
57 | # possibly to fold into testDefaults |
---|
58 | WarningTestNotImplemented() |
---|
59 | |
---|
60 | def testInitMapCombobox(self): |
---|
61 | '''Test the combo box initializer''' |
---|
62 | # possible to fold into testDefaults |
---|
63 | WarningTestNotImplemented() |
---|
64 | |
---|
65 | def testOnMapIndexChange(self): |
---|
66 | '''Test the response to the combo box index change''' |
---|
67 | WarningTestNotImplemented() |
---|
68 | |
---|
69 | def testRedrawColorBar(self): |
---|
70 | '''Test the color bar redrawing''' |
---|
71 | WarningTestNotImplemented() |
---|
72 | |
---|
73 | def testOnColorMapReversed(self): |
---|
74 | '''Test reversing the color map functionality''' |
---|
75 | WarningTestNotImplemented() |
---|
76 | |
---|
77 | def testOnAmplitudeChange(self): |
---|
78 | '''Check the callback method for responding to changes in textboxes''' |
---|
79 | WarningTestNotImplemented() |
---|
80 | |
---|
81 | |
---|
82 | if __name__ == "__main__": |
---|
83 | unittest.main() |
---|