aboutsummaryrefslogtreecommitdiffstats
path: root/tests/pysidetest
diff options
context:
space:
mode:
Diffstat (limited to 'tests/pysidetest')
-rw-r--r--tests/pysidetest/CMakeLists.txt5
-rw-r--r--tests/pysidetest/decoratedslot_test.py39
2 files changed, 42 insertions, 2 deletions
diff --git a/tests/pysidetest/CMakeLists.txt b/tests/pysidetest/CMakeLists.txt
index 4b94a2aff..61ee424e4 100644
--- a/tests/pysidetest/CMakeLists.txt
+++ b/tests/pysidetest/CMakeLists.txt
@@ -72,9 +72,10 @@ target_link_libraries(testbinding
add_dependencies(testbinding pyside QtCore QtGui libpyside pysidetest)
-PYSIDE_TEST(homonymoussignalandmethod_test.py)
+PYSIDE_TEST(decoratedslot_test.py)
PYSIDE_TEST(delegatecreateseditor_test.py)
+PYSIDE_TEST(homonymoussignalandmethod_test.py)
+PYSIDE_TEST(list_signal_test.py)
PYSIDE_TEST(modelview_test.py)
PYSIDE_TEST(version_test.py)
-PYSIDE_TEST(list_signal_test.py)
diff --git a/tests/pysidetest/decoratedslot_test.py b/tests/pysidetest/decoratedslot_test.py
new file mode 100644
index 000000000..63a5be72a
--- /dev/null
+++ b/tests/pysidetest/decoratedslot_test.py
@@ -0,0 +1,39 @@
+#!/usr/bin/python
+
+import unittest
+from PySide.QtCore import QObject
+from testbinding import TestObject
+
+class Receiver(QObject):
+ def __init__(self):
+ QObject.__init__(self)
+ self.called = False
+
+ def ReceiverDecorator(func):
+ def decoratedFunction(self, *args, **kw):
+ func(self, *args, **kw)
+ return decoratedFunction
+
+ # This method with the same name of the internal decorated function
+ # is here to test the binding capabilities.
+ def decoratedFunction(self):
+ pass
+
+ @ReceiverDecorator
+ def slot(self):
+ self.called = True
+
+
+class DecoratedSlotTest(unittest.TestCase):
+
+ def testCallingOfDecoratedSlot(self):
+ obj = TestObject(0)
+ receiver = Receiver()
+ obj.staticMethodDouble.connect(receiver.slot)
+ obj.emitStaticMethodDoubleSignal()
+ self.assert_(receiver.called)
+
+
+if __name__ == '__main__':
+ unittest.main()
+