From f4d19b68bf21cc11e9e05e06ff9e2778eae50966 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sun, 19 Jul 2009 18:27:46 +0200 Subject: [PATCH] Check for duplicate property IDs as part of the property test --- tests/properties.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/properties.c b/tests/properties.c index 4df58b95..5cbddf9c 100644 --- a/tests/properties.c +++ b/tests/properties.c @@ -58,6 +58,7 @@ properties_object_get_set (GObject* object) GType type = G_PARAM_SPEC_TYPE (pspec); const gchar* property = g_param_spec_get_name (pspec); void* value = NULL; + guint j; /* Skip properties of parent classes */ if (pspec->owner_type != G_OBJECT_TYPE (object)) @@ -67,6 +68,16 @@ properties_object_get_set (GObject* object) if (properties_should_skip (G_OBJECT_TYPE_NAME (object), property)) continue; + /* Verify that the ID is unique */ + if (pspecs[i]->owner_type == G_OBJECT_TYPE (object)) + for (j = 0; j < n_properties; j++) + if (i != j && pspecs[j]->owner_type == G_OBJECT_TYPE (object)) + if (pspec->param_id == pspecs[j]->param_id) + g_error ("Duplicate ID %d of %s and %s", + pspec->param_id, + g_param_spec_get_name (pspec), + g_param_spec_get_name (pspecs[j])); + g_object_get (object, property, &value, NULL); if (type == G_TYPE_PARAM_BOOLEAN) { @@ -111,7 +122,6 @@ properties_object_get_set (GObject* object) { GEnumClass* enum_class = G_ENUM_CLASS ( g_type_class_ref (pspec->value_type)); - gint j; if (pspec_is_writable (pspec)) { -- 2.39.5