summaryrefslogtreecommitdiff
path: root/tests/test_source.py
diff options
context:
space:
mode:
authorMartin Pitt <martinpitt@gnome.org>2012-10-23 06:12:08 +0200
committerMartin Pitt <martinpitt@gnome.org>2012-10-23 06:12:08 +0200
commit126a10f765af3d3a6f08ce5db7ed9f3ef647848f (patch)
tree386699c049f6eb70e920aa52cd823e568c459e60 /tests/test_source.py
parent15f7442bd0c45db25073e3d8494094f1c284ffa4 (diff)
downloadpygobject-126a10f765af3d3a6f08ce5db7ed9f3ef647848f.tar.gz
Fix OverflowError in source_remove()
GSource IDs are unsigned, so we must use 'I' for parsing then, not 'i'. https://bugzilla.gnome.org/show_bug.cgi?id=684526
Diffstat (limited to 'tests/test_source.py')
-rw-r--r--tests/test_source.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/test_source.py b/tests/test_source.py
index ec47d0ea..4c8d24bd 100644
--- a/tests/test_source.py
+++ b/tests/test_source.py
@@ -2,7 +2,7 @@
import unittest
-from gi.repository import GLib
+from gi.repository import GLib, GObject
class Idle(GLib.Idle):
@@ -119,6 +119,17 @@ class TestSource(unittest.TestCase):
s = f()
self.assertTrue(s.is_destroyed())
+ def testRemove(self):
+ s = GLib.idle_add(dir)
+ self.assertEqual(GLib.source_remove(s), True)
+ # s is now removed, should fail now
+ self.assertEqual(GLib.source_remove(s), False)
+
+ # accepts large source IDs (they are unsigned)
+ self.assertEqual(GLib.source_remove(GObject.G_MAXINT32), False)
+ self.assertEqual(GLib.source_remove(GObject.G_MAXINT32 + 1), False)
+ self.assertEqual(GLib.source_remove(GObject.G_MAXUINT32), False)
+
class TestTimeout(unittest.TestCase):
def test504337(self):