]> spindle.queued.net Git - midori/commitdiff
Check for duplicate property IDs as part of the property test
authorChristian Dywan <christian@twotoasts.de>
Sun, 19 Jul 2009 16:27:46 +0000 (18:27 +0200)
committerChristian Dywan <christian@twotoasts.de>
Sun, 19 Jul 2009 16:27:46 +0000 (18:27 +0200)
tests/properties.c

index 4df58b95e43c0ca6ed5300b7fd1955c238357365..5cbddf9c07c3a9c1ace39e1631004f942882b2af 100644 (file)
@@ -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))
             {