source: sasview/src/sas/qtgui/UnitTesting/BoxSumTest.py @ 9f25bce

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 9f25bce was 3bdbfcc, checked in by Piotr Rozyczko <rozyczko@…>, 8 years ago

Reimplementation of the slicer functionality

  • Property mode set to 100755
File size: 1.6 KB
RevLine 
[3bdbfcc]1import sys
2import unittest
3from mock import MagicMock
4
5from PyQt4 import QtGui
6from PyQt4 import QtCore
7
8# set up import paths
9import path_prepare
10
11# Local
12from BoxSum import BoxSum
13
14app = QtGui.QApplication(sys.argv)
15
16class BoxSumTest(unittest.TestCase):
17    '''Test the BoxSum'''
18    def setUp(self):
19        '''Create the BoxSum'''
20        # example model
21        model = QtGui.QStandardItemModel()
22        parameters = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0]
23        for index, parameter in enumerate(parameters):
24            model.setData(model.index(0, index),
25                    QtCore.QVariant(parameter))
26        self.widget = BoxSum(None, model=model)
27
28    def tearDown(self):
29        '''Destroy the GUI'''
30        self.widget.close()
31        self.widget = None
32
33    def testDefaults(self):
34        '''Test the GUI in its default state'''
35        self.assertIsInstance(self.widget.mapper.mappedWidgetAt(0), QtGui.QLineEdit)
36        self.assertIsInstance(self.widget.mapper.mappedWidgetAt(1), QtGui.QLineEdit)
37        self.assertIsInstance(self.widget.mapper.mappedWidgetAt(2), QtGui.QLineEdit)
38        self.assertIsInstance(self.widget.mapper.mappedWidgetAt(3), QtGui.QLineEdit)
39        self.assertIsInstance(self.widget.mapper.mappedWidgetAt(4), QtGui.QLabel)
40        self.assertIsInstance(self.widget.mapper.mappedWidgetAt(5), QtGui.QLabel)
41        self.assertIsInstance(self.widget.mapper.mappedWidgetAt(6), QtGui.QLabel)
42        self.assertIsInstance(self.widget.mapper.mappedWidgetAt(7), QtGui.QLabel)
43        self.assertIsInstance(self.widget.mapper.mappedWidgetAt(8), QtGui.QLabel)
44       
45       
46if __name__ == "__main__":
47    unittest.main()
Note: See TracBrowser for help on using the repository browser.