summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2012-01-04 21:37:48 -0500
committerJasper St. Pierre <jstpierre@mecheye.net>2012-02-03 11:52:33 -0500
commitb46da5f5e37e9748f6aa657fb5d49beaca7e5f0b (patch)
tree2ee7e5f7d372f79c95da06ecc3b7c1656d9c2027
parent6920430e7034bba42258c7b010347037b1641fb1 (diff)
downloadgobject-introspection-b46da5f5e37e9748f6aa657fb5d49beaca7e5f0b.tar.gz
tests: Add marshalling tests for various kinds of vfunc callbacks
To make sure that bindings can sanely deal with multiple kinds of callbacks, let's test some behaviors.
-rw-r--r--tests/gimarshallingtests.c70
-rw-r--r--tests/gimarshallingtests.h37
2 files changed, 107 insertions, 0 deletions
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index 5eb33880..b57f36d3 100644
--- a/tests/gimarshallingtests.c
+++ b/tests/gimarshallingtests.c
@@ -3810,6 +3810,76 @@ 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;
+}
G_DEFINE_TYPE (GIMarshallingTestsSubObject, gi_marshalling_tests_sub_object, GI_MARSHALLING_TESTS_TYPE_OBJECT);
diff --git a/tests/gimarshallingtests.h b/tests/gimarshallingtests.h
index 23a03b23..d5ddd3f2 100644
--- a/tests/gimarshallingtests.h
+++ b/tests/gimarshallingtests.h
@@ -656,6 +656,38 @@ 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);
+
};
struct _GIMarshallingTestsObject
@@ -680,6 +712,11 @@ 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);
GIMarshallingTestsObject *gi_marshalling_tests_object_none_return (void);
GIMarshallingTestsObject *gi_marshalling_tests_object_full_return (void);