Changeset 200bd7e in sasview for src/sas/qtgui/Utilities/UnitTesting
- Timestamp:
- Dec 1, 2017 2:51:32 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:
- 50bfab0
- Parents:
- 19fce84 (diff), 6cb305a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Utilities/UnitTesting/GuiUtilsTest.py
r0261bc1 r6cb305a 100 100 Test the QModelItem checkbox update method 101 101 """ 102 # test_item = QtGui.QStandardItem() 103 # test_list = ['aa','11'] 104 # update_data = test_list 105 # name = "Black Sabbath" 106 107 # # update the item 108 # updateModelItemWithPlot(test_item, update_data, name) 109 102 110 test_item = QtGui.QStandardItem() 103 test_list = ['aa','11'] 104 update_data = test_list 111 update_data = Data1D(x=[1.0, 2.0, 3.0], y=[10.0, 11.0, 12.0]) 105 112 name = "Black Sabbath" 106 113 update_data.id = '[0]data0' 114 update_data.name = 'data0' 107 115 # update the item 108 116 updateModelItemWithPlot(test_item, update_data, name) 109 117 110 118 # Make sure test_item got all data added 111 119 self.assertEqual(test_item.child(0).text(), name) 112 120 self.assertTrue(test_item.child(0).isCheckable()) 113 list_from_item = test_item.child(0).child(0).data() 114 self.assertIsInstance(list_from_item, list) 115 self.assertEqual(str(list_from_item[0]), test_list[0]) 116 self.assertEqual(str(list_from_item[1]), test_list[1]) 121 data_from_item = test_item.child(0).child(0).data() 122 self.assertIsInstance(data_from_item, Data1D) 123 self.assertSequenceEqual(list(data_from_item.x), [1.0, 2.0, 3.0]) 124 self.assertSequenceEqual(list(data_from_item.y), [10.0, 11.0, 12.0]) 125 self.assertEqual(test_item.rowCount(), 1) 126 127 # add another dataset (different from the first one) 128 update_data1 = Data1D(x=[1.1, 2.1, 3.1], y=[10.1, 11.1, 12.1]) 129 update_data1.id = '[0]data1' 130 update_data1.name = 'data1' 131 name1 = "Black Sabbath1" 132 # update the item and check number of rows 133 updateModelItemWithPlot(test_item, update_data1, name1) 134 135 self.assertEqual(test_item.rowCount(), 2) 136 137 # add another dataset (with the same name as the first one) 138 # check that number of rows was not changed but data have been updated 139 update_data2 = Data1D(x=[4.0, 5.0, 6.0], y=[13.0, 14.0, 15.0]) 140 update_data2.id = '[1]data0' 141 update_data2.name = 'data0' 142 name2 = "Black Sabbath2" 143 updateModelItemWithPlot(test_item, update_data2, name2) 144 self.assertEqual(test_item.rowCount(), 2) 145 146 data_from_item = test_item.child(0).child(0).data() 147 self.assertSequenceEqual(list(data_from_item.x), [4.0, 5.0, 6.0]) 148 self.assertSequenceEqual(list(data_from_item.y), [13.0, 14.0, 15.0]) 117 149 118 150 … … 162 194 # Make sure only the checked data is present 163 195 # FRIDAY IN 164 self.assertIn(test_list0, plot_list[ 0])196 self.assertIn(test_list0, plot_list[1]) 165 197 # SATURDAY IN 166 self.assertIn(test_list1, plot_list[ 1])198 self.assertIn(test_list1, plot_list[0]) 167 199 # MONDAY NOT IN 168 200 self.assertNotIn(test_list2, plot_list[0])
Note: See TracChangeset
for help on using the changeset viewer.