From d4b37b82ac49eacb17c3e7e2acf54533e27a11e4 Mon Sep 17 00:00:00 2001 From: Bastian Winkler Date: Fri, 20 Apr 2012 14:01:18 +0200 Subject: [PATCH] tests: Add array marshalling test for array without length argument A test case with an array in-argument that is neither zero terminated, nor fixed length, nor blessed with a length argument. This is, for example, the case in clutter_texture_set_from_rgb_data() https://bugzilla.gnome.org/show_bug.cgi?id=674271 Signed-off-by: Martin Pitt --- tests/gimarshallingtests.c | 14 ++++++++++++++ tests/gimarshallingtests.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c index fcbad69..f2cfc35 100644 --- a/tests/gimarshallingtests.c +++ b/tests/gimarshallingtests.c @@ -1530,6 +1530,20 @@ gi_marshalling_tests_array_inout_etc (gint first, gint **ints, gint *length, gin } /** + * gi_marshalling_tests_array_in_nonzero_nonlen: + * @first: + * @chars: (array): + */ +void +gi_marshalling_tests_array_in_nonzero_nonlen (gint first, const guint8 *chars) +{ + g_assert(chars[0] == 'a'); + g_assert(chars[1] == 'b'); + g_assert(chars[2] == 'c'); + g_assert(chars[3] == 'd'); +} + +/** * gi_marshalling_tests_array_zero_terminated_return: * * Returns: (array zero-terminated=1) (transfer none): diff --git a/tests/gimarshallingtests.h b/tests/gimarshallingtests.h index 6fa1b08..2d3e1f6 100644 --- a/tests/gimarshallingtests.h +++ b/tests/gimarshallingtests.h @@ -398,6 +398,8 @@ void gi_marshalling_tests_array_out_etc (gint first, gint **ints, gint *length, void gi_marshalling_tests_array_inout (gint **ints, gint *length); void gi_marshalling_tests_array_inout_etc (gint first, gint **ints, gint *length, gint last, gint *sum); +void gi_marshalling_tests_array_in_nonzero_nonlen (gint first, const guint8 *chars); + /* Zero-terminated */ gchar **gi_marshalling_tests_array_zero_terminated_return (void); -- 2.7.4