testinggtk r353 - trunk/tests



Author: bjornl
Date: Sun Aug  3 01:19:10 2008
New Revision: 353
URL: http://svn.gnome.org/viewvc/testinggtk?rev=353&view=rev

Log:
Test for syncing visibility

Modified:
   trunk/tests/test_uimanager.py

Modified: trunk/tests/test_uimanager.py
==============================================================================
--- trunk/tests/test_uimanager.py	(original)
+++ trunk/tests/test_uimanager.py	Sun Aug  3 01:19:10 2008
@@ -270,9 +270,9 @@
 
 def test_sync_sensitive():
     '''
-    A ``gtk.Toolbar`` is created using a ``gtk.UIManager``. When the
-    sensitivity of the action associated with the toolbar is updated,
-    the sensitivity of the toolbar should be changed too.
+    A ``gtk.ToolItem`` is created using a ``gtk.UIManager``. When the
+    sensitivity of the action associated with the tool item is
+    updated, the sensitivity of the tool item should be updated too.
     '''
     xml = '''
     <ui>
@@ -295,3 +295,31 @@
     for value in (False, True):
         ti_action.set_sensitive(value)
         assert ti.get_property('sensitive') == value
+
+def test_sync_visible():
+    '''
+    A ``gtk.ToolItem`` is created using a ``gtk.UIManager``. When the
+    visibility of the action associated with the tool item is updated,
+    the visibility of the tool item should be changed too.
+    '''
+    xml = '''
+    <ui>
+        <toolbar>
+            <toolitem name = "ti" action = "ti_action"/>
+        </toolbar>
+    </ui>
+    '''
+    ti_action = gtk.Action('ti_action', 'name', '', None)
+    ag = gtk.ActionGroup('foo')
+    ag.add_action(ti_action)
+
+    ui = gtk.UIManager()
+    ui.insert_action_group(ag)
+    ui.add_ui_from_string(xml)
+
+    ti = ui.get_widget('/ui/toolbar/ti')
+    assert ti.get_property('visible')
+
+    for value in (False, True):
+        ti_action.set_visible(value)
+        assert ti.get_property('visible') == value



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