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.
This commit is contained in:
Marco Trevisan (Treviño) 2022-07-08 23:45:24 +02:00
parent fb607d3feb
commit ed130c8d3b

View File

@ -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);
}