Changeset e00b76e in sasview


Ignore:
Timestamp:
Oct 25, 2017 9:35:13 AM (2 years ago)
Author:
Tim Snow <tim.snow@…>
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:
9ea43c82
Parents:
02f1d12
Message:

Unit test update magnetism

Complementary to the changes made, unit tests have been written also

Location:
src/sas/qtgui/Perspectives/Fitting
Files:
2 edited

Legend:

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

    r02f1d12 re00b76e  
    644644            return 
    645645 
    646         # p_i = self._magnet_model.headerData(0,1,2,3,4,5,6,7,8,9,10) 
    647646        property_index = self._magnet_model.headerData(0, 1, model_column).toInt()[0]-1 # Value, min, max, etc. 
    648647 
  • src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingWidgetTest.py

    rf7d14a1 re00b76e  
    102102        self.assertEqual(delegate.editableParameters(), [2, 3, 4, 5]) 
    103103        self.assertEqual(delegate.poly_function, 6) 
     104        self.assertIsInstance(delegate.combo_updated, QtCore.pyqtBoundSignal) 
     105 
     106    def testSelectMagnetism(self): 
     107        """ 
     108        Test if models have been loaded properly 
     109        """ 
     110        fittingWindow =  self.widget 
     111 
     112        self.assertIsInstance(fittingWindow.lstMagnetic.itemDelegate(), QtGui.QStyledItemDelegate) 
     113        #Test loading from json categories 
     114        fittingWindow.SASModelToQModel("cylinder") 
     115        mag_index = fittingWindow.lstMagnetic.model().index(0,0) 
     116        self.assertEqual(str(mag_index.data().toString()), "up:frac_i") 
     117        mag_index = fittingWindow.lstMagnetic.model().index(1,0) 
     118        self.assertEqual(str(mag_index.data().toString()), "up:frac_f") 
     119        mag_index = fittingWindow.lstMagnetic.model().index(2,0) 
     120        self.assertEqual(str(mag_index.data().toString()), "up:angle") 
     121        mag_index = fittingWindow.lstMagnetic.model().index(3,0) 
     122        self.assertEqual(str(mag_index.data().toString()), "M0:sld") 
     123        mag_index = fittingWindow.lstMagnetic.model().index(4,0) 
     124        self.assertEqual(str(mag_index.data().toString()), "mtheta:sld") 
     125        mag_index = fittingWindow.lstMagnetic.model().index(5,0) 
     126        self.assertEqual(str(mag_index.data().toString()), "mphi:sld") 
     127        mag_index = fittingWindow.lstMagnetic.model().index(6,0) 
     128        self.assertEqual(str(mag_index.data().toString()), "M0:sld_solvent") 
     129        mag_index = fittingWindow.lstMagnetic.model().index(7,0) 
     130        self.assertEqual(str(mag_index.data().toString()), "mtheta:sld_solvent") 
     131        mag_index = fittingWindow.lstMagnetic.model().index(8,0) 
     132        self.assertEqual(str(mag_index.data().toString()), "mphi:sld_solvent") 
     133 
     134        # test the delegate a bit 
     135        delegate = fittingWindow.lstMagnetic.itemDelegate() 
     136        self.assertEqual(delegate.editableParameters(), [1, 2, 3]) 
    104137        self.assertIsInstance(delegate.combo_updated, QtCore.pyqtBoundSignal) 
    105138 
Note: See TracChangeset for help on using the changeset viewer.