[gobject-introspection] gimarshallingtests: Add marshalling tests for virtual functions with inout parameters



commit d716945125543b999f892fbf6297ff6a37ee111f
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Mon Mar 16 23:03:44 2020 +0100

    gimarshallingtests: Add marshalling tests for virtual functions with inout parameters
    
    Virtual functions may use input/output parameters but this is not currently
    well handled by gjs, so adding test cases to gobject-introspection to verify
    that virtual functions correctly receive valid input values and can return
    them.

 tests/gimarshallingtests.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/gimarshallingtests.h | 38 ++++++++++++++++++++++++++++++
 2 files changed, 96 insertions(+)
---
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index 92868016..44971506 100644
--- a/tests/gimarshallingtests.c
+++ b/tests/gimarshallingtests.c
@@ -4583,6 +4583,33 @@ gi_marshalling_tests_object_vfunc_one_out_parameter (GIMarshallingTestsObject *s
   g_assert_cmpint (local, ==, 0x12345678);
 }
 
+/**
+ * gi_marshalling_tests_object_vfunc_one_inout_parameter:
+ * @a: (inout):
+ */
+void
+gi_marshalling_tests_object_vfunc_one_inout_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_inout_parameter (self, a);
+  g_assert_cmpint (local, ==, 0x12345678);
+}
+
+/**
+ * gi_marshalling_tests_object_vfunc_multiple_inout_parameters:
+ * @a: (inout):
+ * @b: (inout):
+ */
+void
+gi_marshalling_tests_object_vfunc_multiple_inout_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_inout_parameters (self, a, b);
+  g_assert_cmpint (local, ==, 0x12345678);
+}
+
 /**
  * gi_marshalling_tests_object_vfunc_multiple_out_parameters:
  * @a: (out):
@@ -4651,6 +4678,37 @@ glong
   return return_value;
 }
 
+/**
+ * gi_marshalling_tests_object_vfunc_return_value_and_one_inout_parameter:
+ * @a: (inout):
+ */
+glong gi_marshalling_tests_object_vfunc_return_value_and_one_inout_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_inout_parameter 
(self, a);
+  g_assert_cmpint (local, ==, 0x12345678);
+  return return_value;
+}
+
+/**
+ * gi_marshalling_tests_object_vfunc_return_value_and_multiple_inout_parameters:
+ * @a: (inout):
+ * @b: (inout):
+ */
+glong
+  gi_marshalling_tests_object_vfunc_return_value_and_multiple_inout_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_inout_parameters (self, a, 
b);
+  g_assert_cmpint (local, ==, 0x12345678);
+  return return_value;
+}
+
 /**
  * gi_marshalling_tests_callback_owned_boxed:
  * @callback: (scope call) (closure callback_data):
diff --git a/tests/gimarshallingtests.h b/tests/gimarshallingtests.h
index d5357ec9..747a075d 100644
--- a/tests/gimarshallingtests.h
+++ b/tests/gimarshallingtests.h
@@ -1409,6 +1409,19 @@ struct _GIMarshallingTestsObjectClass
      */
     void  (* vfunc_multiple_out_parameters) (GIMarshallingTestsObject *self, gfloat *a, gfloat *b);
 
+    /**
+     * GIMarshallingTestsObjectClass::vfunc_one_inout_parameter:
+     * @a: (inout):
+     */
+    void  (* vfunc_one_inout_parameter) (GIMarshallingTestsObject *self, gfloat *a);
+
+    /**
+     * GIMarshallingTestsObjectClass::vfunc_multiple_inout_parameters:
+     * @a: (inout):
+     * @b: (inout):
+     */
+    void  (* vfunc_multiple_inout_parameters) (GIMarshallingTestsObject *self, gfloat *a, gfloat *b);
+
     /**
      * GIMarshallingTestsObjectClass::vfunc_caller_allocated_out_parameter:
      * @a: (out):
@@ -1434,6 +1447,19 @@ struct _GIMarshallingTestsObjectClass
      */
     glong (* vfunc_return_value_and_multiple_out_parameters) (GIMarshallingTestsObject *self, glong *a, 
glong *b);
 
+    /**
+     * GIMarshallingTestsObjectClass::vfunc_return_value_and_one_inout_parameter:
+     * @a: (inout):
+     */
+    glong (* vfunc_return_value_and_one_inout_parameter) (GIMarshallingTestsObject *self, glong *a);
+
+    /**
+     * GIMarshallingTestsObjectClass::vfunc_return_value_and_multiple_inout_parameters:
+     * @a: (inout):
+     * @b: (inout):
+     */
+    glong (* vfunc_return_value_and_multiple_inout_parameters) (GIMarshallingTestsObject *self, glong *a, 
glong *b);
+
     /**
      * GIMarshallingTestsObjectClass::vfunc_meth_with_err:
      * @x:
@@ -1560,6 +1586,12 @@ void gi_marshalling_tests_object_vfunc_one_out_parameter (GIMarshallingTestsObje
 _GI_TEST_EXTERN
 void gi_marshalling_tests_object_vfunc_multiple_out_parameters (GIMarshallingTestsObject *self, gfloat *a, 
gfloat *b);
 
+_GI_TEST_EXTERN
+void gi_marshalling_tests_object_vfunc_one_inout_parameter (GIMarshallingTestsObject *self, gfloat *a);
+
+_GI_TEST_EXTERN
+void gi_marshalling_tests_object_vfunc_multiple_inout_parameters (GIMarshallingTestsObject *self, gfloat *a, 
gfloat *b);
+
 _GI_TEST_EXTERN
 void gi_marshalling_tests_object_vfunc_caller_allocated_out_parameter (GIMarshallingTestsObject *self, 
GValue *a);
 
@@ -1572,6 +1604,12 @@ glong gi_marshalling_tests_object_vfunc_return_value_and_one_out_parameter (GIMa
 _GI_TEST_EXTERN
 glong gi_marshalling_tests_object_vfunc_return_value_and_multiple_out_parameters (GIMarshallingTestsObject 
*self, glong *a, glong *b);
 
+_GI_TEST_EXTERN
+glong gi_marshalling_tests_object_vfunc_return_value_and_one_inout_parameter (GIMarshallingTestsObject 
*self, glong *a);
+
+_GI_TEST_EXTERN
+glong gi_marshalling_tests_object_vfunc_return_value_and_multiple_inout_parameters (GIMarshallingTestsObject 
*self, glong *a, glong *b);
+
 _GI_TEST_EXTERN
 gboolean gi_marshalling_tests_object_vfunc_meth_with_error (GIMarshallingTestsObject *object, gint x, GError 
**error);
 


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