Split signal tests into gui and core tests
Can't use a QApplication and a QCoreApplication in the same process
This commit is contained in:
parent
359c973b42
commit
33c837a48d
7 changed files with 224 additions and 168 deletions
|
|
@ -7,15 +7,7 @@ import unittest
|
|||
|
||||
from PySide.QtCore import QObject, SIGNAL, QProcess
|
||||
|
||||
try:
|
||||
from PySide.QtGui import QApplication, QSpinBox, QPushButton
|
||||
except ImportError:
|
||||
QApplication = object
|
||||
QSpinBox = object
|
||||
QPushButton = object
|
||||
|
||||
from helper import UsesQApplication, UsesQCoreApplication
|
||||
from helper import decorators
|
||||
from helper import UsesQCoreApplication
|
||||
|
||||
|
||||
class Dummy(QObject):
|
||||
|
|
@ -69,25 +61,5 @@ class QtSigLambda(UsesQCoreApplication):
|
|||
self.assertEqual(dummy.called, proc.exitCode())
|
||||
|
||||
|
||||
@decorators.requires('PySide.QtGui')
|
||||
class QtGuiSigLambda(UsesQApplication):
|
||||
|
||||
def testButton(self):
|
||||
#Connecting a lambda to a QPushButton.clicked()
|
||||
obj = QPushButton('label')
|
||||
QObject.connect(obj, SIGNAL('clicked()'),
|
||||
lambda: setattr(obj, 'called', True))
|
||||
obj.click()
|
||||
self.assert_(obj.called)
|
||||
|
||||
def testSpinButton(self):
|
||||
#Connecting a lambda to a QPushButton.clicked()
|
||||
obj = QSpinBox()
|
||||
arg = 444
|
||||
QObject.connect(obj, SIGNAL('valueChanged(int)'),
|
||||
lambda x: setattr(obj, 'arg', 444))
|
||||
obj.setValue(444)
|
||||
self.assertEqual(obj.arg, arg)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue