summaryrefslogtreecommitdiff
path: root/tests/scanner/regress.c
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2017-07-20 10:47:26 +0200
committerRico Tzschichholz <ricotz@ubuntu.com>2017-07-21 07:41:47 +0200
commitd48fb32d8350abbd421658c733b74aaf44cb89ce (patch)
tree64a1f9f1b152881caab3bb1bce2c16eecf55a12a /tests/scanner/regress.c
parent44aa990e80758ed9ad842fadc19857f26a663105 (diff)
downloadgobject-introspection-d48fb32d8350abbd421658c733b74aaf44cb89ce.tar.gz
regress: Test for property and method with conflicting names
This is something that libraries are not supposed to do, but some do anyway (Soup and Clutter are two examples) and language bindings should handle it somehow or other. In GJS we want to make sure that the way it's handled doesn't change inadvertently, because buggy library code should not break existing user code. https://bugzilla.gnome.org/show_bug.cgi?id=785091
Diffstat (limited to 'tests/scanner/regress.c')
-rw-r--r--tests/scanner/regress.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c
index 153b6d49..5a53291e 100644
--- a/tests/scanner/regress.c
+++ b/tests/scanner/regress.c
@@ -2097,7 +2097,8 @@ enum
PROP_TEST_OBJ_FLOAT,
PROP_TEST_OBJ_DOUBLE,
PROP_TEST_OBJ_STRING,
- PROP_TEST_OBJ_GTYPE
+ PROP_TEST_OBJ_GTYPE,
+ PROP_TEST_OBJ_NAME_CONFLICT
};
static void
@@ -2161,6 +2162,10 @@ regress_test_obj_set_property (GObject *object,
self->gtype = g_value_get_gtype (value);
break;
+ case PROP_TEST_OBJ_NAME_CONFLICT:
+ self->name_conflict = g_value_get_int (value);
+ break;
+
default:
/* We don't have any other property... */
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -2218,6 +2223,10 @@ regress_test_obj_get_property (GObject *object,
g_value_set_gtype (value, self->gtype);
break;
+ case PROP_TEST_OBJ_NAME_CONFLICT:
+ g_value_set_int (value, self->name_conflict);
+ break;
+
default:
/* We don't have any other property... */
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -2664,6 +2673,20 @@ regress_test_obj_class_init (RegressTestObjClass *klass)
PROP_TEST_OBJ_GTYPE,
pspec);
+ /**
+ * TestObj:name-conflict:
+ */
+ pspec = g_param_spec_int ("name-conflict",
+ "name-conflict property",
+ "A property name that conflicts with a method",
+ G_MININT,
+ G_MAXINT,
+ 42,
+ G_PARAM_CONSTRUCT | G_PARAM_READWRITE);
+ g_object_class_install_property (gobject_class,
+ PROP_TEST_OBJ_NAME_CONFLICT,
+ pspec);
+
klass->matrix = regress_test_obj_default_matrix;
}
@@ -3095,6 +3118,15 @@ regress_test_obj_not_nullable_element_typed_gpointer_in (RegressTestObj *obj,
}
/**
+ * regress_test_obj_name_conflict:
+ * @obj: A #RegressTestObj
+ */
+void
+regress_test_obj_name_conflict (RegressTestObj *obj)
+{
+}
+
+/**
* regress_test_array_fixed_out_objects:
* @objs: (out) (array fixed-size=2) (transfer full): An array of #RegressTestObj
*/