[gobject-introspection] [GIMarshallingTest] Add GByteArray test API



commit 0477ee7e6d5b475b6fdfaadaabbec451af61b184
Author: Johan Dahlin <johan gnome org>
Date:   Mon Jun 21 19:24:46 2010 -0300

    [GIMarshallingTest] Add GByteArray test API

 gir/GIMarshallingTests-1.0-expected.gir |   20 +++++++++++++++++
 gir/gimarshallingtests.c                |   35 +++++++++++++++++++++++++++++++
 gir/gimarshallingtests.h                |    5 ++++
 3 files changed, 60 insertions(+), 0 deletions(-)
---
diff --git a/gir/GIMarshallingTests-1.0-expected.gir b/gir/GIMarshallingTests-1.0-expected.gir
index ed4739b..b83dbdf 100644
--- a/gir/GIMarshallingTests-1.0-expected.gir
+++ b/gir/GIMarshallingTests-1.0-expected.gir
@@ -860,6 +860,26 @@ and/or use gtk-doc annotations.  -->
         <type name="BoxedStruct" c:type="GIMarshallingTestsBoxedStruct*"/>
       </return-value>
     </function>
+    <function name="bytearray_full_return"
+              c:identifier="g_i_marshalling_tests_bytearray_full_return">
+      <return-value transfer-ownership="full">
+        <array name="GLib.ByteArray" c:type="GByteArray*">
+        </array>
+      </return-value>
+    </function>
+    <function name="bytearray_none_in"
+              c:identifier="g_i_marshalling_tests_bytearray_none_in">
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="array_" transfer-ownership="none">
+          <array name="GLib.ByteArray" c:type="GByteArray*">
+            <type name="int"/>
+          </array>
+        </parameter>
+      </parameters>
+    </function>
     <function name="double_in" c:identifier="g_i_marshalling_tests_double_in">
       <return-value transfer-ownership="none">
         <type name="none" c:type="void"/>
diff --git a/gir/gimarshallingtests.c b/gir/gimarshallingtests.c
index ee6d91f..da2fade 100644
--- a/gir/gimarshallingtests.c
+++ b/gir/gimarshallingtests.c
@@ -1581,6 +1581,41 @@ g_i_marshalling_tests_garray_utf8_full_inout (GArray **array_)
 }
 
 /**
+ * g_i_marshalling_tests_bytearray_full_return:
+ * Returns: (transfer full):
+ */
+GByteArray *
+g_i_marshalling_tests_bytearray_full_return (void)
+{
+    GByteArray *array = NULL;
+    static gchar *values[] = {"0", "1", "2", "3", NULL};
+    gint i;
+
+    array = g_byte_array_new ();
+    for (i = 0; values[i]; i++) {
+        gchar *str = g_strdup (values[i]);
+        g_byte_array_append (array, (const guint8*)str, 1);
+    }
+
+    return array;
+
+}
+
+/**
+ * g_i_marshalling_tests_bytearray_none_in:
+ * @array_: (element-type gint) (transfer none):
+ */
+void
+g_i_marshalling_tests_bytearray_none_in (GByteArray *array_)
+{
+    g_assert (array_->len == 4);
+    g_assert (g_array_index (array_, char, 0) == '0');
+    g_assert (g_array_index (array_, char, 1) == '1');
+    g_assert (g_array_index (array_, char, 2) == '2');
+    g_assert (g_array_index (array_, char, 3) == '3');
+}
+
+/**
  * g_i_marshalling_tests_gstrv_return:
  * Returns:
  */
diff --git a/gir/gimarshallingtests.h b/gir/gimarshallingtests.h
index 1ad5dd7..34ae0bb 100644
--- a/gir/gimarshallingtests.h
+++ b/gir/gimarshallingtests.h
@@ -316,6 +316,11 @@ void g_i_marshalling_tests_garray_utf8_none_inout (GArray **array_);
 void g_i_marshalling_tests_garray_utf8_container_inout (GArray **array_);
 void g_i_marshalling_tests_garray_utf8_full_inout (GArray **array_);
 
+/* GByteArray */
+
+GByteArray *g_i_marshalling_tests_bytearray_full_return (void);
+void g_i_marshalling_tests_bytearray_none_in (GByteArray* array_);
+
 /* GStrv */
 
 GStrv g_i_marshalling_tests_gstrv_return (void);



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