Ignore:
Timestamp:
Dec 1, 2017 2:51:32 AM (6 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:
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.
Message:

Merge branch 'ESS_GUI_SasView795' into ESS_GUI

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Utilities/UnitTesting/GuiUtilsTest.py

    r0261bc1 r6cb305a  
    100100        Test the QModelItem checkbox update method 
    101101        """ 
     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 
    102110        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]) 
    105112        name = "Black Sabbath" 
    106  
     113        update_data.id = '[0]data0' 
     114        update_data.name = 'data0' 
    107115        # update the item 
    108116        updateModelItemWithPlot(test_item, update_data, name) 
    109          
     117 
    110118        # Make sure test_item got all data added 
    111119        self.assertEqual(test_item.child(0).text(), name) 
    112120        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]) 
    117149 
    118150 
     
    162194        # Make sure only the checked data is present 
    163195        # FRIDAY IN 
    164         self.assertIn(test_list0, plot_list[0]) 
     196        self.assertIn(test_list0, plot_list[1]) 
    165197        # SATURDAY IN 
    166         self.assertIn(test_list1, plot_list[1]) 
     198        self.assertIn(test_list1, plot_list[0]) 
    167199        # MONDAY NOT IN 
    168200        self.assertNotIn(test_list2, plot_list[0]) 
Note: See TracChangeset for help on using the changeset viewer.