Ignore:
Timestamp:
Jan 23, 2017 5:54:43 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:
5d89f43
Parents:
092a3d9
Message:

Added unit tests to SASVIEW-391

File:
1 edited

Legend:

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

    r092a3d9 r03c372d  
    6464    def testCalculateDepth(self): 
    6565        ''' Test the depth calculator ''' 
    66         WarningTestNotImplemented() 
     66        self.plotter.data = self.data 
     67 
     68        # Default, log scale 
     69        depth = self.plotter.calculateDepth() 
     70        self.assertEqual(depth, (0.1, 1.e20)) 
     71 
     72        # Change the scale to linear 
     73        self.plotter.scale = 'linear' 
     74        depth = self.plotter.calculateDepth() 
     75        self.assertEqual(depth[0], -32.) 
     76        self.assertAlmostEqual(depth[1], 1.30103, 5) 
    6777 
    6878    def testOnColorMap(self): 
    6979        ''' Respond to the color map event ''' 
    70         WarningTestNotImplemented() 
     80        self.plotter.data = self.data 
     81        self.plotter.plot() 
     82        self.plotter.show() 
     83 
     84        QtGui.QDialog.exec_ = MagicMock(return_value=QtGui.QDialog.Accepted) 
     85 
     86        # Just this one plot 
     87        self.plotter.onColorMap() 
     88 
     89        # Check that exec_ got called 
     90        self.assertTrue(QtGui.QDialog.exec_.called) 
     91 
     92        self.assertEqual(self.plotter.cmap, "jet") 
     93        self.assertEqual(self.plotter.vmin, -0.1) 
     94        self.assertEqual(self.plotter.vmax, 0.1) 
    7195 
    7296    def testOnToggleScale(self): 
Note: See TracChangeset for help on using the changeset viewer.