summaryrefslogtreecommitdiffstats
path: root/tests/signal.py
diff options
context:
space:
mode:
authorJohan Dahlin <jdahlin@src.gnome.org>2004-07-10 16:56:36 +0000
committerJohan Dahlin <jdahlin@src.gnome.org>2004-07-10 16:56:36 +0000
commit8238d9cc0fce600328f50efa139db1f575058ae8 (patch)
tree945ced41b87cdff3fd2ac2cb34b84d96f54ae2db /tests/signal.py
parentd47520065b91d4f2b9f7e4a53faf008adc780113 (diff)
downloadpygobject-8238d9cc0fce600328f50efa139db1f575058ae8.tar.gz
pygobject-8238d9cc0fce600328f50efa139db1f575058ae8.tar.xz
pygobject-8238d9cc0fce600328f50efa139db1f575058ae8.zip
New script to run all tests in one take
* tests/runtests.py: New script to run all tests in one take * tests/Makefile.am: autotoolify * tests/signal.py: New simple test taken from examples/gobject/signal.py
Diffstat (limited to 'tests/signal.py')
-rw-r--r--tests/signal.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/signal.py b/tests/signal.py
new file mode 100644
index 0000000..ce32801
--- /dev/null
+++ b/tests/signal.py
@@ -0,0 +1,46 @@
+# -*- Mode: Python -*-
+
+import unittest
+
+import gobject
+
+class C(gobject.GObject):
+ __gsignals__ = { 'my_signal': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
+ (gobject.TYPE_INT,)) }
+ def do_my_signal(self, arg):
+ self.arg = arg
+gobject.type_register(C)
+
+class D(C):
+ def do_my_signal(self, arg2):
+ self.arg2 = arg2
+ C.do_my_signal(self, arg2)
+gobject.type_register(D)
+
+class TestChaining(unittest.TestCase):
+ def setUp(self):
+ self.inst = C()
+ self.inst.connect("my_signal", self.my_signal_handler_cb, 1, 2, 3)
+
+ def my_signal_handler_cb(self, *args):
+ assert len(args) == 5
+ assert isinstance(args[0], C)
+ assert args[0] == self.inst
+
+ assert isinstance(args[1], int)
+ assert args[1] == 42
+
+ assert args[2:] == (1, 2, 3)
+
+ def testChaining(self):
+ self.inst.emit("my_signal", 42)
+ assert self.inst.arg == 42
+
+ def testChaining(self):
+ inst2 = D()
+ inst2.emit("my_signal", 44)
+ assert inst2.arg == 44
+ assert inst2.arg2 == 44
+
+if __name__ == '__main__':
+ unittest.main()