summaryrefslogtreecommitdiff
path: root/tests/test_source.py
diff options
context:
space:
mode:
authorMartin Pitt <martinpitt@gnome.org>2012-04-04 17:54:52 +0200
committerMartin Pitt <martinpitt@gnome.org>2012-04-04 17:54:52 +0200
commitd4054be9de3b7e4ed64c8172ebbde0a697462c79 (patch)
tree7413561c03f596b1f5058b0dc2ce5dbdcb8a7a02 /tests/test_source.py
parent05030a95a4d3090162ed5f510a26d69bbb152942 (diff)
downloadpygobject-d4054be9de3b7e4ed64c8172ebbde0a697462c79.tar.gz
Wrap GLib.Source.is_destroyed() method
Based on original patch from Bryan Silverthorn. https://bugzilla.gnome.org/show_bug.cgi?id=524719
Diffstat (limited to 'tests/test_source.py')
-rw-r--r--tests/test_source.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_source.py b/tests/test_source.py
index 85362adf..fe674cd0 100644
--- a/tests/test_source.py
+++ b/tests/test_source.py
@@ -89,6 +89,30 @@ class TestSource(unittest.TestCase):
assert dispatched[0]
+ def testIsDestroyedSimple(self):
+ s = GLib.Source()
+
+ self.assertFalse(s.is_destroyed())
+ s.destroy()
+ self.assertTrue(s.is_destroyed())
+
+ c = GLib.MainContext()
+ s = GLib.Source()
+ s.attach(c)
+ self.assertFalse(s.is_destroyed())
+ s.destroy()
+ self.assertTrue(s.is_destroyed())
+
+ def testIsDestroyedContext(self):
+ def f():
+ c = GLib.MainContext()
+ s = GLib.Source()
+ s.attach(c)
+ return s
+
+ s = f()
+ self.assertTrue(s.is_destroyed())
+
class TestTimeout(unittest.TestCase):
def test504337(self):