Changeset b2a5042 in sasview
- Timestamp:
- Aug 22, 2017 8:10:57 AM (7 years ago)
- 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:
- e43fc91
- Parents:
- 464cd07
- Location:
- src/sas/qtgui/Plotting/UnitTesting
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Plotting/UnitTesting/Plotter2DTest.py
r464cd07 rb2a5042 2 2 import unittest 3 3 import numpy 4 import platform 4 5 5 6 from PyQt4 import QtGui … … 48 49 self.data.title="Test data" 49 50 self.data.id = 1 51 self.isWindows = platform.system=="Windows" 50 52 51 53 def tearDown(self): … … 156 158 self.assertEqual(actions[2].text(), "Copy to Clipboard") 157 159 160 # Trigger Toggle Grid and make sure the method is called 161 self.assertEqual(actions[4].text(), "Toggle Grid On/Off") 162 self.plotter.ax.grid = MagicMock() 163 actions[4].trigger() 164 self.assertTrue(self.plotter.ax.grid.called) 165 166 # Trigger Change Scale and make sure the method is called 167 self.assertEqual(actions[6].text(), "Toggle Linear/Log Scale") 168 FigureCanvas.draw_idle = MagicMock() 169 actions[6].trigger() 170 self.assertTrue(FigureCanvas.draw_idle.called) 171 158 172 # Spy on cliboard's dataChanged() signal 173 if not self.isWindows: 174 return 159 175 self.clipboard_called = False 160 176 def done(): … … 164 180 QtGui.qApp.processEvents() 165 181 # Make sure clipboard got updated. 166 #self.assertTrue(self.clipboard_called) 167 168 # Trigger Toggle Grid and make sure the method is called 169 self.assertEqual(actions[4].text(), "Toggle Grid On/Off") 170 self.plotter.ax.grid = MagicMock() 171 actions[4].trigger() 172 self.assertTrue(self.plotter.ax.grid.called) 173 174 # Trigger Change Scale and make sure the method is called 175 self.assertEqual(actions[6].text(), "Toggle Linear/Log Scale") 176 FigureCanvas.draw_idle = MagicMock() 177 actions[6].trigger() 178 self.assertTrue(FigureCanvas.draw_idle.called) 182 self.assertTrue(self.clipboard_called) 179 183 180 184 def testShowNoPlot(self): -
src/sas/qtgui/Plotting/UnitTesting/PlotterBaseTest.py
r464cd07 rb2a5042 1 1 import sys 2 2 import unittest 3 import platform 3 4 from mock import patch, MagicMock 4 5 … … 35 36 #PlotterBase.PlotterBase.contextMenuQuickPlot = MagicMock() 36 37 self.plotter = PlotterBase.PlotterBase(None, manager=dummy_manager(), quickplot=True) 38 self.isWindows = platform.system=="Windows" 37 39 38 40 def tearDown(self): … … 147 149 148 150 # Spy on cliboard's dataChanged() signal 151 if not self.isWindows: 152 return 149 153 self.clipboard_called = False 150 154 def done(): -
src/sas/qtgui/Plotting/UnitTesting/PlotterTest.py
r464cd07 rb2a5042 1 1 import sys 2 2 import unittest 3 import platform 3 4 4 5 from PyQt4 import QtGui … … 37 38 self.data.name="Test name" 38 39 self.data.id = 1 40 self.isWindows = platform.system=="Windows" 39 41 40 42 def tearDown(self): … … 94 96 self.assertEqual(actions[2].text(), "Copy to Clipboard") 95 97 98 # Trigger Toggle Grid and make sure the method is called 99 self.assertEqual(actions[4].text(), "Toggle Grid On/Off") 100 self.plotter.ax.grid = MagicMock() 101 actions[4].trigger() 102 self.assertTrue(self.plotter.ax.grid.called) 103 104 # Trigger Change Scale and make sure the method is called 105 self.assertEqual(actions[6].text(), "Change Scale") 106 self.plotter.properties.exec_ = MagicMock(return_value=QtGui.QDialog.Rejected) 107 actions[6].trigger() 108 self.assertTrue(self.plotter.properties.exec_.called) 109 96 110 # Spy on cliboard's dataChanged() signal 111 if not self.isWindows: 112 return 97 113 self.clipboard_called = False 98 114 def done(): … … 102 118 QtGui.qApp.processEvents() 103 119 # Make sure clipboard got updated. 104 #self.assertTrue(self.clipboard_called) 105 106 # Trigger Toggle Grid and make sure the method is called 107 self.assertEqual(actions[4].text(), "Toggle Grid On/Off") 108 self.plotter.ax.grid = MagicMock() 109 actions[4].trigger() 110 self.assertTrue(self.plotter.ax.grid.called) 111 112 # Trigger Change Scale and make sure the method is called 113 self.assertEqual(actions[6].text(), "Change Scale") 114 self.plotter.properties.exec_ = MagicMock(return_value=QtGui.QDialog.Rejected) 115 actions[6].trigger() 116 self.assertTrue(self.plotter.properties.exec_.called) 120 self.assertTrue(self.clipboard_called) 117 121 118 122 def testXyTransform(self):
Note: See TracChangeset
for help on using the changeset viewer.