Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Commit

Permalink
GIMarshallingTests: Add method taking array of variants
Browse files Browse the repository at this point in the history
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
Mikkel Kamstrup Erlandsen authored and Martin Pitt committed Jul 12, 2012
1 parent 2554bf1 commit bd09ba5
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/gimarshallingtests.c
Expand Up @@ -4193,6 +4193,38 @@ gi_marshalling_tests_interface2_get_type(void)
return type; 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: * gi_marshalling_tests_int_out_out:
Expand Down
24 changes: 24 additions & 0 deletions tests/gimarshallingtests.h
Expand Up @@ -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_in (GIMarshallingTestsObject *object, gint8 in);
void gi_marshalling_tests_object_method_int8_out (GIMarshallingTestsObject *object, gint8 *out); 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_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); 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_one_out_parameter (GIMarshallingTestsObject *self, gfloat *a);
Expand Down Expand Up @@ -908,6 +909,29 @@ struct _GIMarshallingTestsInterface2Iface {


GType gi_marshalling_tests_interface2_get_type (void) G_GNUC_CONST; 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 */ /* Multiple output arguments */


Expand Down

0 comments on commit bd09ba5

Please sign in to comment.