[glib: 1/3] gobject/tests/custom-dispatch: Mark the foo property as explicit-notify




commit ed130c8d3bb73bea773448441de2f8c9c8ff75f0
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Fri Jul 8 23:45:24 2022 +0200

    gobject/tests/custom-dispatch: Mark the foo property as explicit-notify
    
    We're calling g_object_notify so let's not make gobject to call it for
    us.
    
    This also allows to test that changing a property again doesn't lead to
    dispatch properties being called.

 gobject/tests/custom-dispatch.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/gobject/tests/custom-dispatch.c b/gobject/tests/custom-dispatch.c
index 3c6c1b8f4c..ae56c0ae5b 100644
--- a/gobject/tests/custom-dispatch.c
+++ b/gobject/tests/custom-dispatch.c
@@ -114,7 +114,9 @@ test_object_class_init (TestObjectClass *klass)
   properties[PROP_FOO] = g_param_spec_int ("foo", "Foo", "Foo",
                                            -1, G_MAXINT,
                                            0,
-                                           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+                                           G_PARAM_READWRITE |
+                                           G_PARAM_STATIC_STRINGS |
+                                           G_PARAM_EXPLICIT_NOTIFY);
 
   gobject_class->set_property = test_object_set_property;
   gobject_class->get_property = test_object_get_property;
@@ -157,6 +159,8 @@ test_custom_dispatch (void)
   g_assert_cmpint (dispatch_properties_called, ==, 0);
   g_object_set (obj, "foo", 11, NULL);
   g_assert_cmpint (dispatch_properties_called, ==, 1);
+  g_object_set (obj, "foo", 11, NULL);
+  g_assert_cmpint (dispatch_properties_called, ==, 1);
 
   g_object_unref (obj);
 }


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