Changeset b2a5042 in sasview for src


Ignore:
Timestamp:
Aug 22, 2017 6:10:57 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:
e43fc91
Parents:
464cd07
Message:

Allow QClipboard tests on windows only

Location:
src/sas/qtgui/Plotting/UnitTesting
Files:
3 edited

Legend:

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

    r464cd07 rb2a5042  
    22import unittest 
    33import numpy 
     4import platform 
    45 
    56from PyQt4 import QtGui 
     
    4849        self.data.title="Test data" 
    4950        self.data.id = 1 
     51        self.isWindows = platform.system=="Windows" 
    5052 
    5153    def tearDown(self): 
     
    156158        self.assertEqual(actions[2].text(), "Copy to Clipboard") 
    157159 
     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 
    158172        # Spy on cliboard's dataChanged() signal 
     173        if not self.isWindows: 
     174            return 
    159175        self.clipboard_called = False 
    160176        def done(): 
     
    164180        QtGui.qApp.processEvents() 
    165181        # 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) 
    179183 
    180184    def testShowNoPlot(self): 
  • src/sas/qtgui/Plotting/UnitTesting/PlotterBaseTest.py

    r464cd07 rb2a5042  
    11import sys 
    22import unittest 
     3import platform 
    34from mock import patch, MagicMock 
    45 
     
    3536        #PlotterBase.PlotterBase.contextMenuQuickPlot = MagicMock() 
    3637        self.plotter = PlotterBase.PlotterBase(None, manager=dummy_manager(), quickplot=True) 
     38        self.isWindows = platform.system=="Windows" 
    3739 
    3840    def tearDown(self): 
     
    147149 
    148150        # Spy on cliboard's dataChanged() signal 
     151        if not self.isWindows: 
     152            return 
    149153        self.clipboard_called = False 
    150154        def done(): 
  • src/sas/qtgui/Plotting/UnitTesting/PlotterTest.py

    r464cd07 rb2a5042  
    11import sys 
    22import unittest 
     3import platform 
    34 
    45from PyQt4 import QtGui 
     
    3738        self.data.name="Test name" 
    3839        self.data.id = 1 
     40        self.isWindows = platform.system=="Windows" 
    3941 
    4042    def tearDown(self): 
     
    9496        self.assertEqual(actions[2].text(), "Copy to Clipboard") 
    9597 
     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 
    96110        # Spy on cliboard's dataChanged() signal 
     111        if not self.isWindows: 
     112            return 
    97113        self.clipboard_called = False 
    98114        def done(): 
     
    102118        QtGui.qApp.processEvents() 
    103119        # 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) 
    117121 
    118122    def testXyTransform(self): 
Note: See TracChangeset for help on using the changeset viewer.