Changeset 53c771e in sasview for src/sas/qtgui/Calculators/UnitTesting/DensityCalculatorTest.py
- Timestamp:
- Nov 9, 2017 6:45:20 AM (6 years ago)
- Branches:
- ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- dd150ef
- Parents:
- d6b8a1d
- git-author:
- Piotr Rozyczko <rozyczko@…> (11/08/17 07:22:45)
- git-committer:
- Piotr Rozyczko <rozyczko@…> (11/09/17 06:45:20)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Calculators/UnitTesting/DensityCalculatorTest.py
r7fb471d r53c771e 3 3 import webbrowser 4 4 5 from PyQt 4 import QtGui6 from PyQt 4.QtTest import QTest7 from PyQt 4import QtCore5 from PyQt5 import QtGui, QtWidgets 6 from PyQt5.QtTest import QTest 7 from PyQt5 import QtCore 8 8 from unittest.mock import MagicMock 9 9 … … 19 19 import sas.qtgui.Utilities.LocalConfig 20 20 21 if not Qt Gui.QApplication.instance():22 app = Qt Gui.QApplication(sys.argv)21 if not QtWidgets.QApplication.instance(): 22 app = QtWidgets.QApplication(sys.argv) 23 23 24 24 class ToMolarMassTest(unittest.TestCase): … … 45 45 self.widget = DensityPanel(None) 46 46 47 # temporarily set the text here 48 self.widget.ui.editMolecularFormula.setText("H2O") 49 47 50 def tearDown(self): 48 51 '''Destroy the DensityCalculator''' … … 52 55 def testDefaults(self): 53 56 '''Test the GUI in its default state''' 54 self.assertIsInstance(self.widget, Qt Gui.QWidget)57 self.assertIsInstance(self.widget, QtWidgets.QWidget) 55 58 self.assertEqual(self.widget.windowTitle(), "Density/Volume Calculator") 56 self.assertIsInstance(self.widget.ui.editMolecularFormula.validator(), FormulaValidator) 59 # temporarily commented out until FormulaValidator fixed for Qt5 60 #self.assertIsInstance(self.widget.ui.editMolecularFormula.validator(), FormulaValidator) 57 61 self.assertEqual(self.widget.ui.editMolecularFormula.styleSheet(), '') 58 62 self.assertEqual(self.widget.model.columnCount(), 1) 59 63 self.assertEqual(self.widget.model.rowCount(), 4) 60 self.assertEqual(self.widget.sizePolicy().Policy(), Qt Gui.QSizePolicy.Fixed)64 self.assertEqual(self.widget.sizePolicy().Policy(), QtWidgets.QSizePolicy.Fixed) 61 65 62 66 def testSimpleEntry(self): … … 71 75 QTest.keyEvent(QTest.Press, self.widget, key, QtCore.Qt.NoModifier) 72 76 QTest.qWait(100) 77 QTest.keyEvent(QTest.Press, self.widget, key, QtCore.Qt.NoModifier) 73 78 74 79 # Assure the mass density field is set … … 99 104 QTest.keyEvent(QTest.Press, self.widget, key, QtCore.Qt.NoModifier) 100 105 QTest.qWait(100) 106 QTest.keyEvent(QTest.Press, self.widget, key, QtCore.Qt.NoModifier) 101 107 102 108 # Assure the mass density field is set
Note: See TracChangeset
for help on using the changeset viewer.