Ignore:
Timestamp:
Jun 8, 2017 3:10:49 AM (7 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
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:
919d47c
Parents:
06b0138
Message:

Added tab-dependent help display in fiting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingWidgetTest.py

    r06b0138 r70080a0  
    2323 
    2424class dummy_manager(object): 
     25    HELP_DIRECTORY_LOCATION = "html" 
    2526    communicate = Communicate() 
    2627 
     
    677678            self.assertEqual(update_spy.count(), 1) 
    678679 
     680    def testOnHelp(self): 
     681        """ 
     682        Test various help pages shown in this widget 
     683        """ 
     684        #Mock the QWebView method 
     685        QtWebKit.QWebView.show = MagicMock() 
     686        QtWebKit.QWebView.load = MagicMock() 
     687 
     688        # Invoke the action on default tab 
     689        self.widget.onHelp() 
     690        # Check if show() got called 
     691        self.assertTrue(QtWebKit.QWebView.show.called) 
     692        # Assure the filename is correct 
     693        self.assertIn("fitting_help.html", QtWebKit.QWebView.load.call_args[0][0].toString()) 
     694 
     695        # Change the tab to options 
     696        self.widget.tabFitting.setCurrentIndex(1) 
     697        self.widget.onHelp() 
     698        # Check if show() got called 
     699        self.assertEqual(QtWebKit.QWebView.show.call_count, 2) 
     700        # Assure the filename is correct 
     701        self.assertIn("residuals_help.html", QtWebKit.QWebView.load.call_args[0][0].toString()) 
     702 
     703        # Change the tab to smearing 
     704        self.widget.tabFitting.setCurrentIndex(2) 
     705        self.widget.onHelp() 
     706        # Check if show() got called 
     707        self.assertEqual(QtWebKit.QWebView.show.call_count, 3) 
     708        # Assure the filename is correct 
     709        self.assertIn("sm_help.html", QtWebKit.QWebView.load.call_args[0][0].toString()) 
     710 
     711        # Change the tab to poly 
     712        self.widget.tabFitting.setCurrentIndex(3) 
     713        self.widget.onHelp() 
     714        # Check if show() got called 
     715        self.assertEqual(QtWebKit.QWebView.show.call_count, 4) 
     716        # Assure the filename is correct 
     717        self.assertIn("pd_help.html", QtWebKit.QWebView.load.call_args[0][0].toString()) 
     718 
     719        # Change the tab to magnetism 
     720        self.widget.tabFitting.setCurrentIndex(4) 
     721        self.widget.onHelp() 
     722        # Check if show() got called 
     723        self.assertEqual(QtWebKit.QWebView.show.call_count, 5) 
     724        # Assure the filename is correct 
     725        self.assertIn("mag_help.html", QtWebKit.QWebView.load.call_args[0][0].toString()) 
     726 
    679727    def testReadFitPage(self): 
    680728        """ 
Note: See TracChangeset for help on using the changeset viewer.