summaryrefslogtreecommitdiff
path: root/tests/test_source.py
diff options
context:
space:
mode:
authorMartin Pitt <martinpitt@gnome.org>2012-10-24 08:50:37 +0200
committerMartin Pitt <martinpitt@gnome.org>2012-10-24 09:28:20 +0200
commit1b27432abf6004553e9476d5ffeb2bf603534419 (patch)
tree41011f5e7edf5cc0e49c755ef995d413d0072d49 /tests/test_source.py
parent2357f4a0237feabcf6886f2a448aa3f42f6781b9 (diff)
downloadpygobject-1b27432abf6004553e9476d5ffeb2bf603534419.tar.gz
Remove static idle_add/timeout_add bindings
Use the GLib functions through GI instead. Add overrides to ensure that default arguments continue to work as before, and that callbacks are called without an userdata argument if it wasn't specified.
Diffstat (limited to 'tests/test_source.py')
-rw-r--r--tests/test_source.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_source.py b/tests/test_source.py
index cca4a94c..38d03ab9 100644
--- a/tests/test_source.py
+++ b/tests/test_source.py
@@ -276,6 +276,25 @@ class TestUserData(unittest.TestCase):
ml.run()
self.assertTrue(data['called'])
+ def cb_no_data(self):
+ self.loop.quit()
+
+ def test_idle_method_callback_no_data(self):
+ self.loop = GLib.MainLoop()
+ GLib.idle_add(self.cb_no_data)
+ self.loop.run()
+
+ def cb_with_data(self, data):
+ data['called'] = True
+ self.loop.quit()
+
+ def test_idle_method_callback_with_data(self):
+ self.loop = GLib.MainLoop()
+ data = {}
+ GLib.idle_add(self.cb_with_data, data)
+ self.loop.run()
+ self.assertTrue(data['called'])
+
if __name__ == '__main__':
unittest.main()