source: sasview/src/sas/qtgui/UnitTesting/KiessigCalculatorTest.py @ 363fbfa

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 363fbfa was 363fbfa, checked in by trnielsen, 7 years ago

Add new Kiessing Calculator

  • Property mode set to 100755
File size: 1.7 KB
Line 
1import sys
2import unittest
3from PyQt4 import QtGui
4from PyQt4.QtTest import QTest
5from PyQt4.QtCore import Qt
6
7# TEMP
8import path_prepare
9
10
11from KiessigPanel import KiessigPanel
12
13app = QtGui.QApplication(sys.argv)
14
15
16class KiessigCalculatorTest(unittest.TestCase):
17    """Test the KiessigCalculator"""
18    def setUp(self):
19        """Create the KiessigCalculator"""
20        self.widget = KiessigPanel(None)
21
22    def tearDown(self):
23        """Destroy the KiessigCalculator"""
24        self.widget.close()
25        self.widget = None
26
27    def testDefaults(self):
28        """Test the GUI in its default state"""
29        self.assertIsInstance(self.widget, QtGui.QWidget)
30        self.assertEqual(self.widget.windowTitle(), "Kiessig Thickness Calculator")
31        self.assertEqual(self.widget.sizePolicy().Policy(), QtGui.QSizePolicy.Fixed)
32
33    def testHelp(self):
34        """ Assure help file is shown """
35
36        # this should not rise
37        self.widget.on_help()
38
39    def testComplexEntryNumbers(self):
40        """ User entered compound calculations and subsequent reset"""
41
42        self.widget.deltaq_in.insert("2.0")
43
44        # Push Compute with the left mouse button
45        computeButton = self.widget.computeButton
46        QTest.mouseClick(computeButton, Qt.LeftButton)
47        self.assertEqual(self.widget.lengthscale_out.text(), '3.1416')
48
49    def testComplexEntryLetters(self):
50        """ User entered compound calculations and subsequent reset"""
51
52        self.widget.deltaq_in.insert("xyz")
53
54        # Push Compute with the left mouse button
55        computeButton = self.widget.computeButton
56        QTest.mouseClick(computeButton, Qt.LeftButton)
57        self.assertEqual(self.widget.lengthscale_out.text(), '')
58
59if __name__ == "__main__":
60    unittest.main()
Note: See TracBrowser for help on using the repository browser.