Changeset 2241130 in sasview


Ignore:
Timestamp:
May 15, 2017 5:40:12 AM (8 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:
00b3b40
Parents:
6011788
Message:

Added more unit tests for SASVIEW-569

Location:
src/sas/qtgui/Perspectives/Fitting
Files:
2 edited

Legend:

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

    r6011788 r2241130  
    8080        # Does the control support UNDO/REDO 
    8181        # temporarily off 
    82         self.support_undo = False 
     82        self.undo_supported = False 
     83        self.page_stack = [] 
    8384 
    8485        # Data for chosen model 
     
    369370 
    370371        # Update state stack 
    371         if self.support_undo: 
     372        if self.undo_supported: 
    372373            state = self.currentState() 
    373374            self.pushFitPage(state) 
     
    877878        if model_column == 1: 
    878879            self.recalculatePlotData() 
     880 
     881        # Update state stack 
     882        if self.undo_supported: 
     883            state = self.currentState() 
     884            self.pushFitPage(state) 
    879885 
    880886    def checkboxSelected(self, item): 
  • src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingWidgetTest.py

    r6011788 r2241130  
    606606        Push current state of fitpage onto stack 
    607607        """ 
    608         pass 
     608        # Set data 
     609        test_data = Data1D(x=[1,2], y=[1,2]) 
     610 
     611        # Force same data into logic 
     612        self.widget.logic.data = test_data 
     613        self.widget.data_is_loaded = True 
     614        category_index = self.widget.cbCategory.findText("Sphere") 
     615 
     616        # Asses the initial state of stack 
     617        self.assertEqual(self.widget.page_stack, []) 
     618 
     619        # Set the undo flag 
     620        self.widget.undo_supported = True 
     621        self.widget.cbCategory.setCurrentIndex(category_index) 
     622        self.widget.parameters_to_fit = ['scale'] 
     623 
     624        # Check that the stack is updated 
     625        self.assertEqual(len(self.widget.page_stack), 1) 
     626 
     627        # Change another parameter 
     628        self.widget._model_model.item(2, 1).setText("3.0") 
     629        # Check that the stack is updated 
     630        self.assertEqual(len(self.widget.page_stack), 2) 
    609631 
    610632    def testPopFitPage(self): 
     
    612634        Pop current state of fitpage from stack 
    613635        """ 
     636        # TODO: to be added when implementing UNDO/REDO 
    614637        pass 
    615638 
Note: See TracChangeset for help on using the changeset viewer.