Ignore:
Timestamp:
Feb 2, 2017 8:29:07 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:
965fbd8
Parents:
5d89f43
git-author:
Piotr Rozyczko <rozyczko@…> (01/23/17 09:21:03)
git-committer:
Piotr Rozyczko <rozyczko@…> (02/02/17 08:29:07)
Message:

Reimplementation of the slicer functionality

File:
1 edited

Legend:

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

    r03c372d r3bdbfcc  
    11import sys 
    22import unittest 
     3import numpy 
    34 
    45from PyQt4 import QtGui 
     
    2425    def setUp(self): 
    2526        '''create''' 
    26         self.plotter = Plotter2D.Plotter2D(None, quickplot=True) 
     27        class dummy_manager(object): 
     28            def communicator(self): 
     29                return Communicate() 
     30            def perspective(self): 
     31                return MyPerspective() 
     32            def workspace(self): 
     33                return None 
     34 
     35        self.plotter = Plotter2D.Plotter2D(parent=dummy_manager(), quickplot=True) 
    2736 
    2837        self.data = Data2D(image=[0.1]*4, 
     
    103112 
    104113        self.assertTrue(FigureCanvas.draw_idle.called) 
     114 
     115    def testOnBoxSum(self): 
     116        """ Test the box sum display and functionality """ 
     117 
     118        # hacky way to make things work in manipulations._sum 
     119        self.data.detector = [1] 
     120        self.data.err_data = numpy.array([0.0, 0.0, 0.1, 0.0]) 
     121        self.plotter.data = self.data 
     122        self.plotter.show() 
     123 
     124        # Mock the main window 
     125        self.plotter.manager.parent = MagicMock() 
     126 
     127        # Call the main tested method 
     128        self.plotter.onBoxSum() 
     129 
     130        # Test various properties 
     131        self.assertIsInstance(self.plotter.slicer.model(), QtGui.QStandardItemModel) 
     132        self.assertTrue(self.plotter.boxwidget.isVisible()) 
     133        self.assertIsInstance(self.plotter.boxwidget.model, QtGui.QStandardItemModel) 
    105134 
    106135    def testContextMenuQuickPlot(self): 
Note: See TracChangeset for help on using the changeset viewer.