Changeset 14ec91c5 in sasview for src/sas/qtgui/Perspectives/Fitting/UnitTesting
- Timestamp:
- Feb 2, 2018 9:21:48 AM (7 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:
- a90c9c5
- Parents:
- 5e66738
- Location:
- src/sas/qtgui/Perspectives/Fitting/UnitTesting
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/UnitTesting/ConstraintWidgetTest.py
rda9a0722 r14ec91c5 15 15 # Local 16 16 from sas.qtgui.Perspectives.Fitting.ConstraintWidget import ConstraintWidget 17 from sas.qtgui.Perspectives.Fitting.Constraint simport Constraint17 from sas.qtgui.Perspectives.Fitting.Constraint import Constraint 18 18 19 19 if not QtWidgets.QApplication.instance(): -
src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingOptionsTest.py
r53c771e r14ec91c5 1 1 import sys 2 2 import unittest 3 import webbrowser 3 4 from bumps import options 4 5 … … 114 115 115 116 # test disabled until pyQt5 works well 116 def notestOnHelp(self):117 def testOnHelp(self): 117 118 ''' Test help display''' 118 #Mock the QWebView method 119 QtWebKit.QWebView.show = MagicMock() 120 QtWebKit.QWebView.load = MagicMock() 119 webbrowser.open = MagicMock() 121 120 122 121 # Invoke the action on default tab 123 122 self.widget.onHelp() 124 123 # Check if show() got called 125 self.assertTrue( QtWebKit.QWebView.show.called)124 self.assertTrue(webbrowser.open.called) 126 125 # Assure the filename is correct 127 self.assertIn("optimizer.html", QtWebKit.QWebView.load.call_args[0][0].toString())126 self.assertIn("optimizer.html", webbrowser.open.call_args[0][0]) 128 127 129 128 # Change the combo index … … 131 130 self.widget.onHelp() 132 131 # Check if show() got called 133 self.assertEqual( QtWebKit.QWebView.show.call_count, 2)132 self.assertEqual(webbrowser.open.call_count, 2) 134 133 # Assure the filename is correct 135 self.assertIn("fit-dream", QtWebKit.QWebView.load.call_args[0][0].toString())134 self.assertIn("fit-dream", webbrowser.open.call_args[0][0]) 136 135 137 136 # Change the index again … … 139 138 self.widget.onHelp() 140 139 # Check if show() got called 141 self.assertEqual( QtWebKit.QWebView.show.call_count, 3)140 self.assertEqual(webbrowser.open.call_count, 3) 142 141 # Assure the filename is correct 143 self.assertIn("fit-lm", QtWebKit.QWebView.load.call_args[0][0].toString())142 self.assertIn("fit-lm", webbrowser.open.call_args[0][0]) 144 143 145 144 def testWidgetFromOptions(self): -
src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingWidgetTest.py
r63319b0 r14ec91c5 17 17 from sas.qtgui.Utilities.GuiUtils import * 18 18 from sas.qtgui.Perspectives.Fitting.FittingWidget import * 19 from sas.qtgui.Perspectives.Fitting.Constraint simport Constraint19 from sas.qtgui.Perspectives.Fitting.Constraint import Constraint 20 20 21 21 from sas.qtgui.UnitTesting.TestUtils import QtSignalSpy … … 787 787 self.assertEqual(update_spy.count(), 1) 788 788 789 # test disabled until pyqt5 deals with html properly 790 def notestOnHelp(self): 789 def testOnHelp(self): 791 790 """ 792 791 Test various help pages shown in this widget 793 792 """ 794 #Mock the QWebViewmethod795 QtWebKit.QWebView.show= MagicMock()796 QtWebKit.QWebView.load= MagicMock()793 #Mock the webbrowser.open method 794 self.widget.parent.showHelp = MagicMock() 795 #webbrowser.open = MagicMock() 797 796 798 797 # Invoke the action on default tab 799 798 self.widget.onHelp() 800 799 # Check if show() got called 801 self.assertTrue( QtWebKit.QWebView.show.called)800 self.assertTrue(self.widget.parent.showHelp.called) 802 801 # Assure the filename is correct 803 self.assertIn("fitting_help.html", QtWebKit.QWebView.load.call_args[0][0].toString())802 self.assertIn("fitting_help.html", self.widget.parent.showHelp.call_args[0][0]) 804 803 805 804 # Change the tab to options … … 807 806 self.widget.onHelp() 808 807 # Check if show() got called 809 self.assertEqual( QtWebKit.QWebView.show.call_count, 2)808 self.assertEqual(self.widget.parent.showHelp.call_count, 2) 810 809 # Assure the filename is correct 811 self.assertIn("residuals_help.html", QtWebKit.QWebView.load.call_args[0][0].toString())810 self.assertIn("residuals_help.html", self.widget.parent.showHelp.call_args[0][0]) 812 811 813 812 # Change the tab to smearing … … 815 814 self.widget.onHelp() 816 815 # Check if show() got called 817 self.assertEqual( QtWebKit.QWebView.show.call_count, 3)816 self.assertEqual(self.widget.parent.showHelp.call_count, 3) 818 817 # Assure the filename is correct 819 self.assertIn(" sm_help.html", QtWebKit.QWebView.load.call_args[0][0].toString())818 self.assertIn("resolution.html", self.widget.parent.showHelp.call_args[0][0]) 820 819 821 820 # Change the tab to poly … … 823 822 self.widget.onHelp() 824 823 # Check if show() got called 825 self.assertEqual( QtWebKit.QWebView.show.call_count, 4)824 self.assertEqual(self.widget.parent.showHelp.call_count, 4) 826 825 # Assure the filename is correct 827 self.assertIn("p d_help.html", QtWebKit.QWebView.load.call_args[0][0].toString())826 self.assertIn("polydispersity.html", self.widget.parent.showHelp.call_args[0][0]) 828 827 829 828 # Change the tab to magnetism … … 831 830 self.widget.onHelp() 832 831 # Check if show() got called 833 self.assertEqual( QtWebKit.QWebView.show.call_count, 5)832 self.assertEqual(self.widget.parent.showHelp.call_count, 5) 834 833 # Assure the filename is correct 835 self.assertIn("mag _help.html", QtWebKit.QWebView.load.call_args[0][0].toString())834 self.assertIn("magnetism.html", self.widget.parent.showHelp.call_args[0][0]) 836 835 837 836 def testReadFitPage(self):
Note: See TracChangeset
for help on using the changeset viewer.