[gobject-introspection/wip/gobj-kitchen-sink: 3/5] tests: Add marshalling tests for various kinds of vfunc callbacks



commit b46da5f5e37e9748f6aa657fb5d49beaca7e5f0b
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Jan 4 21:37:48 2012 -0500

    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.

 tests/gimarshallingtests.c |   70 ++++++++++++++++++++++++++++++++++++++++++++
 tests/gimarshallingtests.h |   37 +++++++++++++++++++++++
 2 files changed, 107 insertions(+), 0 deletions(-)
---
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index 5eb3388..b57f36d 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 23a03b2..d5ddd3f 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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]