1 | import unittest |
---|
2 | import sys |
---|
3 | from PyQt5 import QtGui |
---|
4 | from PyQt5 import QtWidgets |
---|
5 | |
---|
6 | """ |
---|
7 | Unit tests for the QT GUI |
---|
8 | ========================= |
---|
9 | |
---|
10 | In order to run the tests, first install SasView and sasmodels to site-packages |
---|
11 | by running ``python setup.py install`` in both repositories. |
---|
12 | |
---|
13 | The tests can be run with ``python GUITests.py``, or to get more verbose |
---|
14 | console output (recommended), use ``python GUITests.py -v``. |
---|
15 | """ |
---|
16 | |
---|
17 | # Prepare the general QApplication instance |
---|
18 | app = QtWidgets.QApplication(sys.argv) |
---|
19 | |
---|
20 | # Main Window |
---|
21 | from MainWindow.UnitTesting import AboutBoxTest |
---|
22 | from MainWindow.UnitTesting import DataExplorerTest |
---|
23 | from MainWindow.UnitTesting import WelcomePanelTest |
---|
24 | from MainWindow.UnitTesting import DroppableDataLoadWidgetTest |
---|
25 | from MainWindow.UnitTesting import GuiManagerTest |
---|
26 | from MainWindow.UnitTesting import MainWindowTest |
---|
27 | |
---|
28 | ## Plotting |
---|
29 | from Plotting.UnitTesting import AddTextTest |
---|
30 | from Plotting.UnitTesting import PlotHelperTest |
---|
31 | from Plotting.UnitTesting import WindowTitleTest |
---|
32 | from Plotting.UnitTesting import ScalePropertiesTest |
---|
33 | from Plotting.UnitTesting import SetGraphRangeTest |
---|
34 | from Plotting.UnitTesting import LinearFitTest |
---|
35 | from Plotting.UnitTesting import PlotPropertiesTest |
---|
36 | from Plotting.UnitTesting import PlotUtilitiesTest |
---|
37 | from Plotting.UnitTesting import ColorMapTest |
---|
38 | from Plotting.UnitTesting import BoxSumTest |
---|
39 | from Plotting.UnitTesting import SlicerModelTest |
---|
40 | from Plotting.UnitTesting import SlicerParametersTest |
---|
41 | from Plotting.UnitTesting import PlotterBaseTest |
---|
42 | from Plotting.UnitTesting import PlotterTest |
---|
43 | from Plotting.UnitTesting import Plotter2DTest |
---|
44 | |
---|
45 | # Calculators |
---|
46 | from Calculators.UnitTesting import KiessigCalculatorTest |
---|
47 | from Calculators.UnitTesting import DensityCalculatorTest |
---|
48 | from Calculators.UnitTesting import GenericScatteringCalculatorTest |
---|
49 | from Calculators.UnitTesting import SLDCalculatorTest |
---|
50 | from Calculators.UnitTesting import SlitSizeCalculatorTest |
---|
51 | from Calculators.UnitTesting import ResolutionCalculatorPanelTest |
---|
52 | from Calculators.UnitTesting import DataOperationUtilityTest |
---|
53 | |
---|
54 | # Utilities |
---|
55 | from Utilities.UnitTesting import GuiUtilsTest |
---|
56 | from Utilities.UnitTesting import SasviewLoggerTest |
---|
57 | from Utilities.UnitTesting import GridPanelTest |
---|
58 | from Utilities.UnitTesting import ModelEditorTest |
---|
59 | from Utilities.UnitTesting import PluginDefinitionTest |
---|
60 | from Utilities.UnitTesting import TabbedModelEditorTest |
---|
61 | from Utilities.UnitTesting import AddMultEditorTest |
---|
62 | from Utilities.UnitTesting import ReportDialogTest |
---|
63 | |
---|
64 | # Unit Testing |
---|
65 | from UnitTesting import TestUtilsTest |
---|
66 | |
---|
67 | # Perspectives |
---|
68 | # Fitting |
---|
69 | from Perspectives.Fitting.UnitTesting import FittingWidgetTest |
---|
70 | from Perspectives.Fitting.UnitTesting import FittingPerspectiveTest |
---|
71 | from Perspectives.Fitting.UnitTesting import FittingLogicTest |
---|
72 | from Perspectives.Fitting.UnitTesting import FittingUtilitiesTest |
---|
73 | from Perspectives.Fitting.UnitTesting import FitPageTest |
---|
74 | from Perspectives.Fitting.UnitTesting import FittingOptionsTest |
---|
75 | from Perspectives.Fitting.UnitTesting import MultiConstraintTest |
---|
76 | from Perspectives.Fitting.UnitTesting import ComplexConstraintTest |
---|
77 | from Perspectives.Fitting.UnitTesting import ConstraintWidgetTest |
---|
78 | |
---|
79 | # Invariant |
---|
80 | from Perspectives.Invariant.UnitTesting import InvariantPerspectiveTest |
---|
81 | |
---|
82 | # Inversion |
---|
83 | from Perspectives.Inversion.UnitTesting import InversionPerspectiveTest |
---|
84 | |
---|
85 | def suite(): |
---|
86 | suites = ( |
---|
87 | # Plotting |
---|
88 | unittest.makeSuite(Plotter2DTest.Plotter2DTest, 'test'), |
---|
89 | unittest.makeSuite(PlotHelperTest.PlotHelperTest, 'test'), |
---|
90 | unittest.makeSuite(AddTextTest.AddTextTest, 'test'), |
---|
91 | unittest.makeSuite(WindowTitleTest.WindowTitleTest, 'test'), |
---|
92 | unittest.makeSuite(ScalePropertiesTest.ScalePropertiesTest, 'test'), |
---|
93 | unittest.makeSuite(SetGraphRangeTest.SetGraphRangeTest, 'test'), |
---|
94 | unittest.makeSuite(LinearFitTest.LinearFitTest, 'test'), |
---|
95 | unittest.makeSuite(PlotPropertiesTest.PlotPropertiesTest, 'test'), |
---|
96 | unittest.makeSuite(PlotUtilitiesTest.PlotUtilitiesTest, 'test'), |
---|
97 | unittest.makeSuite(ColorMapTest.ColorMapTest, 'test'), |
---|
98 | unittest.makeSuite(BoxSumTest.BoxSumTest, 'test'), |
---|
99 | unittest.makeSuite(SlicerModelTest.SlicerModelTest, 'test'), |
---|
100 | unittest.makeSuite(SlicerParametersTest.SlicerParametersTest, 'test'), |
---|
101 | unittest.makeSuite(PlotterBaseTest.PlotterBaseTest, 'test'), |
---|
102 | unittest.makeSuite(PlotterTest.PlotterTest, 'test'), |
---|
103 | |
---|
104 | # Main window |
---|
105 | unittest.makeSuite(DataExplorerTest.DataExplorerTest, 'test'), |
---|
106 | unittest.makeSuite(DroppableDataLoadWidgetTest.DroppableDataLoadWidgetTest, 'test'), |
---|
107 | unittest.makeSuite(MainWindowTest.MainWindowTest, 'test'), |
---|
108 | unittest.makeSuite(GuiManagerTest.GuiManagerTest, 'test'), |
---|
109 | unittest.makeSuite(AboutBoxTest.AboutBoxTest, 'test'), |
---|
110 | unittest.makeSuite(WelcomePanelTest.WelcomePanelTest, 'test'), |
---|
111 | |
---|
112 | # Utilities |
---|
113 | unittest.makeSuite(TestUtilsTest.TestUtilsTest, 'test'), |
---|
114 | unittest.makeSuite(SasviewLoggerTest.SasviewLoggerTest, 'test'), |
---|
115 | unittest.makeSuite(GuiUtilsTest.GuiUtilsTest, 'test'), |
---|
116 | unittest.makeSuite(GuiUtilsTest.DoubleValidatorTest, 'test'), |
---|
117 | unittest.makeSuite(GuiUtilsTest.HashableStandardItemTest, 'test'), |
---|
118 | unittest.makeSuite(GridPanelTest.BatchOutputPanelTest, 'test'), |
---|
119 | unittest.makeSuite(ModelEditorTest.ModelEditorTest, 'test'), |
---|
120 | unittest.makeSuite(PluginDefinitionTest.PluginDefinitionTest, 'test'), |
---|
121 | unittest.makeSuite(TabbedModelEditorTest.TabbedModelEditorTest,'test'), |
---|
122 | unittest.makeSuite(AddMultEditorTest.AddMultEditorTest, 'test'), |
---|
123 | unittest.makeSuite(ReportDialogTest.ReportDialogTest, 'test'), |
---|
124 | |
---|
125 | # Calculators |
---|
126 | unittest.makeSuite(KiessigCalculatorTest.KiessigCalculatorTest, 'test'), |
---|
127 | unittest.makeSuite(DensityCalculatorTest.DensityCalculatorTest, 'test'), |
---|
128 | unittest.makeSuite(GenericScatteringCalculatorTest.GenericScatteringCalculatorTest, 'test'), |
---|
129 | unittest.makeSuite(SLDCalculatorTest.SLDCalculatorTest, 'test'), |
---|
130 | unittest.makeSuite(SlitSizeCalculatorTest.SlitSizeCalculatorTest, 'test'), |
---|
131 | unittest.makeSuite(ResolutionCalculatorPanelTest.ResolutionCalculatorPanelTest, 'test'), |
---|
132 | unittest.makeSuite(DataOperationUtilityTest.DataOperationUtilityTest, 'test'), |
---|
133 | |
---|
134 | # Perspectives |
---|
135 | # Fitting |
---|
136 | unittest.makeSuite(FittingPerspectiveTest.FittingPerspectiveTest, 'test'), |
---|
137 | unittest.makeSuite(FittingWidgetTest.FittingWidgetTest, 'test'), |
---|
138 | unittest.makeSuite(FittingLogicTest.FittingLogicTest, 'test'), |
---|
139 | unittest.makeSuite(FittingUtilitiesTest.FittingUtilitiesTest, 'test'), |
---|
140 | unittest.makeSuite(FitPageTest.FitPageTest, 'test'), |
---|
141 | unittest.makeSuite(FittingOptionsTest.FittingOptionsTest, 'test'), |
---|
142 | unittest.makeSuite(MultiConstraintTest.MultiConstraintTest, 'test'), |
---|
143 | unittest.makeSuite(ConstraintWidgetTest.ConstraintWidgetTest, 'test'), |
---|
144 | unittest.makeSuite(ComplexConstraintTest.ComplexConstraintTest, 'test'), |
---|
145 | |
---|
146 | # Invariant |
---|
147 | unittest.makeSuite(InvariantPerspectiveTest.InvariantPerspectiveTest, 'test'), |
---|
148 | # Inversion |
---|
149 | unittest.makeSuite(InversionPerspectiveTest.InversionTest, 'test'), |
---|
150 | ) |
---|
151 | return unittest.TestSuite(suites) |
---|
152 | |
---|
153 | if __name__ == "__main__": |
---|
154 | unittest.main(defaultTest="suite") |
---|
155 | |
---|