[pygobject] tests: More robust tree view realization



commit 4706cd686ea1b25260c9ecc77abd324d6e4cf505
Author: Martin Pitt <martinpitt gnome org>
Date:   Wed Jan 16 09:17:13 2013 +0100

    tests: More robust tree view realization
    
    With current GNOME git head, the Gtk.TreeViews were not realized enough any
    more to receive property values. Put them into a Gtk.Dialog now and show it to
    ensure that they are realized.

 tests/test_overrides_gtk.py |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/tests/test_overrides_gtk.py b/tests/test_overrides_gtk.py
index d429d4d..9315019 100644
--- a/tests/test_overrides_gtk.py
+++ b/tests/test_overrides_gtk.py
@@ -1407,9 +1407,11 @@ class TestTreeView(unittest.TestCase):
         old_mask = GLib.log_set_always_fatal(
             GLib.LogLevelFlags.LEVEL_CRITICAL | GLib.LogLevelFlags.LEVEL_ERROR)
         try:
-            # causes the widget to get realized and cellN.props.text receive a
-            # value, otherwise it will be None.
-            tree.get_preferred_size()
+            # We must realize the TreeView for cell.props.text to receive a value
+            dialog = Gtk.Dialog()
+            dialog.get_action_area().add(tree)
+            dialog.show_all()
+            dialog.hide()
         finally:
             GLib.log_set_always_fatal(old_mask)
 
@@ -1444,9 +1446,11 @@ class TestTreeView(unittest.TestCase):
         old_mask = GLib.log_set_always_fatal(
             GLib.LogLevelFlags.LEVEL_CRITICAL | GLib.LogLevelFlags.LEVEL_ERROR)
         try:
-            # This will make cell.props.text receive a value, otherwise it
-            # will be None.
-            treeview.get_preferred_size()
+            # We must realize the TreeView for cell.props.text to receive a value
+            dialog = Gtk.Dialog()
+            dialog.get_action_area().add(treeview)
+            dialog.show_all()
+            dialog.hide()
         finally:
             GLib.log_set_always_fatal(old_mask)
 



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