Ignore:
Timestamp:
Jun 8, 2016 9:56:28 AM (8 years ago)
Author:
Piotr Rozyczko <piotr.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:
5032ea68
Parents:
f721030
git-author:
Piotr Rozyczko <piotr.rozyczko@…> (06/08/16 09:53:59)
git-committer:
Piotr Rozyczko <piotr.rozyczko@…> (06/08/16 09:56:28)
Message:

Hold data objects in model. Added more Data Explorer functionality. Added unit tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/UnitTesting/DataExplorerTest.py

    rf721030 r488c49d  
    4545 
    4646        self.assertEqual(self.form.cbSelect.count(), 6) 
     47        self.assertEqual(self.form.cbSelect.currentIndex(), 0) 
    4748 
    4849        # Class is in the default state even without pressing OK 
     
    100101        # Assure the model contains no items 
    101102 
     103    def testDataSelection(self): 
     104        """ 
     105        Tests the functionality of the Selection Option combobox 
     106        """ 
     107        # Populate the model with 1d and 2d data 
     108        filename = ["cyl_400_20.txt", "Dec07031.ASC"] 
     109        self.form.readData(filename) 
     110 
     111        # Unselect all data 
     112        self.form.cbSelect.setCurrentIndex(1) 
     113 
     114        # Test the current selection 
     115        item1D = self.form.model.item(0) 
     116        item2D = self.form.model.item(1) 
     117        self.assertTrue(item1D.checkState() == QtCore.Qt.Unchecked) 
     118        self.assertTrue(item2D.checkState() == QtCore.Qt.Unchecked)         
     119 
     120        # Select all data 
     121        self.form.cbSelect.setCurrentIndex(0) 
     122 
     123        # Test the current selection 
     124        self.assertTrue(item1D.checkState() == QtCore.Qt.Checked) 
     125        self.assertTrue(item2D.checkState() == QtCore.Qt.Checked)         
     126 
     127        # select 1d data 
     128        self.form.cbSelect.setCurrentIndex(2) 
     129 
     130        # Test the current selection 
     131        self.assertTrue(item1D.checkState() == QtCore.Qt.Checked) 
     132        self.assertTrue(item2D.checkState() == QtCore.Qt.Unchecked)         
     133 
     134        # unselect 1d data 
     135        self.form.cbSelect.setCurrentIndex(3) 
     136 
     137        # Test the current selection 
     138        self.assertTrue(item1D.checkState() == QtCore.Qt.Unchecked) 
     139        self.assertTrue(item2D.checkState() == QtCore.Qt.Unchecked)         
     140 
     141        # select 2d data 
     142        self.form.cbSelect.setCurrentIndex(4) 
     143 
     144        # Test the current selection 
     145        self.assertTrue(item1D.checkState() == QtCore.Qt.Unchecked) 
     146        self.assertTrue(item2D.checkState() == QtCore.Qt.Checked)         
     147 
     148        # unselect 2d data 
     149        self.form.cbSelect.setCurrentIndex(5) 
     150 
     151        # Test the current selection 
     152        self.assertTrue(item1D.checkState() == QtCore.Qt.Unchecked) 
     153        self.assertTrue(item2D.checkState() == QtCore.Qt.Unchecked)         
     154 
     155        # choose impossible index and assure the code raises 
     156        #with self.assertRaises(Exception): 
     157        #    self.form.cbSelect.setCurrentIndex(6) 
     158 
    102159    def testReadData(self): 
    103160        """ 
Note: See TracChangeset for help on using the changeset viewer.