From b20ac732d096c1140d856d99f4cf64f6c708de50 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Sat, 6 Feb 2016 20:59:11 -0800 Subject: tests: Add regression test for out array of struct This is a regression test for returning out arrays of structs, like gdk_keymap_get_entries_for_keyval() for example. https://bugzilla.gnome.org/show_bug.cgi?id=761658 --- tests/scanner/regress.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests/scanner/regress.c') diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c index fa481054..6eac6f7b 100644 --- a/tests/scanner/regress.c +++ b/tests/scanner/regress.c @@ -1739,6 +1739,23 @@ regress_test_struct_a_parse (RegressTestStructA *a_out, a_out->some_int = 23; } +/** + * regress_test_array_struct_out: + * @arr: (out) (array length=len) (transfer full): + * @len: (out) + * + * This is similar to gdk_keymap_get_entries_for_keyval(). + */ +void +regress_test_array_struct_out (RegressTestStructA **arr, int *len) +{ + *arr = g_new0(RegressTestStructA, 3); + (*arr)[0].some_int = 22; + (*arr)[1].some_int = 33; + (*arr)[2].some_int = 44; + *len = 3; +} + /** * regress_test_struct_b_clone: * @b: the structure -- cgit v1.2.1