From ca9f9bd7c784486b1f712445d0659ea3ba19099c Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Sun, 31 Jul 2005 15:16:39 +0000 Subject: Fix reference count of gtk.Window's from gobject.new --- tests/test_subtype.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests') diff --git a/tests/test_subtype.py b/tests/test_subtype.py index a48452c..630344c 100644 --- a/tests/test_subtype.py +++ b/tests/test_subtype.py @@ -52,3 +52,21 @@ class TestSubType(unittest.TestCase): continue subname = name + "PyGtkTestSubclass" sub = type(subname, (cls,), {'__gtype_name__': subname }) + + def testGtkWindowObjNewRefcount(self): + foo = gobject.new(gtk.Window) + self.assertEqual(foo.__grefcount__, 2) + + def testGtkWindowFactoryRefcount(self): + foo = gtk.Window() + self.assertEqual(foo.__grefcount__, 2) + + def testPyWindowObjNewRefcount(self): + PyWindow = type('PyWindow', (gtk.Window,), dict(__gtype_name__='PyWindow1')) + foo = gobject.new(PyWindow) + self.assertEqual(foo.__grefcount__, 2) + + def testGtkWindowFactoryRefcount(self): + PyWindow = type('PyWindow', (gtk.Window,), dict(__gtype_name__='PyWindow2')) + foo = PyWindow() + self.assertEqual(foo.__grefcount__, 2) -- cgit