Browse files

GIMarshallingTests: Add method taking array of variants

Add a new interface GIMarshallingTestsInterface3 with a method that takes an
array of variants as argument. This can be used for testing the passing of
array of variants from C to introspection clients, which is not otherwise
covered in the tests for arrays of variants.

https://bugzilla.gnome.org/show_bug.cgi?id=667244

Signed-off-by: Martin Pitt <martinpitt@gnome.org>
  • Loading branch information...
1 parent 2554bf1 commit bd09ba5f2e659c66c133977881358a810eb859b5 Mikkel Kamstrup Erlandsen committed with Martin Pitt Jul 12, 2012
Showing with 56 additions and 0 deletions.
  1. +32 −0 tests/gimarshallingtests.c
  2. +24 −0 tests/gimarshallingtests.h
View
32 tests/gimarshallingtests.c
@@ -4193,6 +4193,38 @@ gi_marshalling_tests_interface2_get_type(void)
return type;
}
+static void
+gi_marshalling_tests_interface3_class_init(void *g_iface)
+{
+}
+
+GType
+gi_marshalling_tests_interface3_get_type(void)
+{
+ static GType type = 0;
+ if (type == 0) {
+ type = g_type_register_static_simple (G_TYPE_INTERFACE,
+ "GIMarshallingTestsInterface3",
+ sizeof (GIMarshallingTestsInterface3Iface),
+ (GClassInitFunc) gi_marshalling_tests_interface3_class_init,
+ 0, NULL, 0);
+ }
+
+ return type;
+}
+
+/**
+ * gi_marshalling_tests_interface3_test_variant_array_in:
+ * @in: (array length=n_in):
+ * @n_in:
+ */
+void
+gi_marshalling_tests_interface3_test_variant_array_in (GIMarshallingTestsInterface3 *self,
+ GVariant **in,
+ gsize n_in)
+{
+ GI_MARSHALLING_TESTS_INTERFACE3_GET_IFACE (self)->test_variant_array_in (self, in, n_in);
+}
/**
* gi_marshalling_tests_int_out_out:
View
24 tests/gimarshallingtests.h
@@ -782,6 +782,7 @@ const gint *gi_marshalling_tests_object_method_array_return (GIMarshallingTestsO
void gi_marshalling_tests_object_method_int8_in (GIMarshallingTestsObject *object, gint8 in);
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);
+void gi_marshalling_tests_object_method_variant_array_in (GIMarshallingTestsObject *object, GVariant **in, gsize n_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);
@@ -908,6 +909,29 @@ struct _GIMarshallingTestsInterface2Iface {
GType gi_marshalling_tests_interface2_get_type (void) G_GNUC_CONST;
+/* GIMarshallingTestsInterface3 tests passing arrays of variants from C to @lang */
+
+#define GI_MARSHALLING_TESTS_TYPE_INTERFACE3 (gi_marshalling_tests_interface3_get_type ())
+#define GI_MARSHALLING_TESTS_INTERFACE3(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GI_MARSHALLING_TESTS_TYPE_INTERFACE3, GIMarshallingTestsInterface3))
+#define GI_MARSHALLING_TESTS_IS_INTERFACE3(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GI_MARSHALLING_TESTS_TYPE_INTERFACE3))
+#define GI_MARSHALLING_TESTS_INTERFACE3_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GI_MARSHALLING_TESTS_TYPE_INTERFACE3, GIMarshallingTestsInterface3Iface))
+
+typedef struct _GIMarshallingTestsInterface3 GIMarshallingTestsInterface3;
+typedef struct _GIMarshallingTestsInterface3Iface GIMarshallingTestsInterface3Iface;
+
+struct _GIMarshallingTestsInterface3Iface {
+ GTypeInterface base_iface;
+
+ /**
+ * GIMarshallingTestsInterface3::test_variant_array_in:
+ * @in: (in) (array length=n_in):
+ */
+ void (* test_variant_array_in) (GIMarshallingTestsInterface3 *self, GVariant **in, gsize n_in);
+};
+
+GType gi_marshalling_tests_interface3_get_type (void) G_GNUC_CONST;
+
+void gi_marshalling_tests_interface3_test_variant_array_in (GIMarshallingTestsInterface3 *self, GVariant **in, gsize n_in);
/* Multiple output arguments */

0 comments on commit bd09ba5

Please sign in to comment.