From b40aa87208d4899b07e23f327a3786bd8c766124 Mon Sep 17 00:00:00 2001 From: Gian Mario Tagliaretti Date: Thu, 26 Jul 2007 21:25:53 +0000 Subject: wrap GtkContainer do_forall by Paul Pogonyshev svn path=/trunk/; revision=2862 --- tests/test_container.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'tests') diff --git a/tests/test_container.py b/tests/test_container.py index a970fa44..fa1f6411 100644 --- a/tests/test_container.py +++ b/tests/test_container.py @@ -41,6 +41,23 @@ MyContainer.install_child_property(1, 'Dumb Prop', 'Dumb Property for testing purposes', '', gobject.PARAM_READWRITE)) + +class MyAlignment(gtk.Alignment): + + def __init__(self, caption): + self.caption = gtk.Label() + self.caption.set_markup('%s' % gobject.markup_escape_text(caption)) + + gtk.Alignment.__init__(self) + + self.caption.set_parent(self) + + def do_forall(self, include_internals, callback, callback_data): + callback(self.caption, callback_data) + gtk.Alignment.do_forall(self, include_internals, callback, callback_data) + +# FIXME: Why is it needed? +gobject.type_register(MyAlignment) class ContainerTest(unittest.TestCase): @@ -52,5 +69,14 @@ class ContainerTest(unittest.TestCase): obj.child_set_property(label, 'dumb_prop', v) self.assertEqual(v, obj.child_get_property(label, 'dumb_prop')) + def testSuperclassForAll(self): + alignment = MyAlignment('test') + label = gtk.Label('foo') + alignment.add(label) + alignment.show_all() + + self.assert_(label.flags() & gtk.VISIBLE) + self.assert_(alignment.caption.flags() & gtk.VISIBLE) + if __name__ == '__main__': unittest.main() -- cgit v1.2.1