testinggtk r302 - trunk/tests



Author: bjornl
Date: Sat Jun 28 14:46:03 2008
New Revision: 302
URL: http://svn.gnome.org/viewvc/testinggtk?rev=302&view=rev

Log:
Test change hide-if-empty property for empty submenu

Modified:
   trunk/tests/test_uimanager.py

Modified: trunk/tests/test_uimanager.py
==============================================================================
--- trunk/tests/test_uimanager.py	(original)
+++ trunk/tests/test_uimanager.py	Sat Jun 28 14:46:03 2008
@@ -92,3 +92,36 @@
     menubar = ui.get_widget('/ui/menubar')
     menubar.select_first(False)
 
+def test_change_hide_if_empty_updates_visibility():
+    '''
+    Ensure that when the ``hide-if-empty`` property is updated the
+    visibility of the associated ``gtk.MenuItem`` is also updated.
+
+    :bug: #540622
+    '''
+    xml = '''
+    <ui>
+        <menubar>
+            <menu name = "FileMenu" action = "action">
+                <menu name = "foo" action = "action"/>
+            </menu>
+        </menubar>
+    </ui>        
+    '''
+    action = gtk.Action('action', 'name', '', None)
+    ag = gtk.ActionGroup('default')
+    ag.add_action(action)
+
+    ui = gtk.UIManager()
+    ui.insert_action_group(ag)
+    ui.add_ui_from_string(xml)
+
+    foomenuitem = ui.get_widget('/ui/menubar/FileMenu/foo')
+
+    # hide-if-empty is True so the menu item is not visible
+    assert not foomenuitem.get_property('visible')
+
+    # menu item should now be visible
+    action.set_property('hide-if-empty', False)
+    assert foomenuitem.get_property('visible')
+



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