aboutsummaryrefslogtreecommitdiffstats
path: root/tests/signals/signal_signature_test.py
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2010-07-29 15:02:48 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2010-07-29 15:19:55 -0300
commit6a2df2daa4e1efc5b7e6e5946c96a528ec9b7248 (patch)
tree01de2e8febf7ff702eae88c9222c6fe72f1fd695 /tests/signals/signal_signature_test.py
parent1fe7baf787381775e845923872d78096153ab5e3 (diff)
Added test case for signal signature received by QObject::connectNotify().
Reviewed by Luciano Wolf <luciano.wolf@openbossa.org> Reviewed by Renato Araújo <renato.filho@openbossa.org>
Diffstat (limited to 'tests/signals/signal_signature_test.py')
-rw-r--r--tests/signals/signal_signature_test.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/signals/signal_signature_test.py b/tests/signals/signal_signature_test.py
new file mode 100644
index 000000000..785ebb806
--- /dev/null
+++ b/tests/signals/signal_signature_test.py
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+
+'''Test case for signal signature received by QObject::connectNotify().'''
+
+import unittest
+from PySide.QtCore import *
+from helper import UsesQCoreApplication
+
+class Obj(QObject):
+ def __init__(self):
+ QObject.__init__(self)
+ self.signal = ''
+
+ def connectNotify(self, signal):
+ self.signal = signal
+
+def callback():
+ pass
+
+class TestConnectNotifyWithNewStyleSignals(UsesQCoreApplication):
+ '''Test case for signal signature received by QObject::connectNotify().'''
+
+ def testOldStyle(self):
+ sender = Obj()
+ receiver = QObject()
+ sender.connect(SIGNAL('destroyed()'), receiver, SLOT('deleteLater()'))
+ self.assertEqual(sender.signal, SIGNAL('destroyed()'))
+
+ def testOldStyleWithPythonCallback(self):
+ sender = Obj()
+ sender.connect(SIGNAL('destroyed()'), callback)
+ self.assertEqual(sender.signal, SIGNAL('destroyed()'))
+
+ def testNewStyle(self):
+ sender = Obj()
+ sender.destroyed.connect(callback)
+ self.assertEqual(sender.signal, SIGNAL('destroyed(QObject*)'))
+
+if __name__ == '__main__':
+ unittest.main()
+