libnm: adjust tests now that all direct properties use G_PARAM_EXPLICIT_NOTIFY

This commit is contained in:
Thomas Haller 2023-12-11 18:40:49 +01:00
parent 026c92c30d
commit b1dbe942e8
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
2 changed files with 8 additions and 26 deletions

View file

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

View file

@ -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) {