testinggtk r351 - trunk/tests



Author: bjornl
Date: Sun Aug  3 00:56:39 2008
New Revision: 351
URL: http://svn.gnome.org/viewvc/testinggtk?rev=351&view=rev

Log:
Ensure that widget sensitivity is updated when action sensitivity changes

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 00:56:39 2008
@@ -256,7 +256,7 @@
                 <menu name = "open" action = "open"/>
             </menu>
         </menubar>
-    </ui>        
+    </ui>
     '''
     ag = gtk.ActionGroup('foo')
     ag.add_action(gtk.Action('file', 'name', '', None))
@@ -267,3 +267,31 @@
     ui.add_ui_from_string(xml)
     ui.remove_action_group(ag)
     assert ui.get_action_groups() == []
+
+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.
+    '''
+    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('sensitive')
+
+    for value in (False, True):
+        ti_action.set_sensitive(value)
+        assert ti.get_property('sensitive') == value



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