[pygobject] Override UIManager.insert_action_group



commit d0049fa9982d13b3553b05569fb0a227e48b6647
Author: Paolo Borelli <pborelli gnome org>
Date:   Sun Nov 21 15:20:58 2010 +0100

    Override UIManager.insert_action_group
    
    https://bugzilla.gnome.org/show_bug.cgi?id=635437

 gi/overrides/Gtk.py     |    3 +++
 tests/test_overrides.py |   34 +++++++++++++++++++++-------------
 2 files changed, 24 insertions(+), 13 deletions(-)
---
diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py
index f09709c..7875998 100644
--- a/gi/overrides/Gtk.py
+++ b/gi/overrides/Gtk.py
@@ -237,6 +237,9 @@ class UIManager(Gtk.UIManager):
 
         return Gtk.UIManager.add_ui_from_string(self, buffer, length)
 
+    def insert_action_group(self, buffer, length=-1):
+        return Gtk.UIManager.insert_action_group(self, buffer, length)
+
 UIManager = override(UIManager)
 __all__.append('UIManager')
 
diff --git a/tests/test_overrides.py b/tests/test_overrides.py
index 6daa24f..d91ddcf 100644
--- a/tests/test_overrides.py
+++ b/tests/test_overrides.py
@@ -59,19 +59,6 @@ class TestGdk(unittest.TestCase):
         self.assertEquals(event.y_root, 5)
 
 class TestGtk(unittest.TestCase):
-    def test_uimanager(self):
-        self.assertEquals(Gtk.UIManager, overrides.Gtk.UIManager)
-        ui = Gtk.UIManager()
-        ui.add_ui_from_string(
-"""
-<ui>
-    <menubar name="menubar1"></menubar>
-</ui>
-"""
-)
-        menubar = ui.get_widget("/menubar1")
-        self.assertEquals(type(menubar), Gtk.MenuBar)
-
     def test_actiongroup(self):
         self.assertEquals(Gtk.ActionGroup, overrides.Gtk.ActionGroup)
         action_group = Gtk.ActionGroup (name = 'TestActionGroup')
@@ -112,6 +99,27 @@ class TestGtk(unittest.TestCase):
             expected_results.remove(a)
             action.activate()
 
+    def test_uimanager(self):
+        self.assertEquals(Gtk.UIManager, overrides.Gtk.UIManager)
+        ui = Gtk.UIManager()
+        ui.add_ui_from_string(
+"""
+<ui>
+    <menubar name="menubar1"></menubar>
+</ui>
+"""
+)
+        menubar = ui.get_widget("/menubar1")
+        self.assertEquals(type(menubar), Gtk.MenuBar)
+
+        ag = Gtk.ActionGroup (name="ag1")
+        ui.insert_action_group(ag)
+        ag2 = Gtk.ActionGroup (name="ag2")
+        ui.insert_action_group(ag2)
+        groups = ui.get_action_groups()
+        self.assertEquals(ag, groups[-2])
+        self.assertEquals(ag2, groups[-1])
+
     def test_builder(self):
         self.assertEquals(Gtk.Builder, overrides.Gtk.Builder)
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]