diff options
author | Simon Feltman <sfeltman@src.gnome.org> | 2014-05-25 22:07:07 -0700 |
---|---|---|
committer | Simon Feltman <sfeltman@src.gnome.org> | 2014-05-25 22:39:58 -0700 |
commit | 45a5fb2b0d6c7f46d355c83c73d829532e5a72ce (patch) | |
tree | 355dc68d2c119003b8c9929475a1e3d40cbb5402 /tests | |
parent | 6f5a9a37bcdec5074332b1066396321d40b15d99 (diff) | |
download | pygobject-45a5fb2b0d6c7f46d355c83c73d829532e5a72ce.tar.gz |
overrides: Make value argument to Widget.style_get_property optional
Override Gtk.Widget.style_get_property to optionally accept the "value"
argument. If "value" is not supplied, the override will locate the child
property value type and create the GValue. Additionally return the resulting
GValue converted to a native Python value.
https://bugzilla.gnome.org/show_bug.cgi?id=685076
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_overrides_gtk.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test_overrides_gtk.py b/tests/test_overrides_gtk.py index 33aeae4c..b7fc5ee5 100644 --- a/tests/test_overrides_gtk.py +++ b/tests/test_overrides_gtk.py @@ -632,6 +632,35 @@ class TestGtk(unittest.TestCase): @unittest.skipUnless(Gtk, 'Gtk not available') +class TestWidget(unittest.TestCase): + def test_style_get_property_gvalue(self): + button = Gtk.Button() + value = GObject.Value(int, -42) + button.style_get_property('focus-padding', value) + # Test only that the style property changed since we can't actuall + # set it. + self.assertNotEqual(value.get_int(), -42) + + def test_style_get_property_return_with_explicit_gvalue(self): + button = Gtk.Button() + value = GObject.Value(int, -42) + result = button.style_get_property('focus-padding', value) + self.assertIsInstance(result, int) + self.assertNotEqual(result, -42) + + def test_style_get_property_return_with_implicit_gvalue(self): + button = Gtk.Button() + result = button.style_get_property('focus-padding') + self.assertIsInstance(result, int) + self.assertNotEqual(result, -42) + + def test_style_get_property_error(self): + button = Gtk.Button() + with self.assertRaises(ValueError): + button.style_get_property('not-a-valid-style-property') + + +@unittest.skipUnless(Gtk, 'Gtk not available') class TestSignals(unittest.TestCase): def test_class_closure_override_with_aliased_type(self): class WindowWithSizeAllocOverride(Gtk.ScrolledWindow): |