[gobject-introspection] gimarshallingtests: Add tests for enum returned from vfunc



commit b5cd5c07a1b059d3d90d86d04426d72eedcfaa39
Author: Simon Feltman <sfeltman src gnome org>
Date:   Sun Mar 17 23:03:46 2013 -0700

    gimarshallingtests: Add tests for enum returned from vfunc
    
    Add vfuncs and methods for an object returning an enum or
    using one as an output argument.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=637832

 tests/gimarshallingtests.c |   28 ++++++++++++++++++++++++++++
 tests/gimarshallingtests.h |   15 +++++++++++++--
 2 files changed, 41 insertions(+), 2 deletions(-)
---
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index 2851c4d..1998161 100644
--- a/tests/gimarshallingtests.c
+++ b/tests/gimarshallingtests.c
@@ -4350,6 +4350,34 @@ gi_marshalling_tests_object_vfunc_meth_with_error (GIMarshallingTestsObject *sel
   return ret;
 }
 
+/**
+ * gi_marshalling_tests_object_vfunc_return_enum:
+ */
+GIMarshallingTestsEnum
+gi_marshalling_tests_object_vfunc_return_enum (GIMarshallingTestsObject *self)
+{
+  /* make sure that local variables don't get smashed */
+  GIMarshallingTestsEnum return_value;
+  glong local = 0x12345678;
+  return_value = GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_return_enum (self);
+  g_assert_cmpint (local, ==, 0x12345678);
+  return return_value;
+}
+
+/**
+ * gi_marshalling_tests_object_vfunc_out_enum:
+ * @_enum: (out):
+ */
+void
+gi_marshalling_tests_object_vfunc_out_enum (GIMarshallingTestsObject *self, GIMarshallingTestsEnum *_enum)
+{
+  /* make sure that local variables don't get smashed */
+  gulong local = 0x12345678;
+  GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_out_enum (self, _enum);
+  g_assert_cmpint (local, ==, 0x12345678);
+}
+
+
 /* NOTE:
  *
  * The following (get_ref_info_for_*) methods are designed to call vfuncs related
diff --git a/tests/gimarshallingtests.h b/tests/gimarshallingtests.h
index a361de0..67c2f70 100644
--- a/tests/gimarshallingtests.h
+++ b/tests/gimarshallingtests.h
@@ -804,6 +804,16 @@ struct _GIMarshallingTestsObjectClass
      */
     gboolean (*vfunc_meth_with_err) (GIMarshallingTestsObject *object, gint x, GError **error);
 
+    /**
+     * GIMarshallingTestsObjectClass::vfunc_return_enum:
+     */
+    GIMarshallingTestsFlags (* vfunc_return_enum) (GIMarshallingTestsObject *self);
+
+    /**
+     * GIMarshallingTestsObjectClass::vfunc_out_enum:
+     * @_enum: (out):
+     */
+    void (* vfunc_out_enum) (GIMarshallingTestsObject *self, GIMarshallingTestsEnum *_enum);
 
     /**
      * GIMarshallingTestsObjectClass::vfunc_return_object_transfer_none:
@@ -842,8 +852,6 @@ struct _GIMarshallingTestsObjectClass
      * @object: (in) (transfer full):
      */
     void (* vfunc_in_object_transfer_full) (GIMarshallingTestsObject *self, GObject *object);
-
-
 };
 
 struct _GIMarshallingTestsObject
@@ -881,6 +889,9 @@ glong gi_marshalling_tests_object_vfunc_return_value_and_one_out_parameter (GIMa
 glong gi_marshalling_tests_object_vfunc_return_value_and_multiple_out_parameters (GIMarshallingTestsObject 
*self, glong *a, glong *b);
 gboolean gi_marshalling_tests_object_vfunc_meth_with_error (GIMarshallingTestsObject *object, gint x, GError 
**error);
 
+GIMarshallingTestsEnum gi_marshalling_tests_object_vfunc_return_enum (GIMarshallingTestsObject *self);
+void gi_marshalling_tests_object_vfunc_out_enum (GIMarshallingTestsObject *self, GIMarshallingTestsEnum 
*_enum);
+
 void gi_marshalling_tests_object_get_ref_info_for_vfunc_return_object_transfer_none 
(GIMarshallingTestsObject *self, guint *ref_count, gboolean *is_floating);
 void gi_marshalling_tests_object_get_ref_info_for_vfunc_return_object_transfer_full 
(GIMarshallingTestsObject *self, guint *ref_count, gboolean *is_floating);
 void gi_marshalling_tests_object_get_ref_info_for_vfunc_out_object_transfer_none (GIMarshallingTestsObject 
*self, guint *ref_count, gboolean *is_floating);


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