diff options
author | Paul Pogonyshev <paulp@src.gnome.org> | 2007-08-11 19:01:34 +0000 |
---|---|---|
committer | Paul Pogonyshev <paulp@src.gnome.org> | 2007-08-11 19:01:34 +0000 |
commit | ec553aff3c547701b8a51c1f260561fe242b3615 (patch) | |
tree | 27f3a1c7b7177b2b6de1e83c26a9cd80391dc3e6 /tests | |
parent | 4dd03d03c68540b386f73ff8351c739f0fafcabb (diff) | |
download | pygtk-ec553aff3c547701b8a51c1f260561fe242b3615.tar.gz |
Allow None as argument for several focus-related methods.
svn path=/trunk/; revision=2879
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_container.py | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/tests/test_container.py b/tests/test_container.py index fa1f6411..c7e738ba 100644 --- a/tests/test_container.py +++ b/tests/test_container.py @@ -58,7 +58,23 @@ class MyAlignment(gtk.Alignment): # FIXME: Why is it needed? gobject.type_register(MyAlignment) - + +class FocusContainer(gtk.HBox): + + # Just call super. + def do_set_focus_child(self, widget): + gtk.HBox.do_set_focus_child(self, widget) + +gobject.type_register(FocusContainer) + +class FocusWindow(gtk.Window): + + # Just call super. + def do_set_focus(self, focus): + gtk.Window.do_set_focus(self, focus) + +gobject.type_register(FocusWindow) + class ContainerTest(unittest.TestCase): def testChildProperties(self): @@ -78,5 +94,24 @@ class ContainerTest(unittest.TestCase): self.assert_(label.flags() & gtk.VISIBLE) self.assert_(alignment.caption.flags() & gtk.VISIBLE) + def testFocusSignalHandlers(self): + button = gtk.Button() + container = FocusContainer() + window = FocusWindow() + container.add(button) + window.add(container) + window.show_all() + + button.grab_focus() + self.assert_(button.is_focus()) + + window.set_focus(None) + self.assert_(window.get_focus() is None) + + window.set_focus(button) + self.assert_(window.get_focus() == button) + + window.destroy() + if __name__ == '__main__': unittest.main() |