Ignore:
Timestamp:
Nov 9, 2017 8:45:20 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:
dd150ef
Parents:
d6b8a1d
git-author:
Piotr Rozyczko <rozyczko@…> (11/08/17 09:22:45)
git-committer:
Piotr Rozyczko <rozyczko@…> (11/09/17 08:45:20)
Message:

Converted unit tests

File:
1 edited

Legend:

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

    r7fb471d r53c771e  
    33from unittest.mock import MagicMock 
    44 
    5 from PyQt4 import QtGui 
     5from PyQt5 import QtGui, QtWidgets 
    66 
    77# set up import paths 
     
    1111from sas.qtgui.Plotting.AddText import AddText 
    1212 
    13 if not QtGui.QApplication.instance(): 
    14     app = QtGui.QApplication(sys.argv) 
     13if not QtWidgets.QApplication.instance(): 
     14    app = QtWidgets.QApplication(sys.argv) 
    1515 
    1616class AddTextTest(unittest.TestCase): 
     
    2727    def testDefaults(self): 
    2828        '''Test the GUI in its default state''' 
    29         self.assertIsInstance(self.widget, QtGui.QDialog) 
     29        self.assertIsInstance(self.widget, QtWidgets.QDialog) 
    3030        self.assertIsInstance(self.widget._font, QtGui.QFont) 
    3131        self.assertEqual(self.widget._color, "black") 
     
    3434        '''Test the QFontDialog output''' 
    3535        font_1 = QtGui.QFont("Helvetica", 15) 
    36         QtGui.QFontDialog.getFont = MagicMock(return_value=(font_1, True)) 
     36        QtWidgets.QFontDialog.getFont = MagicMock(return_value=(font_1, True)) 
    3737        # Call the method 
    3838        self.widget.onFontChange(None) 
     
    4242        # See that rejecting the dialog doesn't modify the font 
    4343        font_2 = QtGui.QFont("Arial", 9) 
    44         QtGui.QFontDialog.getFont = MagicMock(return_value=(font_2, False)) 
     44        QtWidgets.QFontDialog.getFont = MagicMock(return_value=(font_2, False)) 
    4545        # Call the method 
    4646        self.widget.onFontChange(None) 
     
    5151        ''' Test the QColorDialog output''' 
    5252        new_color = QtGui.QColor("red") 
    53         QtGui.QColorDialog.getColor = MagicMock(return_value=new_color) 
     53        QtWidgets.QColorDialog.getColor = MagicMock(return_value=new_color) 
    5454        # Call the method 
    5555        self.widget.onColorChange(None) 
Note: See TracChangeset for help on using the changeset viewer.