[06b0138] | 1 | import unittest |
---|
[464cd07] | 2 | import sys |
---|
[4992ff2] | 3 | from PyQt5 import QtGui |
---|
| 4 | from PyQt5 import QtWidgets |
---|
[464cd07] | 5 | |
---|
[32f6cdd] | 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 |
---|
[d0528c4] | 11 | by running ``python setup.py install`` in both repositories. |
---|
[32f6cdd] | 12 | |
---|
[d0528c4] | 13 | The tests can be run with ``python GUITests.py``, or to get more verbose |
---|
| 14 | console output (recommended), use ``python GUITests.py -v``. |
---|
[32f6cdd] | 15 | """ |
---|
| 16 | |
---|
[464cd07] | 17 | # Prepare the general QApplication instance |
---|
[4992ff2] | 18 | app = QtWidgets.QApplication(sys.argv) |
---|
[06b0138] | 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 | |
---|
[53c771e] | 28 | ## Plotting |
---|
[06b0138] | 29 | from Plotting.UnitTesting import AddTextTest |
---|
| 30 | from Plotting.UnitTesting import PlotHelperTest |
---|
| 31 | from Plotting.UnitTesting import WindowTitleTest |
---|
[53c771e] | 32 | from Plotting.UnitTesting import ScalePropertiesTest |
---|
[06b0138] | 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 |
---|
[53c771e] | 41 | from Plotting.UnitTesting import PlotterBaseTest |
---|
| 42 | from Plotting.UnitTesting import PlotterTest |
---|
| 43 | from Plotting.UnitTesting import Plotter2DTest |
---|
[06b0138] | 44 | |
---|
| 45 | # Calculators |
---|
| 46 | from Calculators.UnitTesting import KiessigCalculatorTest |
---|
| 47 | from Calculators.UnitTesting import DensityCalculatorTest |
---|
| 48 | from Calculators.UnitTesting import GenericScatteringCalculatorTest |
---|
[464cd07] | 49 | from Calculators.UnitTesting import SLDCalculatorTest |
---|
| 50 | from Calculators.UnitTesting import SlitSizeCalculatorTest |
---|
[01cda57] | 51 | from Calculators.UnitTesting import ResolutionCalculatorPanelTest |
---|
[d5c5d3d] | 52 | from Calculators.UnitTesting import DataOperationUtilityTest |
---|
[06b0138] | 53 | |
---|
| 54 | # Utilities |
---|
| 55 | from Utilities.UnitTesting import GuiUtilsTest |
---|
| 56 | from Utilities.UnitTesting import SasviewLoggerTest |
---|
[3b3b40b] | 57 | from Utilities.UnitTesting import GridPanelTest |
---|
| 58 | from Utilities.UnitTesting import ModelEditorTest |
---|
| 59 | from Utilities.UnitTesting import PluginDefinitionTest |
---|
| 60 | from Utilities.UnitTesting import TabbedModelEditorTest |
---|
[01ef3f7] | 61 | from Utilities.UnitTesting import AddMultEditorTest |
---|
[57be490] | 62 | from Utilities.UnitTesting import ReportDialogTest |
---|
[06b0138] | 63 | |
---|
| 64 | # Unit Testing |
---|
| 65 | from UnitTesting import TestUtilsTest |
---|
| 66 | |
---|
| 67 | # Perspectives |
---|
[7c487846] | 68 | # Fitting |
---|
[06b0138] | 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 |
---|
[72f4834] | 74 | from Perspectives.Fitting.UnitTesting import FittingOptionsTest |
---|
[0595bb7] | 75 | from Perspectives.Fitting.UnitTesting import MultiConstraintTest |
---|
[da9a0722] | 76 | from Perspectives.Fitting.UnitTesting import ComplexConstraintTest |
---|
[676f137] | 77 | from Perspectives.Fitting.UnitTesting import ConstraintWidgetTest |
---|
[0595bb7] | 78 | |
---|
[7c487846] | 79 | # Invariant |
---|
| 80 | from Perspectives.Invariant.UnitTesting import InvariantPerspectiveTest |
---|
[06b0138] | 81 | |
---|
[676f137] | 82 | # Inversion |
---|
| 83 | from Perspectives.Inversion.UnitTesting import InversionPerspectiveTest |
---|
| 84 | |
---|
[06b0138] | 85 | def suite(): |
---|
| 86 | suites = ( |
---|
| 87 | # Plotting |
---|
| 88 | unittest.makeSuite(Plotter2DTest.Plotter2DTest, 'test'), |
---|
[53c771e] | 89 | unittest.makeSuite(PlotHelperTest.PlotHelperTest, 'test'), |
---|
[06b0138] | 90 | unittest.makeSuite(AddTextTest.AddTextTest, 'test'), |
---|
[53c771e] | 91 | unittest.makeSuite(WindowTitleTest.WindowTitleTest, 'test'), |
---|
[06b0138] | 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'), |
---|
[53c771e] | 101 | unittest.makeSuite(PlotterBaseTest.PlotterBaseTest, 'test'), |
---|
| 102 | unittest.makeSuite(PlotterTest.PlotterTest, 'test'), |
---|
[06b0138] | 103 | |
---|
| 104 | # Main window |
---|
| 105 | unittest.makeSuite(DataExplorerTest.DataExplorerTest, 'test'), |
---|
[f4a1433] | 106 | unittest.makeSuite(DroppableDataLoadWidgetTest.DroppableDataLoadWidgetTest, 'test'), |
---|
[06b0138] | 107 | unittest.makeSuite(MainWindowTest.MainWindowTest, 'test'), |
---|
[53c771e] | 108 | unittest.makeSuite(GuiManagerTest.GuiManagerTest, 'test'), |
---|
| 109 | unittest.makeSuite(AboutBoxTest.AboutBoxTest, 'test'), |
---|
| 110 | unittest.makeSuite(WelcomePanelTest.WelcomePanelTest, 'test'), |
---|
[06b0138] | 111 | |
---|
| 112 | # Utilities |
---|
[0261bc1] | 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'), |
---|
[3b3b40b] | 118 | unittest.makeSuite(GridPanelTest.BatchOutputPanelTest, 'test'), |
---|
| 119 | unittest.makeSuite(ModelEditorTest.ModelEditorTest, 'test'), |
---|
| 120 | unittest.makeSuite(PluginDefinitionTest.PluginDefinitionTest, 'test'), |
---|
| 121 | unittest.makeSuite(TabbedModelEditorTest.TabbedModelEditorTest,'test'), |
---|
[01ef3f7] | 122 | unittest.makeSuite(AddMultEditorTest.AddMultEditorTest, 'test'), |
---|
[57be490] | 123 | unittest.makeSuite(ReportDialogTest.ReportDialogTest, 'test'), |
---|
[06b0138] | 124 | |
---|
| 125 | # Calculators |
---|
| 126 | unittest.makeSuite(KiessigCalculatorTest.KiessigCalculatorTest, 'test'), |
---|
| 127 | unittest.makeSuite(DensityCalculatorTest.DensityCalculatorTest, 'test'), |
---|
| 128 | unittest.makeSuite(GenericScatteringCalculatorTest.GenericScatteringCalculatorTest, 'test'), |
---|
[464cd07] | 129 | unittest.makeSuite(SLDCalculatorTest.SLDCalculatorTest, 'test'), |
---|
| 130 | unittest.makeSuite(SlitSizeCalculatorTest.SlitSizeCalculatorTest, 'test'), |
---|
[01cda57] | 131 | unittest.makeSuite(ResolutionCalculatorPanelTest.ResolutionCalculatorPanelTest, 'test'), |
---|
[d5c5d3d] | 132 | unittest.makeSuite(DataOperationUtilityTest.DataOperationUtilityTest, 'test'), |
---|
[06b0138] | 133 | |
---|
| 134 | # Perspectives |
---|
[7c487846] | 135 | # Fitting |
---|
[06b0138] | 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'), |
---|
[72f4834] | 141 | unittest.makeSuite(FittingOptionsTest.FittingOptionsTest, 'test'), |
---|
[0595bb7] | 142 | unittest.makeSuite(MultiConstraintTest.MultiConstraintTest, 'test'), |
---|
[676f137] | 143 | unittest.makeSuite(ConstraintWidgetTest.ConstraintWidgetTest, 'test'), |
---|
[da9a0722] | 144 | unittest.makeSuite(ComplexConstraintTest.ComplexConstraintTest, 'test'), |
---|
[676f137] | 145 | |
---|
[7c487846] | 146 | # Invariant |
---|
| 147 | unittest.makeSuite(InvariantPerspectiveTest.InvariantPerspectiveTest, 'test'), |
---|
[50bfab0] | 148 | # Inversion |
---|
| 149 | unittest.makeSuite(InversionPerspectiveTest.InversionTest, 'test'), |
---|
[676f137] | 150 | ) |
---|
[06b0138] | 151 | return unittest.TestSuite(suites) |
---|
| 152 | |
---|
| 153 | if __name__ == "__main__": |
---|
| 154 | unittest.main(defaultTest="suite") |
---|
| 155 | |
---|