diff options
author | Martin Pitt <martinpitt@gnome.org> | 2012-11-03 09:33:08 +0100 |
---|---|---|
committer | Martin Pitt <martinpitt@gnome.org> | 2012-11-03 11:25:34 +0100 |
commit | d7f095b01e7208273703c880f4f0dfcc1a152a9a (patch) | |
tree | b003856b90012b9a5467ecaaf6dc95d5f316227f /tests/test_source.py | |
parent | 648b653d85bf3bc28dc59c6d309f15d388076af9 (diff) | |
download | pygobject-d7f095b01e7208273703c880f4f0dfcc1a152a9a.tar.gz |
Restore actual GLib API after previous fix
Re-fix the acceptance of priority as first argument for idle_add(),
io_add_watch() and timeout_add(), as that is the real GLib API. Ensure that
this keeps supporting the backwards compatible API with supplying multiple user
data arguments.
https://bugzilla.gnome.org/show_bug.cgi?id=687047
Diffstat (limited to 'tests/test_source.py')
-rw-r--r-- | tests/test_source.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test_source.py b/tests/test_source.py index ba9ea376..dda492a3 100644 --- a/tests/test_source.py +++ b/tests/test_source.py @@ -218,6 +218,21 @@ class TestUserData(unittest.TestCase): ml.run() self.assertTrue(data['called']) + def test_idle_multidata(self): + ml = GLib.MainLoop() + + def cb(data, data2): + data['called'] = True + data['data2'] = data2 + ml.quit() + data = {} + id = GLib.idle_add(cb, data, 'hello') + self.assertEqual(ml.get_context().find_source_by_id(id).priority, + GLib.PRIORITY_DEFAULT_IDLE) + ml.run() + self.assertTrue(data['called']) + self.assertEqual(data['data2'], 'hello') + def test_timeout_data(self): ml = GLib.MainLoop() @@ -231,6 +246,21 @@ class TestUserData(unittest.TestCase): ml.run() self.assertTrue(data['called']) + def test_timeout_multidata(self): + ml = GLib.MainLoop() + + def cb(data, data2): + data['called'] = True + data['data2'] = data2 + ml.quit() + data = {} + id = GLib.timeout_add(50, cb, data, 'hello') + self.assertEqual(ml.get_context().find_source_by_id(id).priority, + GLib.PRIORITY_DEFAULT) + ml.run() + self.assertTrue(data['called']) + self.assertEqual(data['data2'], 'hello') + def test_idle_no_data_priority(self): ml = GLib.MainLoop() |