summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2018-04-21 07:21:23 +0200
committerChristoph Reiter <reiter.christoph@gmail.com>2018-04-21 08:05:14 +0200
commitea358359a34ad96bf395641911aeaf80182d3aad (patch)
tree8007a55c64a251b60f54c3e2bbe1f46e606544db /tests
parentd0bfb29fe5b34c58a190e084614fe489771bf53b (diff)
downloadpygobject-ea358359a34ad96bf395641911aeaf80182d3aad.tar.gz
Make Gtk.Widget.freeze_child_notify a context manager. Fixes #45widget-freeze-child
Diffstat (limited to 'tests')
-rw-r--r--tests/test_overrides_gtk.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/test_overrides_gtk.py b/tests/test_overrides_gtk.py
index 7ffb5068..1e365525 100644
--- a/tests/test_overrides_gtk.py
+++ b/tests/test_overrides_gtk.py
@@ -70,6 +70,32 @@ def realized(widget):
@unittest.skipUnless(Gtk, 'Gtk not available')
+def test_freeze_child_notif():
+
+ events = []
+
+ def on_notify(widget, spec):
+ events.append(spec.name)
+
+ b = Gtk.Box()
+ c = Gtk.Button()
+ c.connect("child-notify", on_notify)
+ c.freeze_child_notify()
+ b.pack_start(c, True, True, 0)
+ b.child_set_property(c, "expand", False)
+ b.child_set_property(c, "expand", True)
+ c.thaw_child_notify()
+ assert events.count("expand") == 1
+ del events[:]
+
+ with c.freeze_child_notify():
+ b.child_set_property(c, "expand", True)
+ b.child_set_property(c, "expand", False)
+
+ assert events.count("expand") == 1
+
+
+@unittest.skipUnless(Gtk, 'Gtk not available')
def test_wrapper_toggle_refs():
class MyButton(Gtk.Button):
def __init__(self, height):