Changes in src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingWidgetTest.py [53c771e:3e8dee3] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingWidgetTest.py
r53c771e r3e8dee3 104 104 self.assertEqual(delegate.editableParameters(), [1, 2, 3, 4, 5]) 105 105 self.assertEqual(delegate.poly_function, 6) 106 self.assertIsInstance(delegate.combo_updated, QtCore.pyqtBoundSignal)107 108 def testSelectMagnetism(self):109 """110 Test if models have been loaded properly111 """112 fittingWindow = self.widget113 114 self.assertIsInstance(fittingWindow.lstMagnetic.itemDelegate(), QtGui.QStyledItemDelegate)115 #Test loading from json categories116 fittingWindow.SASModelToQModel("cylinder")117 mag_index = fittingWindow.lstMagnetic.model().index(0,0)118 self.assertEqual(str(mag_index.data().toString()), "up:frac_i")119 mag_index = fittingWindow.lstMagnetic.model().index(1,0)120 self.assertEqual(str(mag_index.data().toString()), "up:frac_f")121 mag_index = fittingWindow.lstMagnetic.model().index(2,0)122 self.assertEqual(str(mag_index.data().toString()), "up:angle")123 mag_index = fittingWindow.lstMagnetic.model().index(3,0)124 self.assertEqual(str(mag_index.data().toString()), "M0:sld")125 mag_index = fittingWindow.lstMagnetic.model().index(4,0)126 self.assertEqual(str(mag_index.data().toString()), "mtheta:sld")127 mag_index = fittingWindow.lstMagnetic.model().index(5,0)128 self.assertEqual(str(mag_index.data().toString()), "mphi:sld")129 mag_index = fittingWindow.lstMagnetic.model().index(6,0)130 self.assertEqual(str(mag_index.data().toString()), "M0:sld_solvent")131 mag_index = fittingWindow.lstMagnetic.model().index(7,0)132 self.assertEqual(str(mag_index.data().toString()), "mtheta:sld_solvent")133 mag_index = fittingWindow.lstMagnetic.model().index(8,0)134 self.assertEqual(str(mag_index.data().toString()), "mphi:sld_solvent")135 136 # test the delegate a bit137 delegate = fittingWindow.lstMagnetic.itemDelegate()138 self.assertEqual(delegate.editableParameters(), [1, 2, 3])139 106 self.assertIsInstance(delegate.combo_updated, QtCore.pyqtBoundSignal) 140 107 … … 860 827 self.assertEqual(self.widget.cbModel.currentText(), 'onion') 861 828 self.assertTrue(self.widget.chkPolydispersity.isChecked()) 862 #Check if polidispersity tab is available863 self.assertTrue(self.widget.tabFitting.isTabEnabled(3))864 865 #Check if magnetism box and tab are disabled when 1D data is loaded866 self.assertFalse(self.widget.chkMagnetism.isEnabled())867 self.assertFalse(self.widget.tabFitting.isTabEnabled(4))868 869 def testReadFitPage2D(self):870 """871 Read in the fitpage object and restore state872 """873 # Set data874 875 test_data = Data2D(image=[1.0, 2.0, 3.0],876 err_image=[0.01, 0.02, 0.03],877 qx_data=[0.1, 0.2, 0.3],878 qy_data=[0.1, 0.2, 0.3],879 xmin=0.1, xmax=0.3, ymin=0.1, ymax=0.3,880 mask=[True, True, True])881 882 # Force same data into logic883 self.widget.logic.data = test_data884 self.widget.data_is_loaded = True885 886 #item = QtGui.QStandardItem()887 #updateModelItem(item, [test_data], "test")888 # Force same data into logic889 #self.widget.logic.data = item890 #self.widget.data_is_loaded = True891 892 category_index = self.widget.cbCategory.findText("Cylinder")893 self.widget.cbCategory.setCurrentIndex(category_index)894 895 # Test no fitting params896 self.widget.parameters_to_fit = ['scale']897 898 # Invoke the tested method899 fp = self.widget.currentState()900 901 # Prepare modified fit page902 fp.current_model = 'cylinder'903 fp.is_polydisperse = True904 fp.is_magnetic = True905 fp.is2D = True906 907 # Read in modified state908 self.widget.readFitPage(fp)909 910 # Check if the widget got updated accordingly911 self.assertEqual(self.widget.cbModel.currentText(), 'cylinder')912 self.assertTrue(self.widget.chkPolydispersity.isChecked())913 self.assertTrue(self.widget.chkPolydispersity.isEnabled())914 #Check if polidispersity tab is available915 self.assertTrue(self.widget.tabFitting.isTabEnabled(3))916 917 #Check if magnetism box and tab are disabled when 1D data is loaded918 self.assertTrue(self.widget.chkMagnetism.isChecked())919 self.assertTrue(self.widget.chkMagnetism.isEnabled())920 self.assertTrue(self.widget.tabFitting.isTabEnabled(4))921 829 922 830 def testCurrentState(self):
Note: See TracChangeset
for help on using the changeset viewer.