From: Colin Walters Date: Mon, 5 Nov 2012 23:13:24 +0000 (-0500) Subject: gimarshallingtests: Add some GBytes tests X-Git-Tag: GOBJECT_INTROSPECTION_1_35_2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=af24c2bf8d07393904c537c0da6eb4481feb84bd;p=platform%2Fupstream%2Fgobject-introspection.git gimarshallingtests: Add some GBytes tests Will be used by gjs for new byte array work. https://bugzilla.gnome.org/show_bug.cgi?id=687696 --- diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c index e05f916..5ce800d 100644 --- a/tests/gimarshallingtests.c +++ b/tests/gimarshallingtests.c @@ -2233,6 +2233,36 @@ gi_marshalling_tests_bytearray_none_in (GByteArray *v) } /** + * gi_marshalling_tests_gbytes_full_return: + * + * Returns: (transfer full): + */ +GBytes * +gi_marshalling_tests_gbytes_full_return (void) +{ + static guint8 data[] = {0, 49, 0xFF, 51}; + + return g_bytes_new_static (data, G_N_ELEMENTS(data)); +} + +/** + * gi_marshalling_tests_gbytes_none_in: + */ +void +gi_marshalling_tests_gbytes_none_in (GBytes *v) +{ + const guint8 *data; + gsize len; + data = g_bytes_get_data (v, &len); + + g_assert_cmpuint (len, ==, 4); + g_assert_cmpuint (data[0], ==, 0); + g_assert_cmpuint (data[1], ==, 49); + g_assert_cmpuint (data[2], ==, 0xFF); + g_assert_cmpuint (data[3], ==, 51); +} + +/** * gi_marshalling_tests_gstrv_return: * * Returns: (transfer full): an array of strings diff --git a/tests/gimarshallingtests.h b/tests/gimarshallingtests.h index 73401ee..1b5d7ce 100644 --- a/tests/gimarshallingtests.h +++ b/tests/gimarshallingtests.h @@ -459,6 +459,11 @@ void gi_marshalling_tests_gptrarray_utf8_full_inout (GPtrArray **parray_); GByteArray *gi_marshalling_tests_bytearray_full_return (void); void gi_marshalling_tests_bytearray_none_in (GByteArray* v); +/* GBytes */ + +GBytes *gi_marshalling_tests_gbytes_full_return (void); +void gi_marshalling_tests_gbytes_none_in (GBytes* v); + /* GStrv */ GStrv gi_marshalling_tests_gstrv_return (void);