summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/gimarshallingtests.c363
-rw-r--r--tests/gimarshallingtests.h147
-rw-r--r--tests/scanner/Regress-1.0-expected.gir110
-rw-r--r--tests/scanner/annotation.c1
-rw-r--r--tests/scanner/barapp.c1
-rw-r--r--tests/scanner/drawable.c1
-rw-r--r--tests/scanner/gtkfrob.c1
-rw-r--r--tests/scanner/regress.c73
-rw-r--r--tests/scanner/regress.h29
-rw-r--r--tests/scanner/utility.c1
-rw-r--r--tests/warn/unknown-parameter.h12
11 files changed, 728 insertions, 11 deletions
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index 712e5080..7afe543a 100644
--- a/tests/gimarshallingtests.c
+++ b/tests/gimarshallingtests.c
@@ -1,4 +1,4 @@
-/* -*- Mode: C; c-basic-offset: 4 -*-
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
* vim: tabstop=4 shiftwidth=4 expandtab
*/
@@ -995,12 +995,25 @@ gi_marshalling_tests_gtype_return (void)
return G_TYPE_NONE;
}
+GType
+gi_marshalling_tests_gtype_string_return (void)
+{
+ return G_TYPE_STRING;
+}
+
void
gi_marshalling_tests_gtype_in (GType gtype)
{
g_assert(gtype == G_TYPE_NONE);
}
+void
+gi_marshalling_tests_gtype_string_in (GType gtype)
+{
+ g_assert(gtype == G_TYPE_STRING);
+}
+
+
/**
* gi_marshalling_tests_gtype_out:
* @gtype: (out):
@@ -1012,6 +1025,16 @@ gi_marshalling_tests_gtype_out (GType *gtype)
}
/**
+ * gi_marshalling_tests_gtype_string_out:
+ * @gtype: (out):
+ */
+void
+gi_marshalling_tests_gtype_string_out (GType *gtype)
+{
+ *gtype = G_TYPE_STRING;
+}
+
+/**
* gi_marshalling_tests_gtype_inout:
* @gtype: (inout):
*/
@@ -2877,6 +2900,17 @@ gi_marshalling_tests_gvalue_in (GValue *value)
}
/**
+ * gi_marshalling_tests_gvalue_in_with_type:
+ * @value: (transfer none):
+ * @type:
+ */
+void
+gi_marshalling_tests_gvalue_in_with_type (GValue *value, GType type)
+{
+ g_assert(g_type_is_a(G_VALUE_TYPE(value), type));
+}
+
+/**
* gi_marshalling_tests_gvalue_in_enum:
* @value: (transfer none):
*/
@@ -3034,6 +3068,71 @@ gi_marshalling_tests_gclosure_return (void)
return closure;
}
+
+/**
+ * gi_marshalling_tests_callback_return_value_only:
+ * @callback: (scope call):
+ */
+glong
+gi_marshalling_tests_callback_return_value_only (GIMarshallingTestsCallbackReturnValueOnly callback)
+{
+ return callback ();
+}
+
+/**
+ * gi_marshalling_tests_callback_one_out_parameter:
+ * @callback: (scope call):
+ * @a: (out):
+ */
+void
+gi_marshalling_tests_callback_one_out_parameter (GIMarshallingTestsCallbackOneOutParameter callback,
+ gfloat *a)
+{
+ callback (a);
+}
+
+/**
+ * gi_marshalling_tests_callback_multiple_out_parameters:
+ * @callback: (scope call):
+ * @a: (out):
+ * @b: (out):
+ */
+void
+gi_marshalling_tests_callback_multiple_out_parameters (GIMarshallingTestsCallbackMultipleOutParameters callback,
+ gfloat *a,
+ gfloat *b)
+{
+ callback (a, b);
+}
+
+/**
+ * gi_marshalling_tests_callback_return_value_and_one_out_parameter:
+ * @callback: (scope call):
+ * @a: (out):
+ */
+glong
+gi_marshalling_tests_callback_return_value_and_one_out_parameter (GIMarshallingTestsCallbackReturnValueAndOneOutParameter callback,
+ glong *a)
+{
+ return callback (a);
+}
+
+/**
+ * gi_marshalling_tests_callback_return_value_and_multiple_out_parameters:
+ * @callback: (scope call):
+ * @a: (out):
+ * @b: (out):
+ */
+glong
+gi_marshalling_tests_callback_return_value_and_multiple_out_parameters (GIMarshallingTestsCallbackReturnValueAndMultipleOutParameters callback,
+ glong *a,
+ glong *b)
+{
+ return callback (a, b);
+}
+
+
+
/**
* gi_marshalling_tests_pointer_in_return:
*
@@ -3787,6 +3886,87 @@ gi_marshalling_tests_object_int8_out (GIMarshallingTestsObject *object, gint8 *o
gi_marshalling_tests_object_method_int8_out (object, out);
}
+/**
+ * gi_marshalling_tests_object_vfunc_return_value_only:
+ */
+glong
+gi_marshalling_tests_object_vfunc_return_value_only (GIMarshallingTestsObject *self)
+{
+ /* make sure that local variables don't get smashed */
+ glong return_value;
+ gulong local = 0x12345678;
+ return_value = GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_return_value_only (self);
+ g_assert_cmpint(local, ==, 0x12345678);
+ return return_value;
+}
+
+/**
+ * gi_marshalling_tests_object_vfunc_one_out_parameter:
+ * @a: (out):
+ */
+void
+gi_marshalling_tests_object_vfunc_one_out_parameter (GIMarshallingTestsObject *self, gfloat *a)
+{
+ /* make sure that local variables don't get smashed */
+ gulong local = 0x12345678;
+ GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_one_out_parameter (self, a);
+ g_assert_cmpint(local, ==, 0x12345678);
+}
+
+/**
+ * gi_marshalling_tests_object_vfunc_multiple_out_parameters:
+ * @a: (out):
+ * @b: (out):
+ */
+void
+gi_marshalling_tests_object_vfunc_multiple_out_parameters (GIMarshallingTestsObject *self, gfloat *a, gfloat *b)
+{
+ /* make sure that local variables don't get smashed */
+ gulong local = 0x12345678;
+ GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_multiple_out_parameters (self, a, b);
+ g_assert_cmpint(local, ==, 0x12345678);
+}
+
+/**
+ * gi_marshalling_tests_object_vfunc_return_value_and_one_out_parameter:
+ * @a: (out):
+ */
+glong
+gi_marshalling_tests_object_vfunc_return_value_and_one_out_parameter (GIMarshallingTestsObject *self, glong *a)
+{
+ /* make sure that local variables don't get smashed */
+ gulong return_value;
+ gulong local = 0x12345678;
+ return_value = GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_return_value_and_one_out_parameter (self, a);
+ g_assert_cmpint(local, ==, 0x12345678);
+ return return_value;
+}
+
+/**
+ * gi_marshalling_tests_object_vfunc_return_value_and_multiple_out_parameters:
+ * @a: (out):
+ * @b: (out):
+ */
+glong
+gi_marshalling_tests_object_vfunc_return_value_and_multiple_out_parameters (GIMarshallingTestsObject *self, glong *a, glong *b)
+{
+ gulong return_value;
+ gulong local = 0x12345678;
+ return_value = GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_return_value_and_multiple_out_parameters (self, a, b);
+ g_assert_cmpint(local, ==, 0x12345678);
+ return return_value;
+}
+
+gboolean
+gi_marshalling_tests_object_vfunc_meth_with_error (GIMarshallingTestsObject *self,
+ gint x,
+ GError **error)
+{
+ gulong local = 0x12345678;
+ gboolean ret = GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_meth_with_err (self, x, error);
+ g_assert_cmpint(local, ==, 0x12345678);
+ return ret;
+}
G_DEFINE_TYPE (GIMarshallingTestsSubObject, gi_marshalling_tests_sub_object, GI_MARSHALLING_TESTS_TYPE_OBJECT);
@@ -4020,7 +4200,7 @@ gi_marshalling_tests_gerror_out_transfer_none(GError **err, const gchar **debug)
* Returns: (transfer full): a GError
*/
GError *
-gi_marshalling_tests_gerror_return()
+gi_marshalling_tests_gerror_return(void)
{
GQuark quark = g_quark_from_static_string(GI_MARSHALLING_TESTS_CONSTANT_GERROR_DOMAIN);
@@ -4122,7 +4302,6 @@ gi_marshalling_tests_overrides_object_method (GIMarshallingTestsOverridesObject
return 42;
}
-
/**
* gi_marshalling_tests_overrides_object_returnv:
*
@@ -4145,3 +4324,181 @@ gi_marshalling_tests_filename_list_return (void)
return NULL;
}
+
+enum {
+ DUMMY_PROPERTY,
+ SOME_BOOLEAN_PROPERTY,
+ SOME_CHAR_PROPERTY,
+ SOME_UCHAR_PROPERTY,
+ SOME_INT_PROPERTY,
+ SOME_UINT_PROPERTY,
+ SOME_LONG_PROPERTY,
+ SOME_ULONG_PROPERTY,
+ SOME_INT64_PROPERTY,
+ SOME_UINT64_PROPERTY,
+ SOME_FLOAT_PROPERTY,
+ SOME_DOUBLE_PROPERTY
+};
+
+G_DEFINE_TYPE (GIMarshallingTestsPropertiesObject, gi_marshalling_tests_properties_object, G_TYPE_OBJECT);
+
+static void
+gi_marshalling_tests_properties_object_init (GIMarshallingTestsPropertiesObject * self)
+{
+}
+
+static void
+gi_marshalling_tests_properties_object_finalize (GObject* obj)
+{
+ G_OBJECT_CLASS (gi_marshalling_tests_properties_object_parent_class)->finalize (obj);
+}
+
+static void
+gi_marshalling_tests_properties_object_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec)
+{
+ GIMarshallingTestsPropertiesObject * self;
+ self = GI_MARSHALLING_TESTS_PROPERTIES_OBJECT (object);
+ switch (property_id) {
+ case SOME_BOOLEAN_PROPERTY:
+ g_value_set_boolean (value, self->some_boolean);
+ break;
+ case SOME_CHAR_PROPERTY:
+ g_value_set_schar (value, self->some_char);
+ break;
+ case SOME_UCHAR_PROPERTY:
+ g_value_set_uchar (value, self->some_uchar);
+ break;
+ case SOME_INT_PROPERTY:
+ g_value_set_int (value, self->some_int);
+ break;
+ case SOME_UINT_PROPERTY:
+ g_value_set_uint (value, self->some_uint);
+ break;
+ case SOME_LONG_PROPERTY:
+ g_value_set_long (value, self->some_long);
+ break;
+ case SOME_ULONG_PROPERTY:
+ g_value_set_ulong (value, self->some_ulong);
+ break;
+ case SOME_INT64_PROPERTY:
+ g_value_set_int64 (value, self->some_int64);
+ break;
+ case SOME_UINT64_PROPERTY:
+ g_value_set_uint64 (value, self->some_uint64);
+ break;
+ case SOME_FLOAT_PROPERTY:
+ g_value_set_float (value, self->some_float);
+ break;
+ case SOME_DOUBLE_PROPERTY:
+ g_value_set_double (value, self->some_double);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gi_marshalling_tests_properties_object_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec)
+{
+ GIMarshallingTestsPropertiesObject * self;
+ self = GI_MARSHALLING_TESTS_PROPERTIES_OBJECT (object);
+ switch (property_id) {
+ case SOME_BOOLEAN_PROPERTY:
+ self->some_boolean = g_value_get_boolean (value);
+ break;
+ case SOME_CHAR_PROPERTY:
+ self->some_char = g_value_get_schar (value);
+ break;
+ case SOME_UCHAR_PROPERTY:
+ self->some_uchar = g_value_get_uchar (value);
+ break;
+ case SOME_INT_PROPERTY:
+ self->some_int = g_value_get_int (value);
+ break;
+ case SOME_UINT_PROPERTY:
+ self->some_uint = g_value_get_uint (value);
+ break;
+ case SOME_LONG_PROPERTY:
+ self->some_long = g_value_get_long (value);
+ break;
+ case SOME_ULONG_PROPERTY:
+ self->some_ulong = g_value_get_ulong (value);
+ break;
+ case SOME_INT64_PROPERTY:
+ self->some_int64 = g_value_get_int64 (value);
+ break;
+ case SOME_UINT64_PROPERTY:
+ self->some_uint64 = g_value_get_uint64 (value);
+ break;
+ case SOME_FLOAT_PROPERTY:
+ self->some_float = g_value_get_float (value);
+ break;
+ case SOME_DOUBLE_PROPERTY:
+ self->some_double = g_value_get_double (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gi_marshalling_tests_properties_object_class_init (GIMarshallingTestsPropertiesObjectClass * klass)
+{
+ GObjectClass* object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = gi_marshalling_tests_properties_object_finalize;
+ object_class->get_property = gi_marshalling_tests_properties_object_get_property;
+ object_class->set_property = gi_marshalling_tests_properties_object_set_property;
+
+ g_object_class_install_property (object_class, SOME_BOOLEAN_PROPERTY,
+ g_param_spec_boolean ("some-boolean", "some-boolean", "some-boolean", FALSE,
+ G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (object_class, SOME_CHAR_PROPERTY,
+ g_param_spec_char ("some-char", "some-char", "some-char", G_MININT8, G_MAXINT8, 0,
+ G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (object_class, SOME_UCHAR_PROPERTY,
+ g_param_spec_uchar ("some-uchar", "some-uchar", "some-uchar", 0, G_MAXUINT8, 0,
+ G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (object_class, SOME_INT_PROPERTY,
+ g_param_spec_int ("some-int", "some-int", "some-int", G_MININT, G_MAXINT, 0,
+ G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (object_class, SOME_UINT_PROPERTY,
+ g_param_spec_uint ("some-uint", "some-uint", "some-uint", 0, G_MAXUINT, 0,
+ G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (object_class, SOME_LONG_PROPERTY,
+ g_param_spec_long ("some-long", "some-long", "some-long", G_MINLONG, G_MAXLONG, 0,
+ G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (object_class, SOME_ULONG_PROPERTY,
+ g_param_spec_ulong ("some-ulong", "some-ulong", "some-ulong", 0, G_MAXULONG, 0,
+ G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (object_class, SOME_INT64_PROPERTY,
+ g_param_spec_int64 ("some-int64", "some-int64", "some-int64", G_MININT64, G_MAXINT64, 0,
+ G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (object_class, SOME_UINT64_PROPERTY,
+ g_param_spec_uint64 ("some-uint64", "some-uint64", "some-uint64", 0, G_MAXUINT64, 0,
+ G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (object_class, SOME_FLOAT_PROPERTY,
+ g_param_spec_float ("some-float", "some-float", "some-float", -1 * G_MAXFLOAT, G_MAXFLOAT, 0,
+ G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (object_class, SOME_DOUBLE_PROPERTY,
+ g_param_spec_double ("some-double", "some-double", "some-double", -1 * G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
+}
+
+GIMarshallingTestsPropertiesObject*
+gi_marshalling_tests_properties_object_new (void)
+{
+ return g_object_new (GI_MARSHALLING_TESTS_TYPE_PROPERTIES_OBJECT, NULL);
+}
diff --git a/tests/gimarshallingtests.h b/tests/gimarshallingtests.h
index e80a0e5e..0c889209 100644
--- a/tests/gimarshallingtests.h
+++ b/tests/gimarshallingtests.h
@@ -1,4 +1,4 @@
-/* -*- Mode: C; c-basic-offset: 4 -*-
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
* vim: tabstop=4 shiftwidth=4 expandtab
*/
@@ -236,10 +236,16 @@ void gi_marshalling_tests_time_t_inout (time_t *time_t_);
GType gi_marshalling_tests_gtype_return (void);
+GType gi_marshalling_tests_gtype_string_return (void);
+
void gi_marshalling_tests_gtype_in (GType gtype);
+void gi_marshalling_tests_gtype_string_in (GType gtype);
+
void gi_marshalling_tests_gtype_out (GType *gtype);
+void gi_marshalling_tests_gtype_string_out (GType *gtype);
+
void gi_marshalling_tests_gtype_inout (GType *gtype);
@@ -520,6 +526,7 @@ void gi_marshalling_tests_ghashtable_utf8_full_inout (GHashTable **hash_table);
GValue *gi_marshalling_tests_gvalue_return (void);
void gi_marshalling_tests_gvalue_in (GValue *value);
+void gi_marshalling_tests_gvalue_in_with_type (GValue *value, GType type);
void gi_marshalling_tests_gvalue_in_enum (GValue *value);
@@ -541,6 +548,55 @@ GValue *gi_marshalling_tests_gvalue_flat_array_round_trip (const GValue one,
void gi_marshalling_tests_gclosure_in (GClosure *closure);
GClosure *gi_marshalling_tests_gclosure_return (void);
+/* Callback return values */
+
+/**
+ * GIMarshallingTestsCallbackReturnValueOnly:
+ */
+typedef glong (* GIMarshallingTestsCallbackReturnValueOnly) ();
+
+glong gi_marshalling_tests_callback_return_value_only (GIMarshallingTestsCallbackReturnValueOnly callback);
+
+/**
+ * GIMarshallingTestsCallbackOneOutParameter:
+ * @a: (out):
+ */
+typedef void (* GIMarshallingTestsCallbackOneOutParameter) (gfloat *a);
+
+void gi_marshalling_tests_callback_one_out_parameter (GIMarshallingTestsCallbackOneOutParameter callback,
+ gfloat *a);
+
+/**
+ * GIMarshallingTestsCallbackMultipleOutParameters:
+ * @a: (out):
+ * @b: (out):
+ */
+typedef void (* GIMarshallingTestsCallbackMultipleOutParameters) (gfloat *a, gfloat *b);
+
+void gi_marshalling_tests_callback_multiple_out_parameters (GIMarshallingTestsCallbackMultipleOutParameters callback,
+ gfloat *a,
+ gfloat *b);
+
+/**
+ * GIMarshallingTestsCallbackReturnValueAndOneOutParameter:
+ * @a: (out):
+ */
+typedef glong (* GIMarshallingTestsCallbackReturnValueAndOneOutParameter) (glong *a);
+
+glong gi_marshalling_tests_callback_return_value_and_one_out_parameter (GIMarshallingTestsCallbackReturnValueAndOneOutParameter callback,
+ glong *a);
+
+/**
+ * GIMarshallingTestsCallbackReturnValueAndMultipleOutParameters:
+ * @a: (out):
+ * @b: (out):
+ */
+typedef glong (* GIMarshallingTestsCallbackReturnValueAndMultipleOutParameters) (glong *a, glong *b);
+
+glong gi_marshalling_tests_callback_return_value_and_multiple_out_parameters (GIMarshallingTestsCallbackReturnValueAndMultipleOutParameters callback,
+ glong *a,
+ glong *b);
+
/* Pointer */
gpointer gi_marshalling_tests_pointer_in_return (gpointer pointer);
@@ -611,7 +667,7 @@ void gi_marshalling_tests_union_inout (GIMarshallingTestsUnion **union_);
void gi_marshalling_tests_union_method (GIMarshallingTestsUnion *union_);
-/* Object */
+ /* Object */
#define GI_MARSHALLING_TESTS_TYPE_OBJECT (gi_marshalling_tests_object_get_type ())
#define GI_MARSHALLING_TESTS_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GI_MARSHALLING_TESTS_TYPE_OBJECT, GIMarshallingTestsObject))
@@ -650,6 +706,44 @@ struct _GIMarshallingTestsObjectClass
* @in: (in):
*/
void (* method_deep_hierarchy) (GIMarshallingTestsObject *self, gint8 in);
+
+ /**
+ * GIMarshallingTestsObjectClass::vfunc_return_value_only:
+ */
+ glong (* vfunc_return_value_only) (GIMarshallingTestsObject *self);
+
+ /**
+ * GIMarshallingTestsObjectClass::vfunc_one_out_parameter:
+ * @a: (out):
+ */
+ void (* vfunc_one_out_parameter) (GIMarshallingTestsObject *self, gfloat *a);
+
+ /**
+ * GIMarshallingTestsObjectClass::vfunc_multiple_out_parameters:
+ * @a: (out):
+ * @b: (out):
+ */
+ void (* vfunc_multiple_out_parameters) (GIMarshallingTestsObject *self, gfloat *a, gfloat *b);
+
+ /**
+ * GIMarshallingTestsObjectClass::vfunc_return_value_and_one_out_parameter:
+ * @a: (out):
+ */
+ glong (* vfunc_return_value_and_one_out_parameter) (GIMarshallingTestsObject *self, glong *a);
+
+ /**
+ * GIMarshallingTestsObjectClass::vfunc_return_value_and_multiple_out_parameters:
+ * @a: (out):
+ * @b: (out):
+ */
+ glong (* vfunc_return_value_and_multiple_out_parameters) (GIMarshallingTestsObject *self, glong *a, glong *b);
+
+ /**
+ * GIMarshallingTestsObjectClass::vfunc_meth_with_err:
+ * @x:
+ * @error: A #GError
+ */
+ gboolean (*vfunc_meth_with_err) (GIMarshallingTestsObject *object, gint x, GError **error);
};
struct _GIMarshallingTestsObject
@@ -674,6 +768,12 @@ void gi_marshalling_tests_object_method_int8_in (GIMarshallingTestsObject *objec
void gi_marshalling_tests_object_method_int8_out (GIMarshallingTestsObject *object, gint8 *out);
void gi_marshalling_tests_object_method_with_default_implementation (GIMarshallingTestsObject *object, gint8 in);
+glong gi_marshalling_tests_object_vfunc_return_value_only (GIMarshallingTestsObject *self);
+void gi_marshalling_tests_object_vfunc_one_out_parameter (GIMarshallingTestsObject *self, gfloat *a);
+void gi_marshalling_tests_object_vfunc_multiple_out_parameters (GIMarshallingTestsObject *self, gfloat *a, gfloat *b);
+glong gi_marshalling_tests_object_vfunc_return_value_and_one_out_parameter (GIMarshallingTestsObject *self, glong *a);
+glong gi_marshalling_tests_object_vfunc_return_value_and_multiple_out_parameters (GIMarshallingTestsObject *self, glong *a, glong *b);
+gboolean gi_marshalling_tests_object_vfunc_meth_with_error (GIMarshallingTestsObject *object, gint x, GError **error);
GIMarshallingTestsObject *gi_marshalling_tests_object_none_return (void);
GIMarshallingTestsObject *gi_marshalling_tests_object_full_return (void);
@@ -807,7 +907,7 @@ void gi_marshalling_tests_gerror(GError **error);
void gi_marshalling_tests_gerror_array_in(gint *in_ints, GError **error);
void gi_marshalling_tests_gerror_out(GError **error, gchar **debug);
void gi_marshalling_tests_gerror_out_transfer_none(GError **err, const gchar **debug);
-GError *gi_marshalling_tests_gerror_return();
+GError *gi_marshalling_tests_gerror_return(void);
/* Overrides */
@@ -839,12 +939,12 @@ typedef struct _GIMarshallingTestsOverridesObject GIMarshallingTestsOverridesObj
struct _GIMarshallingTestsOverridesObjectClass
{
- GObjectClass parent_class;
+ GObjectClass parent_class;
};
struct _GIMarshallingTestsOverridesObject
{
- GObject parent_instance;
+ GObject parent_instance;
glong long_;
};
@@ -855,7 +955,42 @@ GIMarshallingTestsOverridesObject *gi_marshalling_tests_overrides_object_new (vo
glong gi_marshalling_tests_overrides_object_method (GIMarshallingTestsOverridesObject *object);
-
GIMarshallingTestsOverridesObject *gi_marshalling_tests_overrides_object_returnv (void);
+/* Properties Object */
+
+#define GI_MARSHALLING_TESTS_TYPE_PROPERTIES_OBJECT (gi_marshalling_tests_properties_object_get_type ())
+#define GI_MARSHALLING_TESTS_PROPERTIES_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GI_MARSHALLING_TESTS_TYPE_PROPERTIES_OBJECT, GIMarshallingTestsPropertiesObject))
+#define GI_MARSHALLING_TESTS_PROPERTIES_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GI_MARSHALLING_TESTS_TYPE_PROPERTIES_OBJECT, GIMarshallingTestsPropertiesObjectClass))
+#define GI_MARSHALLING_TESTS_IS_PROPERTIES_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GI_MARSHALLING_TESTS_TYPE_PROPERTIES_OBJECT))
+#define GI_MARSHALLING_TESTS_IS_PROPERTIES_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GI_MARSHALLING_TESTS_TYPE_PROPERTIES_OBJECT))
+#define GI_MARSHALLING_TESTS_PROPERTIES_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GI_MARSHALLING_TESTS_TYPE_PROPERTIES_OBJECT, GIMarshallingTestsPropertiesObjectClass))
+
+typedef struct _GIMarshallingTestsPropertiesObject GIMarshallingTestsPropertiesObject;
+typedef struct _GIMarshallingTestsPropertiesObjectClass GIMarshallingTestsPropertiesObjectClass;
+
+struct _GIMarshallingTestsPropertiesObject {
+ GObject parent_instance;
+
+ gboolean some_boolean;
+ gchar some_char;
+ guchar some_uchar;
+ gint some_int;
+ guint some_uint;
+ glong some_long;
+ gulong some_ulong;
+ gint64 some_int64;
+ guint64 some_uint64;
+ gfloat some_float;
+ gdouble some_double;
+};
+
+struct _GIMarshallingTestsPropertiesObjectClass {
+ GObjectClass parent_class;
+};
+
+GType gi_marshalling_tests_properties_object_get_type (void) G_GNUC_CONST;
+
+GIMarshallingTestsPropertiesObject *gi_marshalling_tests_properties_object_new (void);
+
#endif /* _GI_MARSHALLING_TESTS_H_ */
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index ebdacf56..ae047256 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -141,6 +141,36 @@ use it should be.</doc>
</parameters>
</method>
</record>
+ <record name="TestBoxedB"
+ c:type="RegressTestBoxedB"
+ glib:type-name="RegressTestBoxedB"
+ glib:get-type="regress_test_boxed_b_get_type"
+ c:symbol-prefix="test_boxed_b">
+ <field name="some_int8" writable="1">
+ <type name="gint8" c:type="gint8"/>
+ </field>
+ <field name="some_long" writable="1">
+ <type name="glong" c:type="glong"/>
+ </field>
+ <constructor name="new" c:identifier="regress_test_boxed_b_new">
+ <return-value transfer-ownership="full">
+ <type name="TestBoxedB" c:type="RegressTestBoxedB*"/>
+ </return-value>
+ <parameters>
+ <parameter name="some_int8" transfer-ownership="none">
+ <type name="gint8" c:type="gint8"/>
+ </parameter>
+ <parameter name="some_long" transfer-ownership="none">
+ <type name="glong" c:type="glong"/>
+ </parameter>
+ </parameters>
+ </constructor>
+ <method name="copy" c:identifier="regress_test_boxed_b_copy">
+ <return-value transfer-ownership="full">
+ <type name="TestBoxedB" c:type="RegressTestBoxedB*"/>
+ </return-value>
+ </method>
+ </record>
<record name="TestBoxedPrivate"
c:type="RegressTestBoxedPrivate"
disguised="1">
@@ -150,6 +180,29 @@ use it should be.</doc>
<type name="gint" c:type="int"/>
</return-value>
</callback>
+ <callback name="TestCallbackArray" c:type="RegressTestCallbackArray">
+ <return-value transfer-ownership="none">
+ <type name="gint" c:type="int"/>
+ </return-value>
+ <parameters>
+ <parameter name="one" transfer-ownership="none">
+ <array length="1" zero-terminated="0" c:type="int*">
+ <type name="gint" c:type="int"/>
+ </array>
+ </parameter>
+ <parameter name="one_length" transfer-ownership="none">
+ <type name="gsize" c:type="gsize"/>
+ </parameter>
+ <parameter name="two" transfer-ownership="none">
+ <array length="3" zero-terminated="0" c:type="char**">
+ <type name="utf8"/>
+ </array>
+ </parameter>
+ <parameter name="two_length" transfer-ownership="none">
+ <type name="gint" c:type="int"/>
+ </parameter>
+ </parameters>
+ </callback>
<callback name="TestCallbackFull" c:type="RegressTestCallbackFull">
<return-value transfer-ownership="none">
<type name="gint" c:type="int"/>
@@ -529,6 +582,17 @@ use it should be.</doc>
</parameter>
</parameters>
</function>
+ <virtual-method name="allow_none_vfunc">
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="two" transfer-ownership="none" allow-none="1">
+ <doc xml:whitespace="preserve">Another object</doc>
+ <type name="TestObj" c:type="RegressTestObj*"/>
+ </parameter>
+ </parameters>
+ </virtual-method>
<virtual-method name="matrix" invoker="do_matrix">
<doc xml:whitespace="preserve">This method is virtual. Notably its name differs from the virtual
slot name, which makes it useful for testing bindings handle this
@@ -1072,6 +1136,22 @@ Use with regress_test_obj_emit_sig_with_obj</doc>
</parameters>
</callback>
</field>
+ <field name="allow_none_vfunc">
+ <callback name="allow_none_vfunc">
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="obj" transfer-ownership="none">
+ <type name="TestObj" c:type="RegressTestObj*"/>
+ </parameter>
+ <parameter name="two" transfer-ownership="none" allow-none="1">
+ <doc xml:whitespace="preserve">Another object</doc>
+ <type name="TestObj" c:type="RegressTestObj*"/>
+ </parameter>
+ </parameters>
+ </callback>
+ </field>
<field name="test_signal">
<type name="guint" c:type="guint"/>
</field>
@@ -1500,6 +1580,17 @@ Use with regress_test_obj_emit_sig_with_obj</doc>
</parameter>
</parameters>
</function>
+ <function name="test_array_callback"
+ c:identifier="regress_test_array_callback">
+ <return-value transfer-ownership="none">
+ <type name="gint" c:type="int"/>
+ </return-value>
+ <parameters>
+ <parameter name="callback" transfer-ownership="none" scope="call">
+ <type name="TestCallbackArray" c:type="RegressTestCallbackArray"/>
+ </parameter>
+ </parameters>
+ </function>
<function name="test_array_fixed_out_objects"
c:identifier="regress_test_array_fixed_out_objects">
<return-value transfer-ownership="none">
@@ -2073,6 +2164,14 @@ call and can be released on return.</doc>
</array>
</return-value>
</function>
+ <function name="test_garray_full_return"
+ c:identifier="regress_test_garray_full_return">
+ <return-value transfer-ownership="full">
+ <array name="GLib.PtrArray" c:type="GPtrArray*">
+ <type name="utf8"/>
+ </array>
+ </return-value>
+ </function>
<function name="test_gerror_callback"
c:identifier="regress_test_gerror_callback">
<return-value transfer-ownership="none">
@@ -2630,6 +2729,17 @@ What we're testing here is that the scanner ignores the @a nested inside XML.</d
</parameter>
</parameters>
</function>
+ <function name="test_null_gerror_callback"
+ c:identifier="regress_test_null_gerror_callback">
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="callback" transfer-ownership="none" scope="call">
+ <type name="TestCallbackGError" c:type="RegressTestCallbackGError"/>
+ </parameter>
+ </parameters>
+ </function>
<function name="test_owned_gerror_callback"
c:identifier="regress_test_owned_gerror_callback">
<return-value transfer-ownership="none">
diff --git a/tests/scanner/annotation.c b/tests/scanner/annotation.c
index f28befac..a4e4efc4 100644
--- a/tests/scanner/annotation.c
+++ b/tests/scanner/annotation.c
@@ -1,3 +1,4 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
#include "annotation.h"
char backslash_parsing_tester = '\\';
diff --git a/tests/scanner/barapp.c b/tests/scanner/barapp.c
index b7ac119d..db4be8db 100644
--- a/tests/scanner/barapp.c
+++ b/tests/scanner/barapp.c
@@ -1,3 +1,4 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
#include "barapp.h"
#include <girepository.h>
diff --git a/tests/scanner/drawable.c b/tests/scanner/drawable.c
index 0345b034..6ab8ecf7 100644
--- a/tests/scanner/drawable.c
+++ b/tests/scanner/drawable.c
@@ -1,3 +1,4 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
#include "drawable.h"
G_DEFINE_ABSTRACT_TYPE (TestInheritDrawable, test_inherit_drawable, G_TYPE_OBJECT);
diff --git a/tests/scanner/gtkfrob.c b/tests/scanner/gtkfrob.c
index 286e4483..d1c2312c 100644
--- a/tests/scanner/gtkfrob.c
+++ b/tests/scanner/gtkfrob.c
@@ -1,3 +1,4 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
#include "gtkfrob.h"
void
diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c
index 0f00ec8d..7e838d34 100644
--- a/tests/scanner/regress.c
+++ b/tests/scanner/regress.c
@@ -1,3 +1,4 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
#include <string.h>
#include <stdlib.h>
#include <glib-object.h>
@@ -1326,7 +1327,23 @@ regress_test_garray_container_return (void)
{
GPtrArray *array;
- array = g_ptr_array_new_with_free_func (g_object_unref);
+ array = g_ptr_array_new_with_free_func (g_free);
+ g_ptr_array_add (array, g_strdup ("regress"));
+
+ return array;
+}
+
+/**
+ * regress_test_garray_full_return:
+ *
+ * Returns: (transfer full) (type GLib.PtrArray) (element-type utf8):
+ */
+GPtrArray *
+regress_test_garray_full_return (void)
+{
+ GPtrArray *array;
+
+ array = g_ptr_array_new ();
g_ptr_array_add (array, g_strdup ("regress"));
return array;
@@ -1656,6 +1673,35 @@ regress_test_boxed_get_type (void)
return our_type;
}
+RegressTestBoxedB *
+regress_test_boxed_b_new (gint8 some_int8, glong some_long)
+{
+ RegressTestBoxedB *boxed;
+
+ boxed = g_slice_new (RegressTestBoxedB);
+ boxed->some_int8 = some_int8;
+ boxed->some_long = some_long;
+
+ return boxed;
+}
+
+RegressTestBoxedB *
+regress_test_boxed_b_copy (RegressTestBoxedB *boxed)
+{
+ return regress_test_boxed_b_new (boxed->some_int8, boxed->some_long);
+}
+
+static void
+regress_test_boxed_b_free (RegressTestBoxedB *boxed)
+{
+ g_slice_free (RegressTestBoxedB, boxed);
+}
+
+G_DEFINE_BOXED_TYPE(RegressTestBoxedB,
+ regress_test_boxed_b,
+ regress_test_boxed_b_copy,
+ regress_test_boxed_b_free);
+
G_DEFINE_TYPE(RegressTestObj, regress_test_obj, G_TYPE_OBJECT);
enum
@@ -2842,7 +2888,22 @@ regress_test_multi_callback (RegressTestCallback callback)
return sum;
}
+/**
+ * regress_test_array_callback:
+ * @callback: (scope call):
+ *
+ **/
+int regress_test_array_callback (RegressTestCallbackArray callback)
+{
+ static const char *strings[] = { "one", "two", "three" };
+ static int ints[] = { -1, 0, 1, 2 };
+ int sum = 0;
+
+ sum += callback(ints, 4, strings, 3);
+ sum += callback(ints, 4, strings, 3);
+ return sum;
+}
/**
* regress_test_simple_callback:
@@ -3054,6 +3115,16 @@ regress_test_gerror_callback (RegressTestCallbackGError callback)
}
/**
+ * regress_test_null_gerror_callback:
+ * @callback: (scope call):
+ **/
+void
+regress_test_null_gerror_callback (RegressTestCallbackGError callback)
+{
+ callback (NULL);
+}
+
+/**
* regress_test_owned_gerror_callback:
* @callback: (scope call):
**/
diff --git a/tests/scanner/regress.h b/tests/scanner/regress.h
index 8fe44e2b..65a158a1 100644
--- a/tests/scanner/regress.h
+++ b/tests/scanner/regress.h
@@ -113,6 +113,7 @@ GHashTable *regress_test_ghash_nested_everything_return2 (void);
/* GPtrArray */
GPtrArray *regress_test_garray_container_return (void);
+GPtrArray *regress_test_garray_full_return (void);
/* error? */
@@ -313,6 +314,18 @@ RegressTestBoxed *regress_test_boxed_copy (RegressTestBoxed *boxed);
gboolean regress_test_boxed_equals (RegressTestBoxed *boxed,
RegressTestBoxed *other);
+typedef struct _RegressTestBoxedB RegressTestBoxedB;
+
+struct _RegressTestBoxedB
+{
+ gint8 some_int8;
+ glong some_long;
+};
+
+GType regress_test_boxed_b_get_type (void);
+RegressTestBoxedB *regress_test_boxed_b_new (gint8 some_int8, glong some_long);
+RegressTestBoxedB *regress_test_boxed_b_copy (RegressTestBoxedB *boxed);
+
/* gobject */
#define REGRESS_TEST_TYPE_OBJ (regress_test_obj_get_type ())
#define REGRESS_TEST_OBJECT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), REGRESS_TEST_TYPE_OBJ, RegressTestObj))
@@ -346,6 +359,12 @@ struct _RegressTestObjClass
int (*matrix) (RegressTestObj *obj, const char *somestr);
+ /**
+ * RegressTestObjClass::allow_none_vfunc
+ * @two: (allow-none): Another object
+ */
+ void (*allow_none_vfunc) (RegressTestObj *obj, RegressTestObj *two);
+
guint test_signal;
guint test_signal_with_static_scope_arg;
@@ -538,10 +557,19 @@ typedef void (*RegressTestCallbackOwnedGError) (GError *error);
* @path: (type filename): Path to file
*/
typedef int (*RegressTestCallbackFull) (int foo, double bar, char *path);
+/**
+ * RegressTestCallbackArray:
+ * @one: (array length=one_length):
+ * @one_length:
+ * @two: (array length=two_length) (element-type utf8):
+ * @two_length:
+ */
+typedef int (*RegressTestCallbackArray) (int *one, gsize one_length, const char** two, int two_length);
void regress_test_simple_callback (RegressTestSimpleCallback callback);
int regress_test_callback (RegressTestCallback callback);
int regress_test_multi_callback (RegressTestCallback callback);
+int regress_test_array_callback (RegressTestCallbackArray callback);
int regress_test_callback_user_data (RegressTestCallbackUserData callback,
gpointer user_data);
int regress_test_callback_destroy_notify (RegressTestCallbackUserData callback,
@@ -561,6 +589,7 @@ RegressTestObj *regress_test_obj_new_callback (RegressTestCallbackUserData callb
GDestroyNotify notify);
void regress_test_hash_table_callback (GHashTable *data, RegressTestCallbackHashtable callback);
void regress_test_gerror_callback (RegressTestCallbackGError callback);
+void regress_test_null_gerror_callback (RegressTestCallbackGError callback);
void regress_test_owned_gerror_callback (RegressTestCallbackOwnedGError callback);
typedef struct _RegressTestInterface RegressTestInterface;
diff --git a/tests/scanner/utility.c b/tests/scanner/utility.c
index aad0d08a..fb1cf5a0 100644
--- a/tests/scanner/utility.c
+++ b/tests/scanner/utility.c
@@ -1,3 +1,4 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
#include "utility.h"
G_DEFINE_TYPE (UtilityObject, utility_object, G_TYPE_OBJECT);
diff --git a/tests/warn/unknown-parameter.h b/tests/warn/unknown-parameter.h
index 8d68dbbc..3d339b32 100644
--- a/tests/warn/unknown-parameter.h
+++ b/tests/warn/unknown-parameter.h
@@ -19,13 +19,23 @@ void test_param_mismatch2(int a, int *out2);
// EXPECT:14: Warning: Test: test_param_mismatch2: unknown parameter 'wrong_name2' in documentation comment, should be one of 'a', 'out2'
/**
+ * test_param_mismatch3:
+ * @a: an integer
+ * @wrong_name3: (out):
+ *
+ */
+void test_param_mismatch3(int a, int *out3);
+
+// EXPECT:24: Warning: Test: test_param_mismatch3: unknown parameter 'wrong_name3' in documentation comment, should be 'out3'
+
+/**
* test_param_missing:
* @missing: (out):
*
*/
void test_param_missing(void);
-// EXPECT:23: Warning: Test: test_param_missing: unknown parameter 'missing' in documentation comment
+// EXPECT:33: Warning: Test: test_param_missing: unknown parameter 'missing' in documentation comment
/**