Added test from Lauro's patch on bug #313.
http://bugs.openbossa.org/show_bug.cgi?id=313
This commit is contained in:
parent
b47f82c498
commit
562bb8a822
1 changed files with 31 additions and 2 deletions
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from PySide.QtCore import QObject, QTimer, QCoreApplication, SIGNAL
|
from PySide.QtCore import QObject, QTimer, QCoreApplication, Signal
|
||||||
from helper import UsesQCoreApplication
|
from helper import UsesQCoreApplication
|
||||||
|
|
||||||
class WatchDog(QObject):
|
class WatchDog(QObject):
|
||||||
|
|
@ -40,7 +40,36 @@ class TestSingleShot(UsesQCoreApplication):
|
||||||
self.app.quit()
|
self.app.quit()
|
||||||
|
|
||||||
def testSingleShot(self):
|
def testSingleShot(self):
|
||||||
timer = QTimer.singleShot(100, self.callback)
|
QTimer.singleShot(100, self.callback)
|
||||||
|
self.app.exec_()
|
||||||
|
self.assert_(self.called)
|
||||||
|
|
||||||
|
class SigEmitter(QObject):
|
||||||
|
|
||||||
|
sig1 = Signal()
|
||||||
|
|
||||||
|
|
||||||
|
class TestSingleShotSignal(UsesQCoreApplication):
|
||||||
|
'''Test case for QTimer.singleShot connecting to signals'''
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
UsesQCoreApplication.setUp(self)
|
||||||
|
self.watchdog = WatchDog(self)
|
||||||
|
self.called = False
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
del self.watchdog
|
||||||
|
del self.called
|
||||||
|
UsesQCoreApplication.tearDown(self)
|
||||||
|
|
||||||
|
def callback(self):
|
||||||
|
self.called = True
|
||||||
|
self.app.quit()
|
||||||
|
|
||||||
|
def testSingleShotSignal(self):
|
||||||
|
emitter = SigEmitter()
|
||||||
|
emitter.sig1.connect(self.callback)
|
||||||
|
QTimer.singleShot(100, emitter.sig1)
|
||||||
self.app.exec_()
|
self.app.exec_()
|
||||||
self.assert_(self.called)
|
self.assert_(self.called)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue