Ignore:
Timestamp:
Feb 28, 2018 6:04:56 AM (7 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:
91ad45c
Parents:
c3eb858
Message:

Fixed issue with unwanted headers

File:
1 edited

Legend:

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

    r53c771e rfde5bcd  
    11import sys 
    22import unittest 
    3 from PyQt5 import QtGui 
     3from PyQt5 import QtGui, QtCore 
    44 
    55from sas.qtgui.Plotting.PlotterData import Data1D 
     
    266266            chi = FittingUtilities.calculateChi2(reference_data, current_data) 
    267267 
     268    def notestAddHeadersToModel(self): 
     269        '''Check to see if headers are correctly applied''' 
     270        #test model 
     271        model = QtGui.QStandardItemModel() 
     272        FittingUtilities.addHeadersToModel(model) 
     273 
     274        # Assure we have properly named columns 
     275        names = FittingUtilities.model_header_captions 
     276        names_from_model = [model.headerData(i, QtCore.Qt.Horizontal) for i in range(len(names))] 
     277        self.assertEqual(names, names_from_model) 
     278 
     279        # Add another model 
     280        model2 = QtGui.QStandardItemModel() 
     281        # Add headers again 
     282        FittingUtilities.addHeadersToModel(model2) 
     283        # We still should have only the original names 
     284        names_from_model2 = [model2.headerData(i, QtCore.Qt.Horizontal) for i in range(len(names))] 
     285        self.assertEqual(names, names_from_model2) 
     286 
     287 
    268288if __name__ == "__main__": 
    269289    unittest.main() 
Note: See TracChangeset for help on using the changeset viewer.