From b1dbe942e8d7b133525b72c111d17a2f76825a5f Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 11 Dec 2023 18:40:49 +0100 Subject: [PATCH] libnm: adjust tests now that all direct properties use G_PARAM_EXPLICIT_NOTIFY --- src/libnm-core-impl/nm-setting.c | 9 +++++---- src/libnm-core-impl/tests/test-setting.c | 25 +++--------------------- 2 files changed, 8 insertions(+), 26 deletions(-) diff --git a/src/libnm-core-impl/nm-setting.c b/src/libnm-core-impl/nm-setting.c index 4999e46baf..fdb2b1299d 100644 --- a/src/libnm-core-impl/nm-setting.c +++ b/src/libnm-core-impl/nm-setting.c @@ -989,10 +989,11 @@ _nm_setting_property_set_property_direct(GObject *object, nm_assert_not_reached(); out_notify: - nm_gobject_notify_together_by_pspec( - object, - NM_FLAGS_HAS(pspec->flags, G_PARAM_EXPLICIT_NOTIFY) ? property_info->param_spec : NULL, - property_info->direct_also_notify); + nm_assert(NM_FLAGS_HAS(pspec->flags, G_PARAM_EXPLICIT_NOTIFY)); + + nm_gobject_notify_together_by_pspec(object, + property_info->param_spec, + property_info->direct_also_notify); return; diff --git a/src/libnm-core-impl/tests/test-setting.c b/src/libnm-core-impl/tests/test-setting.c index 826cf16343..9824306b71 100644 --- a/src/libnm-core-impl/tests/test-setting.c +++ b/src/libnm-core-impl/tests/test-setting.c @@ -4903,33 +4903,14 @@ check_done:; g_array_append_val(property_types_data, prop_idx_val); if (sip->param_spec) { - gboolean expected; - - /* TODO: we should move all "direct" properties to use G_PARAM_EXPLICIT_NOTIFY. - * - * Currently only certain direct properties are as such. This should change. + /* All "direct" properties use G_PARAM_EXPLICIT_NOTIFY. * * Warning: this is potentially dangerous, because implementations MUST remember * to notify the property change in set_property(). Optimally, the property uses * _nm_setting_property_set_property_direct(), which takes care of that. */ - expected = NM_IN_SET(sip->property_type->direct_type, - NM_VALUE_TYPE_BOOL, - NM_VALUE_TYPE_UINT32, - NM_VALUE_TYPE_INT32, - NM_VALUE_TYPE_INT64, - NM_VALUE_TYPE_UINT64, - NM_VALUE_TYPE_STRING, - NM_VALUE_TYPE_BYTES, - NM_VALUE_TYPE_STRV, - NM_VALUE_TYPE_ENUM, - NM_VALUE_TYPE_FLAGS); - - if (NM_FLAGS_HAS(sip->param_spec->flags, G_PARAM_EXPLICIT_NOTIFY)) { - g_assert(expected); - } else { - g_assert(!expected); - } + if (sip->property_type->direct_type != NM_VALUE_TYPE_NONE) + g_assert(NM_FLAGS_HAS(sip->param_spec->flags, G_PARAM_EXPLICIT_NOTIFY)); } if (sip->param_spec) {