aboutsummaryrefslogtreecommitdiffstats
path: root/tests/qtcore/thread_signals.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/qtcore/thread_signals.py')
-rw-r--r--tests/qtcore/thread_signals.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/qtcore/thread_signals.py b/tests/qtcore/thread_signals.py
new file mode 100644
index 000000000..e2b66730b
--- /dev/null
+++ b/tests/qtcore/thread_signals.py
@@ -0,0 +1,39 @@
+
+''' Test case for QObject.signalsBlocked() and blockSignal()'''
+
+import unittest
+import os
+from tempfile import mkstemp
+
+from PySide.QtCore import QObject, SIGNAL, QFile, QThread, QTimer
+from helper import UsesQCoreApplication
+
+class MyThread(QThread):
+
+ def run(self):
+ self.emit(SIGNAL("test(const QString&)"),
+ "INdT - PySide");
+
+class TestThreadSignal(UsesQCoreApplication):
+
+ __called__ = True
+ def _callback(self, msg):
+ self.assertEqual(msg, "INdT - PySide")
+ self.__called__ = True
+ self._quit()
+
+ def _quit(self):
+ self.app.quit()
+
+ def testThread(self):
+ t = MyThread()
+ QObject.connect(t, SIGNAL("test(const QString&)"),
+ self._callback);
+
+ t.start()
+ QTimer.singleShot(100, self._quit)
+ self.app.exec_()
+ self.assert_(self.__called__);
+
+if __name__ == '__main__':
+ unittest.main()