[gobject-introspection] gimarshallingtests: Add a utf8-in-bytearray test
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] gimarshallingtests: Add a utf8-in-bytearray test
- Date: Thu, 29 Nov 2012 19:55:34 +0000 (UTC)
commit f4bb1c1b18085ddbd22596de7f72993a2fd76c2d
Author: Colin Walters <walters verbum org>
Date: Thu Nov 29 14:54:01 2012 -0500
gimarshallingtests: Add a utf8-in-bytearray test
Will be used by gjs
tests/gimarshallingtests.c | 18 ++++++++++++++++++
tests/gimarshallingtests.h | 4 ++++
2 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index 9a53329..7f7abf8 100644
--- a/tests/gimarshallingtests.c
+++ b/tests/gimarshallingtests.c
@@ -1065,6 +1065,24 @@ gi_marshalling_tests_utf8_none_in (const gchar *utf8)
}
/**
+ * gi_marshalling_tests_utf8_as_uint8array_in:
+ * @array: (array length=len) (element-type guint8): Byte data that happens to be UTF-8
+ * @len: Length
+ *
+ * Takes data that happens to be UTF-8 as a byte array, to test
+ * binding conversion from their string type (e.g. JavaScript's
+ * UTF-16) to UTF-8.
+ */
+void
+gi_marshalling_tests_utf8_as_uint8array_in (const guint8 *array,
+ gsize len)
+{
+ gsize orig_len = strlen (GI_MARSHALLING_TESTS_CONSTANT_UTF8);
+ g_assert_cmpint (orig_len, ==, len);
+ g_assert (memcmp (GI_MARSHALLING_TESTS_CONSTANT_UTF8, array, len) == 0);
+}
+
+/**
* gi_marshalling_tests_utf8_none_out:
* @utf8: (out) (transfer none):
*/
diff --git a/tests/gimarshallingtests.h b/tests/gimarshallingtests.h
index 23af6a5..840f763 100644
--- a/tests/gimarshallingtests.h
+++ b/tests/gimarshallingtests.h
@@ -267,6 +267,10 @@ void gi_marshalling_tests_utf8_full_inout (gchar **utf8);
GSList *gi_marshalling_tests_filename_list_return (void);
+void gi_marshalling_tests_utf8_as_uint8array_in (const guint8 *array,
+ gsize len);
+
+
/* Enum */
typedef enum
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]