summaryrefslogtreecommitdiff
path: root/tests/test_source.py
diff options
context:
space:
mode:
authorJohan Dahlin <jdahlin@async.com.br>2008-04-08 14:27:54 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-04-08 14:27:54 +0000
commita60fd2b2679c18174cefc11a3ac5573bfe1d6d15 (patch)
treeaeff5c0669cce22b8cb2a1d276cb1a165630e09d /tests/test_source.py
parenta9dbdaaf11f703ed609b5a5591c3de2e8bcfa4d4 (diff)
downloadpygobject-a60fd2b2679c18174cefc11a3ac5573bfe1d6d15.tar.gz
Unbreak Source.prepare (#523075, Bryan Silverthorn)
2008-04-08 Johan Dahlin <jdahlin@async.com.br> * gobject/pygsource.c: * tests/test_source.py: Unbreak Source.prepare (#523075, Bryan Silverthorn) svn path=/trunk/; revision=766
Diffstat (limited to 'tests/test_source.py')
-rw-r--r--tests/test_source.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test_source.py b/tests/test_source.py
index 5e0f01b7..fd5f310e 100644
--- a/tests/test_source.py
+++ b/tests/test_source.py
@@ -62,5 +62,33 @@ class TestSource(unittest.TestCase):
assert self.pos >= 0 and idle.count >= 0
+ def testSourcePrepare(self):
+ # this test may not terminate if prepare() is wrapped incorrectly
+ dispatched = [False]
+ loop = gobject.MainLoop()
+
+ class CustomTimeout(gobject.Source):
+ def prepare(self):
+ return (False, 10)
+
+ def check(self):
+ return True
+
+ def dispatch(self, callback, args):
+ dispatched[0] = True
+
+ loop.quit()
+
+ return False
+
+ source = CustomTimeout()
+
+ source.attach()
+ source.set_callback(dir)
+
+ loop.run()
+
+ assert dispatched[0]
+
if __name__ == '__main__':
unittest.main()