[gobject-introspection] Add tests for returning zero-terminated arrays of non-strings



commit b29b3ec7c9f4f9f6d979aff1bfc3dc6cb05970d2
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Thu May 12 22:47:48 2011 +0200

    Add tests for returning zero-terminated arrays of non-strings
    
    gjs has always supported zero-terminated arrays of strings, and
    nothing else. Now that this changed, we need to test it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=634253

 tests/gimarshallingtests.c |   23 +++++++++++++++++++++++
 tests/gimarshallingtests.h |    6 ++++--
 2 files changed, 27 insertions(+), 2 deletions(-)
---
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index 77b6b74..56df373 100644
--- a/tests/gimarshallingtests.c
+++ b/tests/gimarshallingtests.c
@@ -1283,6 +1283,29 @@ gi_marshalling_tests_array_zero_terminated_return (void)
 }
 
 /**
+ * gi_marshalling_tests_array_zero_terminated_return_struct:
+ * Returns: (array zero-terminated=1) (transfer full):
+ */
+GIMarshallingTestsBoxedStruct **
+gi_marshalling_tests_array_zero_terminated_return_struct (void)
+{
+    GIMarshallingTestsBoxedStruct **ret = (GIMarshallingTestsBoxedStruct**) g_new (gpointer, 4);
+
+    ret[0] = gi_marshalling_tests_boxed_struct_new ();
+    ret[0]->long_ = 42;
+
+    ret[1] = gi_marshalling_tests_boxed_struct_new ();
+    ret[1]->long_ = 43;
+
+    ret[2] = gi_marshalling_tests_boxed_struct_new ();
+    ret[2]->long_ = 44;
+
+    ret[3] = NULL;
+
+    return ret;
+}
+
+/**
  * gi_marshalling_tests_array_zero_terminated_in:
  * @utf8s: (array zero-terminated=1) (transfer none):
  */
diff --git a/tests/gimarshallingtests.h b/tests/gimarshallingtests.h
index 752147b..f7b59b3 100644
--- a/tests/gimarshallingtests.h
+++ b/tests/gimarshallingtests.h
@@ -8,6 +8,7 @@
 #define __GI_MARSHALLING_TESTS_H__
 
 typedef struct _GIMarshallingTestsSimpleStruct GIMarshallingTestsSimpleStruct;
+typedef struct _GIMarshallingTestsBoxedStruct GIMarshallingTestsBoxedStruct;
 
 /* Constants */
 
@@ -290,6 +291,7 @@ void gi_marshalling_tests_array_inout (gint **ints, gint *length);
 /* Zero-terminated */
 
 gchar **gi_marshalling_tests_array_zero_terminated_return (void);
+GIMarshallingTestsBoxedStruct **gi_marshalling_tests_array_zero_terminated_return_struct (void);
 
 void gi_marshalling_tests_array_zero_terminated_in (gchar **utf8s);
 
@@ -540,10 +542,10 @@ GIMarshallingTestsPointerStruct *gi_marshalling_tests_pointer_struct_returnv (vo
 
 void gi_marshalling_tests_pointer_struct_inv (GIMarshallingTestsPointerStruct *struct_);
 
-typedef struct {
+struct _GIMarshallingTestsBoxedStruct {
     glong long_;
     GStrv g_strv;
-} GIMarshallingTestsBoxedStruct;
+};
 
 GType gi_marshalling_tests_boxed_struct_get_type (void) G_GNUC_CONST;
 



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