aboutsummaryrefslogtreecommitdiffstats
path: root/tests/QtCore/qtimer_singleshot_test.py
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2010-09-16 14:56:01 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2010-09-17 08:54:11 -0300
commit562bb8a822a8ef24066d75b613d9c2d05fb2fdee (patch)
tree13b41c79864a589abca5932ffcc8fd266d4224f7 /tests/QtCore/qtimer_singleshot_test.py
parentb47f82c498ff8dae8a418784026b40cc7ca41e31 (diff)
Added test from Lauro's patch on bug #313.
http://bugs.openbossa.org/show_bug.cgi?id=313
Diffstat (limited to 'tests/QtCore/qtimer_singleshot_test.py')
-rw-r--r--tests/QtCore/qtimer_singleshot_test.py33
1 files changed, 31 insertions, 2 deletions
diff --git a/tests/QtCore/qtimer_singleshot_test.py b/tests/QtCore/qtimer_singleshot_test.py
index 96107ecce..09c9ed662 100644
--- a/tests/QtCore/qtimer_singleshot_test.py
+++ b/tests/QtCore/qtimer_singleshot_test.py
@@ -4,7 +4,7 @@
import unittest
-from PySide.QtCore import QObject, QTimer, QCoreApplication, SIGNAL
+from PySide.QtCore import QObject, QTimer, QCoreApplication, Signal
from helper import UsesQCoreApplication
class WatchDog(QObject):
@@ -40,7 +40,36 @@ class TestSingleShot(UsesQCoreApplication):
self.app.quit()
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.assert_(self.called)