1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
2 *vim: tabstop=4 shiftwidth=4 expandtab
5 /* This file gets installed, so we can't assume config.h is available */
10 #include "gimarshallingtests.h"
14 static void gi_marshalling_tests_boxed_struct_free (GIMarshallingTestsBoxedStruct *v);
19 gi_marshalling_tests_boolean_return_true (void)
25 gi_marshalling_tests_boolean_return_false (void)
31 gi_marshalling_tests_boolean_in_true (gboolean v)
37 gi_marshalling_tests_boolean_in_false (gboolean v)
39 g_assert (v == FALSE);
43 * gi_marshalling_tests_boolean_out_true:
47 gi_marshalling_tests_boolean_out_true (gboolean *v)
53 * gi_marshalling_tests_boolean_out_false:
57 gi_marshalling_tests_boolean_out_false (gboolean *v)
63 * gi_marshalling_tests_boolean_inout_true_false:
67 gi_marshalling_tests_boolean_inout_true_false (gboolean *v)
69 g_assert (*v == TRUE);
74 * gi_marshalling_tests_boolean_inout_false_true:
78 gi_marshalling_tests_boolean_inout_false_true (gboolean *v)
80 g_assert (*v == FALSE);
88 gi_marshalling_tests_int8_return_max (void)
94 gi_marshalling_tests_int8_return_min (void)
100 gi_marshalling_tests_int8_in_max (gint8 v)
102 g_assert_cmpint (v, ==, G_MAXINT8);
106 gi_marshalling_tests_int8_in_min (gint8 v)
108 g_assert_cmpint (v, ==, G_MININT8);
112 * gi_marshalling_tests_int8_out_max:
116 gi_marshalling_tests_int8_out_max (gint8 *v)
122 * gi_marshalling_tests_int8_out_min:
126 gi_marshalling_tests_int8_out_min (gint8 *v)
132 * gi_marshalling_tests_int8_inout_max_min:
136 gi_marshalling_tests_int8_inout_max_min (gint8 *v)
138 g_assert_cmpint (*v, ==, G_MAXINT8);
143 * gi_marshalling_tests_int8_inout_min_max:
147 gi_marshalling_tests_int8_inout_min_max (gint8 *v)
149 g_assert_cmpint (*v, ==, G_MININT8);
155 gi_marshalling_tests_uint8_return (void)
161 gi_marshalling_tests_uint8_in (guint8 v)
163 g_assert_cmpuint (v, ==, G_MAXUINT8);
167 * gi_marshalling_tests_uint8_out:
171 gi_marshalling_tests_uint8_out (guint8 *v)
177 * gi_marshalling_tests_uint8_inout:
181 gi_marshalling_tests_uint8_inout (guint8 *v)
183 g_assert_cmpuint (*v, ==, G_MAXUINT8);
189 gi_marshalling_tests_int16_return_max (void)
195 gi_marshalling_tests_int16_return_min (void)
201 gi_marshalling_tests_int16_in_max (gint16 v)
203 g_assert_cmpint (v, ==, G_MAXINT16);
207 gi_marshalling_tests_int16_in_min (gint16 v)
209 g_assert_cmpint (v, ==, G_MININT16);
213 * gi_marshalling_tests_int16_out_max:
217 gi_marshalling_tests_int16_out_max (gint16 *v)
223 * gi_marshalling_tests_int16_out_min:
227 gi_marshalling_tests_int16_out_min (gint16 *v)
233 * gi_marshalling_tests_int16_inout_max_min:
237 gi_marshalling_tests_int16_inout_max_min (gint16 *v)
239 g_assert_cmpint (*v, ==, G_MAXINT16);
244 * gi_marshalling_tests_int16_inout_min_max:
248 gi_marshalling_tests_int16_inout_min_max (gint16 *v)
250 g_assert_cmpint (*v, ==, G_MININT16);
256 gi_marshalling_tests_uint16_return (void)
262 gi_marshalling_tests_uint16_in (guint16 v)
264 g_assert_cmpuint (v, ==, G_MAXUINT16);
268 * gi_marshalling_tests_uint16_out:
272 gi_marshalling_tests_uint16_out (guint16 *v)
278 * gi_marshalling_tests_uint16_inout:
282 gi_marshalling_tests_uint16_inout (guint16 *v)
284 g_assert_cmpuint (*v, ==, G_MAXUINT16);
290 gi_marshalling_tests_int32_return_max (void)
296 gi_marshalling_tests_int32_return_min (void)
302 gi_marshalling_tests_int32_in_max (gint32 v)
304 g_assert_cmpint (v, ==, G_MAXINT32);
308 gi_marshalling_tests_int32_in_min (gint32 v)
310 g_assert_cmpint (v, ==, G_MININT32);
314 * gi_marshalling_tests_int32_out_max:
318 gi_marshalling_tests_int32_out_max (gint32 *v)
324 * gi_marshalling_tests_int32_out_min:
328 gi_marshalling_tests_int32_out_min (gint32 *v)
334 * gi_marshalling_tests_int32_inout_max_min:
338 gi_marshalling_tests_int32_inout_max_min (gint32 *v)
340 g_assert_cmpint (*v, ==, G_MAXINT32);
345 * gi_marshalling_tests_int32_inout_min_max:
349 gi_marshalling_tests_int32_inout_min_max (gint32 *v)
351 g_assert_cmpint (*v, ==, G_MININT32);
357 gi_marshalling_tests_uint32_return (void)
363 gi_marshalling_tests_uint32_in (guint32 v)
365 g_assert_cmpuint (v, ==, G_MAXUINT32);
369 * gi_marshalling_tests_uint32_out:
373 gi_marshalling_tests_uint32_out (guint32 *v)
379 * gi_marshalling_tests_uint32_inout:
383 gi_marshalling_tests_uint32_inout (guint32 *v)
385 g_assert_cmpuint (*v, ==, G_MAXUINT32);
391 gi_marshalling_tests_int64_return_max (void)
397 gi_marshalling_tests_int64_return_min (void)
403 gi_marshalling_tests_int64_in_max (gint64 v)
405 g_assert_cmpint (v, ==, G_MAXINT64);
409 gi_marshalling_tests_int64_in_min (gint64 v)
411 g_assert_cmpint (v, ==, G_MININT64);
415 * gi_marshalling_tests_int64_out_max:
419 gi_marshalling_tests_int64_out_max (gint64 *v)
425 * gi_marshalling_tests_int64_out_min:
429 gi_marshalling_tests_int64_out_min (gint64 *v)
435 * gi_marshalling_tests_int64_inout_max_min:
439 gi_marshalling_tests_int64_inout_max_min (gint64 *v)
441 g_assert_cmpint (*v, ==, G_MAXINT64);
446 * gi_marshalling_tests_int64_inout_min_max:
450 gi_marshalling_tests_int64_inout_min_max (gint64 *v)
452 g_assert_cmpint (*v, ==, G_MININT64);
458 gi_marshalling_tests_uint64_return (void)
464 gi_marshalling_tests_uint64_in (guint64 v)
466 g_assert_cmpuint (v, ==, G_MAXUINT64);
470 * gi_marshalling_tests_uint64_out:
474 gi_marshalling_tests_uint64_out (guint64 *v)
480 * gi_marshalling_tests_uint64_inout:
484 gi_marshalling_tests_uint64_inout (guint64 *v)
486 g_assert_cmpuint (*v, ==, G_MAXUINT64);
492 gi_marshalling_tests_short_return_max (void)
498 gi_marshalling_tests_short_return_min (void)
504 gi_marshalling_tests_short_in_max (gshort short_)
506 g_assert_cmpint (short_, ==, G_MAXSHORT);
510 gi_marshalling_tests_short_in_min (gshort short_)
512 g_assert_cmpint (short_, ==, G_MINSHORT);
516 * gi_marshalling_tests_short_out_max:
520 gi_marshalling_tests_short_out_max (gshort *short_)
522 *short_ = G_MAXSHORT;
526 * gi_marshalling_tests_short_out_min:
530 gi_marshalling_tests_short_out_min (gshort *short_)
532 *short_ = G_MINSHORT;
536 * gi_marshalling_tests_short_inout_max_min:
540 gi_marshalling_tests_short_inout_max_min (gshort *short_)
542 g_assert_cmpint (*short_, ==, G_MAXSHORT);
543 *short_ = G_MINSHORT;
547 * gi_marshalling_tests_short_inout_min_max:
551 gi_marshalling_tests_short_inout_min_max (gshort *short_)
553 g_assert_cmpint (*short_, ==, G_MINSHORT);
554 *short_ = G_MAXSHORT;
559 gi_marshalling_tests_ushort_return (void)
565 gi_marshalling_tests_ushort_in (gushort ushort_)
567 g_assert_cmpuint (ushort_, ==, G_MAXUSHORT);
571 * gi_marshalling_tests_ushort_out:
575 gi_marshalling_tests_ushort_out (gushort *ushort_)
577 *ushort_ = G_MAXUSHORT;
581 * gi_marshalling_tests_ushort_inout:
585 gi_marshalling_tests_ushort_inout (gushort *ushort_)
587 g_assert_cmpuint (*ushort_, ==, G_MAXUSHORT);
593 gi_marshalling_tests_int_return_max (void)
599 gi_marshalling_tests_int_return_min (void)
605 gi_marshalling_tests_int_in_max (gint int_)
607 g_assert_cmpint (int_, ==, G_MAXINT);
611 gi_marshalling_tests_int_in_min (gint int_)
613 g_assert_cmpint (int_, ==, G_MININT);
617 * gi_marshalling_tests_int_out_max:
621 gi_marshalling_tests_int_out_max (gint *int_)
627 * gi_marshalling_tests_int_out_min:
631 gi_marshalling_tests_int_out_min (gint *int_)
637 * gi_marshalling_tests_int_inout_max_min:
641 gi_marshalling_tests_int_inout_max_min (gint *int_)
643 g_assert_cmpint (*int_, ==, G_MAXINT);
648 * gi_marshalling_tests_int_inout_min_max:
652 gi_marshalling_tests_int_inout_min_max (gint *int_)
654 g_assert_cmpint (*int_, ==, G_MININT);
660 gi_marshalling_tests_uint_return (void)
666 gi_marshalling_tests_uint_in (guint uint_)
668 g_assert_cmpuint (uint_, ==, G_MAXUINT);
672 * gi_marshalling_tests_uint_out:
676 gi_marshalling_tests_uint_out (guint *uint_)
682 * gi_marshalling_tests_uint_inout:
686 gi_marshalling_tests_uint_inout (guint *uint_)
688 g_assert_cmpuint (*uint_, ==, G_MAXUINT);
694 gi_marshalling_tests_long_return_max (void)
700 gi_marshalling_tests_long_return_min (void)
706 gi_marshalling_tests_long_in_max (glong long_)
708 g_assert_cmpint (long_, ==, G_MAXLONG);
712 gi_marshalling_tests_long_in_min (glong long_)
714 g_assert_cmpint (long_, ==, G_MINLONG);
718 * gi_marshalling_tests_long_out_max:
722 gi_marshalling_tests_long_out_max (glong *long_)
728 * gi_marshalling_tests_long_out_min:
732 gi_marshalling_tests_long_out_min (glong *long_)
738 * gi_marshalling_tests_long_inout_max_min:
742 gi_marshalling_tests_long_inout_max_min (glong *long_)
744 g_assert_cmpint (*long_, ==, G_MAXLONG);
749 * gi_marshalling_tests_long_inout_min_max:
753 gi_marshalling_tests_long_inout_min_max (glong *long_)
755 g_assert_cmpint (*long_, ==, G_MINLONG);
761 gi_marshalling_tests_ulong_return (void)
767 gi_marshalling_tests_ulong_in (gulong ulong_)
769 g_assert_cmpuint (ulong_, ==, G_MAXULONG);
773 * gi_marshalling_tests_ulong_out:
777 gi_marshalling_tests_ulong_out (gulong *ulong_)
779 *ulong_ = G_MAXULONG;
783 * gi_marshalling_tests_ulong_inout:
787 gi_marshalling_tests_ulong_inout (gulong *ulong_)
789 g_assert_cmpuint (*ulong_, ==, G_MAXULONG);
795 gi_marshalling_tests_ssize_return_max (void)
801 gi_marshalling_tests_ssize_return_min (void)
807 gi_marshalling_tests_ssize_in_max (gssize ssize)
809 g_assert_cmpint (ssize, ==, G_MAXSSIZE);
813 gi_marshalling_tests_ssize_in_min (gssize ssize)
815 g_assert_cmpint (ssize, ==, G_MINSSIZE);
819 * gi_marshalling_tests_ssize_out_max:
823 gi_marshalling_tests_ssize_out_max (gssize *ssize)
829 * gi_marshalling_tests_ssize_out_min:
833 gi_marshalling_tests_ssize_out_min (gssize *ssize)
839 * gi_marshalling_tests_ssize_inout_max_min:
843 gi_marshalling_tests_ssize_inout_max_min (gssize *ssize)
845 g_assert_cmpint (*ssize, ==, G_MAXSSIZE);
850 * gi_marshalling_tests_ssize_inout_min_max:
854 gi_marshalling_tests_ssize_inout_min_max (gssize *ssize)
856 g_assert_cmpint (*ssize, ==, G_MINSSIZE);
862 gi_marshalling_tests_size_return (void)
868 gi_marshalling_tests_size_in (gsize size)
870 g_assert_cmpuint (size, ==, G_MAXSIZE);
874 * gi_marshalling_tests_size_out:
878 gi_marshalling_tests_size_out (gsize *size)
884 * gi_marshalling_tests_size_inout:
888 gi_marshalling_tests_size_inout (gsize *size)
890 g_assert_cmpuint (*size, ==, G_MAXSIZE);
896 gi_marshalling_tests_float_return (void)
902 gi_marshalling_tests_float_in (gfloat v)
904 g_assert_cmpfloat (v, ==, G_MAXFLOAT);
908 * gi_marshalling_tests_float_out:
912 gi_marshalling_tests_float_out (gfloat *v)
918 * gi_marshalling_tests_float_inout:
922 gi_marshalling_tests_float_inout (gfloat *v)
924 g_assert_cmpfloat (*v, ==, G_MAXFLOAT);
930 gi_marshalling_tests_double_return (void)
936 gi_marshalling_tests_double_in (gdouble v)
938 g_assert_cmpfloat (v, ==, G_MAXDOUBLE);
942 * gi_marshalling_tests_double_out:
946 gi_marshalling_tests_double_out (gdouble *v)
952 * gi_marshalling_tests_double_inout:
956 gi_marshalling_tests_double_inout (gdouble *v)
958 g_assert_cmpfloat (*v, ==, G_MAXDOUBLE);
964 gi_marshalling_tests_time_t_return (void)
970 gi_marshalling_tests_time_t_in (time_t v)
972 g_assert_cmpuint (v, ==, 1234567890);
976 * gi_marshalling_tests_time_t_out:
980 gi_marshalling_tests_time_t_out (time_t *v)
986 * gi_marshalling_tests_time_t_inout:
990 gi_marshalling_tests_time_t_inout (time_t *v)
992 g_assert_cmpuint (*v, ==, 1234567890);
998 gi_marshalling_tests_gtype_return (void)
1004 gi_marshalling_tests_gtype_string_return (void)
1006 return G_TYPE_STRING;
1010 gi_marshalling_tests_gtype_in (GType gtype)
1012 g_assert (gtype == G_TYPE_NONE);
1016 gi_marshalling_tests_gtype_string_in (GType gtype)
1018 g_assert (gtype == G_TYPE_STRING);
1023 * gi_marshalling_tests_gtype_out:
1027 gi_marshalling_tests_gtype_out (GType *gtype)
1029 *gtype = G_TYPE_NONE;
1033 * gi_marshalling_tests_gtype_string_out:
1037 gi_marshalling_tests_gtype_string_out (GType *gtype)
1039 *gtype = G_TYPE_STRING;
1043 * gi_marshalling_tests_gtype_inout:
1047 gi_marshalling_tests_gtype_inout (GType *gtype)
1049 g_assert (*gtype == G_TYPE_NONE);
1050 *gtype = G_TYPE_INT;
1055 gi_marshalling_tests_utf8_none_return (void)
1057 return GI_MARSHALLING_TESTS_CONSTANT_UTF8;
1061 gi_marshalling_tests_utf8_full_return (void)
1063 return g_strdup (GI_MARSHALLING_TESTS_CONSTANT_UTF8);
1067 gi_marshalling_tests_utf8_none_in (const gchar *utf8)
1069 g_assert_cmpstr (GI_MARSHALLING_TESTS_CONSTANT_UTF8, ==, utf8);
1073 * gi_marshalling_tests_utf8_as_uint8array_in:
1074 * @array: (array length=len) (element-type guint8): Byte data that happens to be UTF-8
1077 * Takes data that happens to be UTF-8 as a byte array, to test
1078 * binding conversion from their string type (e.g. JavaScript's
1082 gi_marshalling_tests_utf8_as_uint8array_in (const guint8 *array, gsize len)
1084 gsize orig_len = strlen (GI_MARSHALLING_TESTS_CONSTANT_UTF8);
1085 g_assert_cmpint (orig_len, ==, len);
1086 g_assert (memcmp (GI_MARSHALLING_TESTS_CONSTANT_UTF8, array, len) == 0);
1090 * gi_marshalling_tests_utf8_none_out:
1091 * @utf8: (out) (transfer none):
1094 gi_marshalling_tests_utf8_none_out (gchar **utf8)
1096 *utf8 = GI_MARSHALLING_TESTS_CONSTANT_UTF8;
1100 * gi_marshalling_tests_utf8_full_out:
1101 * @utf8: (out) (transfer full):
1104 gi_marshalling_tests_utf8_full_out (gchar **utf8)
1106 *utf8 = g_strdup (GI_MARSHALLING_TESTS_CONSTANT_UTF8);
1110 * gi_marshalling_tests_utf8_dangling_out:
1111 * @utf8: (out) (transfer full):
1114 gi_marshalling_tests_utf8_dangling_out (gchar **utf8)
1116 /* Intentionally don't touch the pointer to see how
1117 the bindings handle this case. Bindings should be
1118 robust against broken C functions and can initialize
1119 even OUT vlues to NULL.
1124 * gi_marshalling_tests_utf8_none_inout:
1125 * @utf8: (inout) (transfer none):
1128 gi_marshalling_tests_utf8_none_inout (gchar **utf8)
1130 g_assert_cmpstr (GI_MARSHALLING_TESTS_CONSTANT_UTF8, ==, *utf8);
1135 * gi_marshalling_tests_utf8_full_inout:
1136 * @utf8: (inout) (transfer full):
1139 gi_marshalling_tests_utf8_full_inout (gchar **utf8)
1141 g_assert_cmpstr (GI_MARSHALLING_TESTS_CONSTANT_UTF8, ==, *utf8);
1143 *utf8 = g_strdup ("");
1148 * gi_marshalling_tests_init_function:
1149 * @n_args: (inout) (allow-none): number of args
1150 * @argv: (inout) (array length=n_args) (allow-none): args
1152 * This is like gtk_init().
1155 gi_marshalling_tests_init_function (gint *n_args, char ***argv)
1163 g_assert (argv != NULL);
1164 /* we have transfer ownership full, so we need to free the element ourself */
1165 g_free ((*argv)[*n_args]);
1166 (*argv)[*n_args] = NULL;
1171 * gi_marshalling_tests_array_fixed_int_return:
1173 * Returns: (array fixed-size=4):
1176 gi_marshalling_tests_array_fixed_int_return (void)
1178 static gint ints[] = { -1, 0, 1, 2 };
1183 * gi_marshalling_tests_array_fixed_short_return:
1185 * Returns: (array fixed-size=4):
1188 gi_marshalling_tests_array_fixed_short_return (void)
1190 static gshort shorts[] = { -1, 0, 1, 2 };
1195 * gi_marshalling_tests_array_fixed_int_in:
1196 * @ints: (array fixed-size=4):
1199 gi_marshalling_tests_array_fixed_int_in (const gint *ints)
1201 g_assert_cmpint (ints[0], ==, -1);
1202 g_assert_cmpint (ints[1], ==, 0);
1203 g_assert_cmpint (ints[2], ==, 1);
1204 g_assert_cmpint (ints[3], ==, 2);
1208 * gi_marshalling_tests_array_fixed_short_in:
1209 * @shorts: (array fixed-size=4):
1212 gi_marshalling_tests_array_fixed_short_in (const gshort *shorts)
1214 g_assert_cmpint (shorts[0], ==, -1);
1215 g_assert_cmpint (shorts[1], ==, 0);
1216 g_assert_cmpint (shorts[2], ==, 1);
1217 g_assert_cmpint (shorts[3], ==, 2);
1221 * gi_marshalling_tests_array_fixed_out:
1222 * @ints: (out) (array fixed-size=4) (transfer none):
1225 gi_marshalling_tests_array_fixed_out (gint **ints)
1227 static gint values[] = { -1, 0, 1, 2 };
1232 * gi_marshalling_tests_array_fixed_out_struct:
1233 * @structs: (out) (array fixed-size=2) (transfer none):
1236 gi_marshalling_tests_array_fixed_out_struct (GIMarshallingTestsSimpleStruct **structs)
1238 static GIMarshallingTestsSimpleStruct *values;
1242 values = g_new (GIMarshallingTestsSimpleStruct, 2);
1244 values[0].long_ = 7;
1247 values[1].long_ = 6;
1255 * gi_marshalling_tests_array_fixed_inout:
1256 * @ints: (inout) (array fixed-size=4) (transfer none):
1259 gi_marshalling_tests_array_fixed_inout (gint **ints)
1261 static gint values[] = { 2, 1, 0, -1 };
1263 g_assert_cmpint ((*ints)[0], ==, -1);
1264 g_assert_cmpint ((*ints)[1], ==, 0);
1265 g_assert_cmpint ((*ints)[2], ==, 1);
1266 g_assert_cmpint ((*ints)[3], ==, 2);
1273 * gi_marshalling_tests_array_return:
1275 * Returns: (array length=length):
1278 gi_marshalling_tests_array_return (gint *length)
1280 static gint ints[] = { -1, 0, 1, 2 };
1287 * gi_marshalling_tests_array_return_etc:
1293 * Returns: (array length=length):
1296 gi_marshalling_tests_array_return_etc (gint first, gint *length, gint last, gint *sum)
1298 static gint ints[] = { -1, 0, 1, 2 };
1302 *sum = first + last;
1308 * gi_marshalling_tests_array_in:
1309 * @ints: (array length=length):
1313 gi_marshalling_tests_array_in (const gint *ints, gint length)
1315 g_assert_cmpint (length, ==, 4);
1316 g_assert_cmpint (ints[0], ==, -1);
1317 g_assert_cmpint (ints[1], ==, 0);
1318 g_assert_cmpint (ints[2], ==, 1);
1319 g_assert_cmpint (ints[3], ==, 2);
1323 * gi_marshalling_tests_array_in_len_before:
1325 * @ints: (array length=length):
1328 gi_marshalling_tests_array_in_len_before (gint length, const gint *ints)
1330 gi_marshalling_tests_array_in (ints, length);
1334 * gi_marshalling_tests_array_in_len_zero_terminated:
1335 * @ints: (array length=length zero-terminated):
1339 gi_marshalling_tests_array_in_len_zero_terminated (const gint *ints, gint length)
1341 g_assert_cmpint (length, ==, 4);
1343 g_assert_cmpint (ints[0], ==, -1);
1344 g_assert_cmpint (ints[1], ==, 0);
1345 g_assert_cmpint (ints[2], ==, 1);
1346 g_assert_cmpint (ints[3], ==, 2);
1348 /* One past the end, null terminator */
1349 g_assert_cmpint (ints[4], ==, 0);
1353 * gi_marshalling_tests_array_string_in:
1354 * @strings: (array length=length):
1357 gi_marshalling_tests_array_string_in (const gchar **strings, gint length)
1359 g_assert_cmpint (length, ==, 2);
1360 g_assert_cmpstr (strings[0], ==, "foo");
1361 g_assert_cmpstr (strings[1], ==, "bar");
1365 * gi_marshalling_tests_array_uint8_in:
1366 * @chars: (array length=length):
1369 gi_marshalling_tests_array_uint8_in (const guint8 *chars, gint length)
1371 g_assert_cmpint (length, ==, 4);
1372 g_assert (chars[0] == 'a');
1373 g_assert (chars[1] == 'b');
1374 g_assert (chars[2] == 'c');
1375 g_assert (chars[3] == 'd');
1379 * gi_marshalling_tests_array_struct_in:
1380 * @structs: (array length=length):
1383 gi_marshalling_tests_array_struct_in (GIMarshallingTestsBoxedStruct **structs, gint length)
1385 g_assert_cmpint (length, ==, 3);
1386 g_assert_cmpint (structs[0]->long_, ==, 1);
1387 g_assert_cmpint (structs[1]->long_, ==, 2);
1388 g_assert_cmpint (structs[2]->long_, ==, 3);
1392 * gi_marshalling_tests_array_struct_value_in:
1393 * @structs: (array length=length):
1396 gi_marshalling_tests_array_struct_value_in (GIMarshallingTestsBoxedStruct *structs, gint length)
1398 g_assert_cmpint (length, ==, 3);
1399 g_assert_cmpint (structs[0].long_, ==, 1);
1400 g_assert_cmpint (structs[1].long_, ==, 2);
1401 g_assert_cmpint (structs[2].long_, ==, 3);
1405 * gi_marshalling_tests_array_simple_struct_in:
1406 * @structs: (array length=length):
1409 gi_marshalling_tests_array_simple_struct_in (GIMarshallingTestsSimpleStruct *structs, gint length)
1411 g_assert_cmpint (length, ==, 3);
1412 g_assert_cmpint (structs[0].long_, ==, 1);
1413 g_assert_cmpint (structs[1].long_, ==, 2);
1414 g_assert_cmpint (structs[2].long_, ==, 3);
1418 * gi_marshalling_tests_multi_array_key_value_in:
1419 * @keys: (array length=length):
1420 * @values: (array length=length):
1423 gi_marshalling_tests_multi_array_key_value_in (gint length, const gchar **keys, const GValue *values)
1425 g_assert_cmpint (length, ==, 3);
1426 g_assert_cmpstr ("one", ==, keys[0]);
1427 g_assert_cmpint (g_value_get_int (&values[0]), ==, 1);
1428 g_assert_cmpstr ("two", ==, keys[1]);
1429 g_assert_cmpint (g_value_get_int (&values[1]), ==, 2);
1430 g_assert_cmpstr ("three", ==, keys[2]);
1431 g_assert_cmpint (g_value_get_int (&values[2]), ==, 3);
1436 * gi_marshalling_tests_array_struct_take_in:
1437 * @structs: (array length=length) (transfer full):
1440 gi_marshalling_tests_array_struct_take_in (GIMarshallingTestsBoxedStruct **structs, gint length)
1442 gi_marshalling_tests_array_struct_in (structs, length);
1444 /* only really useful if run in valgrind actually */
1445 gi_marshalling_tests_boxed_struct_free (structs[0]);
1446 gi_marshalling_tests_boxed_struct_free (structs[1]);
1447 gi_marshalling_tests_boxed_struct_free (structs[2]);
1452 * gi_marshalling_tests_array_enum_in:
1453 * @_enum: (array length=length) (transfer none):
1457 gi_marshalling_tests_array_enum_in (GIMarshallingTestsEnum *v, gint length)
1459 g_assert_cmpint (length, ==, 3);
1460 g_assert_cmpint (v[0], ==, GI_MARSHALLING_TESTS_ENUM_VALUE1);
1461 g_assert_cmpint (v[1], ==, GI_MARSHALLING_TESTS_ENUM_VALUE2);
1462 g_assert_cmpint (v[2], ==, GI_MARSHALLING_TESTS_ENUM_VALUE3);
1466 * gi_marshalling_tests_array_in_guint64_len:
1467 * @ints: (array length=length) (transfer none):
1471 gi_marshalling_tests_array_in_guint64_len (const gint *ints, guint64 length)
1473 g_assert_cmpint (length, ==, 4);
1475 gi_marshalling_tests_array_in (ints, length);
1479 * gi_marshalling_tests_array_in_guint8_len:
1480 * @ints: (array length=length) (transfer none):
1484 gi_marshalling_tests_array_in_guint8_len (const gint *ints, guint8 length)
1486 g_assert_cmpint (length, ==, 4);
1488 gi_marshalling_tests_array_in (ints, length);
1492 * gi_marshalling_tests_array_out:
1493 * @ints: (out) (array length=length) (transfer none):
1496 gi_marshalling_tests_array_out (gint **ints, gint *length)
1498 static gint values[] = { -1, 0, 1, 2 };
1505 * gi_marshalling_tests_array_out_etc:
1507 * @ints: (out) (array length=length) (transfer none):
1513 gi_marshalling_tests_array_out_etc (gint first, gint **ints, gint *length, gint last, gint *sum)
1515 static gint values[] = { -1, 0, 1, 2 };
1519 *sum = first + last;
1525 * gi_marshalling_tests_array_inout:
1526 * @ints: (inout) (array length=length) (transfer none):
1530 gi_marshalling_tests_array_inout (gint **ints, gint *length)
1532 static gint values[] = { -2, -1, 0, 1, 2 };
1534 g_assert_cmpint (*length, ==, 4);
1535 g_assert_cmpint ((*ints)[0], ==, -1);
1536 g_assert_cmpint ((*ints)[1], ==, 0);
1537 g_assert_cmpint ((*ints)[2], ==, 1);
1538 g_assert_cmpint ((*ints)[3], ==, 2);
1545 * gi_marshalling_tests_array_inout_etc:
1547 * @ints: (inout) (array length=length) (transfer none):
1553 gi_marshalling_tests_array_inout_etc (gint first, gint **ints, gint *length, gint last, gint *sum)
1555 static gint values[] = { -2, -1, 0, 1, 2 };
1557 g_assert_cmpint (*length, ==, 4);
1558 g_assert_cmpint ((*ints)[0], ==, -1);
1559 g_assert_cmpint ((*ints)[1], ==, 0);
1560 g_assert_cmpint ((*ints)[2], ==, 1);
1561 g_assert_cmpint ((*ints)[3], ==, 2);
1565 *sum = first + last;
1571 * gi_marshalling_tests_array_in_nonzero_nonlen:
1576 gi_marshalling_tests_array_in_nonzero_nonlen (gint first, const guint8 *chars)
1578 g_assert (chars[0] == 'a');
1579 g_assert (chars[1] == 'b');
1580 g_assert (chars[2] == 'c');
1581 g_assert (chars[3] == 'd');
1585 * gi_marshalling_tests_array_zero_terminated_return:
1587 * Returns: (array zero-terminated) (transfer none):
1590 gi_marshalling_tests_array_zero_terminated_return (void)
1592 static gchar *values[] = { "0", "1", "2", NULL };
1597 * gi_marshalling_tests_array_zero_terminated_return_null:
1599 * Returns: (array zero-terminated) (transfer none):
1602 gi_marshalling_tests_array_zero_terminated_return_null (void)
1608 * gi_marshalling_tests_array_zero_terminated_return_struct:
1610 * Returns: (array zero-terminated) (transfer full):
1612 GIMarshallingTestsBoxedStruct **
1613 gi_marshalling_tests_array_zero_terminated_return_struct (void)
1615 GIMarshallingTestsBoxedStruct **ret = (GIMarshallingTestsBoxedStruct **) g_new (gpointer, 4);
1617 ret[0] = gi_marshalling_tests_boxed_struct_new ();
1620 ret[1] = gi_marshalling_tests_boxed_struct_new ();
1623 ret[2] = gi_marshalling_tests_boxed_struct_new ();
1632 * gi_marshalling_tests_array_zero_terminated_in:
1633 * @utf8s: (array zero-terminated) (transfer none):
1636 gi_marshalling_tests_array_zero_terminated_in (gchar **utf8s)
1638 g_assert (g_strv_length (utf8s));
1639 g_assert_cmpstr (utf8s[0], ==, "0");
1640 g_assert_cmpstr (utf8s[1], ==, "1");
1641 g_assert_cmpstr (utf8s[2], ==, "2");
1645 * gi_marshalling_tests_array_zero_terminated_out:
1646 * @utf8s: (out) (array zero-terminated) (transfer none):
1649 gi_marshalling_tests_array_zero_terminated_out (gchar *** utf8s)
1651 static gchar *values[] = { "0", "1", "2", NULL };
1656 * gi_marshalling_tests_array_zero_terminated_inout:
1657 * @utf8s: (inout) (array zero-terminated) (transfer none):
1660 gi_marshalling_tests_array_zero_terminated_inout (gchar *** utf8s)
1662 static gchar *values[] = { "-1", "0", "1", "2", NULL };
1664 g_assert (g_strv_length (*utf8s));
1665 g_assert_cmpstr ((*utf8s)[0], ==, "0");
1666 g_assert_cmpstr ((*utf8s)[1], ==, "1");
1667 g_assert_cmpstr ((*utf8s)[2], ==, "2");
1673 * gi_marshalling_tests_array_gvariant_none_in:
1674 * @variants: (array zero-terminated) (transfer none):
1676 * Returns: (array zero-terminated) (transfer none):
1679 gi_marshalling_tests_array_gvariant_none_in (GVariant **variants)
1681 /* Use a static container to detect if someone tries to free it */
1682 static GVariant *private_container[3] = { NULL, NULL, NULL };
1684 if (private_container[0] == NULL)
1686 private_container[0] = g_variant_new_int32 (27);
1687 private_container[1] = g_variant_new_string ("Hello");
1690 g_assert (variants != NULL);
1691 g_assert_cmpint (g_variant_get_int32 (variants[0]), ==, 27);
1692 g_assert_cmpstr (g_variant_get_string (variants[1], NULL), ==, "Hello");
1693 g_assert (variants[2] == NULL);
1695 return private_container;
1699 * gi_marshalling_tests_array_gvariant_container_in:
1700 * @variants: (array zero-terminated) (transfer container):
1702 * Returns: (array zero-terminated) (transfer container):
1705 gi_marshalling_tests_array_gvariant_container_in (GVariant **variants)
1707 GVariant **container;
1709 g_assert (variants != NULL);
1710 g_assert_cmpint (g_variant_get_int32 (variants[0]), ==, 27);
1711 g_assert_cmpstr (g_variant_get_string (variants[1], NULL), ==, "Hello");
1712 g_assert (variants[2] == NULL);
1714 container = g_new0 (GVariant *, 3);
1715 container[0] = variants[0];
1716 container[1] = variants[1];
1723 * gi_marshalling_tests_array_gvariant_full_in:
1724 * @variants: (array zero-terminated) (transfer full):
1726 * Returns: (array zero-terminated) (transfer full):
1729 gi_marshalling_tests_array_gvariant_full_in (GVariant **variants)
1731 GVariant **container;
1733 g_assert (variants != NULL);
1734 g_assert_cmpint (g_variant_get_int32 (variants[0]), ==, 27);
1735 g_assert_cmpstr (g_variant_get_string (variants[1], NULL), ==, "Hello");
1736 g_assert (variants[2] == NULL);
1738 /* To catch different behaviors we reconstruct one variant from scratch,
1739 * while leaving the other untouched. Both approaches are legal with full
1740 * transfer in and out */
1741 container = g_new0 (GVariant *, 3);
1742 container[0] = g_variant_new_int32 (g_variant_get_int32 (variants[0]));
1743 g_variant_unref (variants[0]);
1744 container[1] = variants[1];
1751 * gi_marshalling_tests_garray_int_none_return:
1753 * Returns: (element-type gint) (transfer none):
1756 gi_marshalling_tests_garray_int_none_return (void)
1758 static GArray *v = NULL;
1763 v = g_array_new (TRUE, TRUE, sizeof (gint));
1764 for (i = -1; i < 3; i++)
1765 g_array_append_val (v, i);
1772 * gi_marshalling_tests_garray_uint64_none_return:
1774 * Returns: (element-type guint64) (transfer none):
1777 gi_marshalling_tests_garray_uint64_none_return (void)
1779 static GArray *array = NULL;
1784 array = g_array_new (TRUE, TRUE, sizeof (guint64));
1786 g_array_append_val (array, i);
1788 g_array_append_val (array, i);
1795 * gi_marshalling_tests_garray_utf8_none_return:
1797 * Returns: (element-type utf8) (transfer none):
1800 gi_marshalling_tests_garray_utf8_none_return (void)
1802 static GArray *array = NULL;
1803 static gchar *values[] = { "0", "1", "2", NULL };
1808 array = g_array_new (TRUE, TRUE, sizeof (gchar *));
1809 for (i = 0; values[i]; i++)
1810 g_array_append_val (array, values[i]);
1817 * gi_marshalling_tests_garray_utf8_container_return:
1819 * Returns: (element-type utf8) (transfer container):
1822 gi_marshalling_tests_garray_utf8_container_return (void)
1824 GArray *array = NULL;
1825 static gchar *values[] = { "0", "1", "2", NULL };
1828 array = g_array_new (TRUE, TRUE, sizeof (gchar *));
1829 for (i = 0; values[i]; i++)
1830 g_array_append_val (array, values[i]);
1836 * gi_marshalling_tests_garray_utf8_full_return:
1838 * Returns: (element-type utf8) (transfer full):
1841 gi_marshalling_tests_garray_utf8_full_return (void)
1843 GArray *array = NULL;
1844 static gchar *values[] = { "0", "1", "2", NULL };
1847 array = g_array_new (TRUE, TRUE, sizeof (gchar *));
1848 for (i = 0; values[i]; i++)
1850 gchar *str = g_strdup (values[i]);
1851 g_array_append_val (array, str);
1858 * gi_marshalling_tests_garray_int_none_in:
1859 * @array_: (element-type gint) (transfer none):
1862 gi_marshalling_tests_garray_int_none_in (GArray *array_)
1864 g_assert_cmpint (array_->len, ==, 4);
1865 g_assert_cmpint (g_array_index (array_, gint, 0), ==, -1);
1866 g_assert_cmpint (g_array_index (array_, gint, 1), ==, 0);
1867 g_assert_cmpint (g_array_index (array_, gint, 2), ==, 1);
1868 g_assert_cmpint (g_array_index (array_, gint, 3), ==, 2);
1872 * gi_marshalling_tests_garray_uint64_none_in:
1873 * @array_: (element-type guint64) (transfer none):
1876 gi_marshalling_tests_garray_uint64_none_in (GArray *array_)
1878 g_assert_cmpint (array_->len, ==, 2);
1879 g_assert_cmpint (g_array_index (array_, guint64, 0), ==, 0);
1880 g_assert_cmpint (g_array_index (array_, guint64, 1), ==, G_MAXUINT64);
1884 * gi_marshalling_tests_garray_utf8_none_in:
1885 * @array_: (element-type utf8) (transfer none):
1888 gi_marshalling_tests_garray_utf8_none_in (GArray *array_)
1890 g_assert_cmpint (array_->len, ==, 3);
1891 g_assert_cmpstr (g_array_index (array_, gchar *, 0), ==, "0");
1892 g_assert_cmpstr (g_array_index (array_, gchar *, 1), ==, "1");
1893 g_assert_cmpstr (g_array_index (array_, gchar *, 2), ==, "2");
1897 * gi_marshalling_tests_garray_utf8_none_out:
1898 * @array_: (out) (element-type utf8) (transfer none):
1901 gi_marshalling_tests_garray_utf8_none_out (GArray **array_)
1903 static GArray *internal = NULL;
1904 static gchar *values[] = { "0", "1", "2", NULL };
1907 if (internal == NULL)
1909 internal = g_array_new (TRUE, TRUE, sizeof (gchar *));
1910 for (i = 0; values[i]; i++)
1911 g_array_append_val (internal, values[i]);
1918 * gi_marshalling_tests_garray_utf8_container_out:
1919 * @array_: (out) (element-type utf8) (transfer container):
1922 gi_marshalling_tests_garray_utf8_container_out (GArray **array_)
1924 static gchar *values[] = { "0", "1", "2", NULL };
1929 *array_ = g_array_new (TRUE, TRUE, sizeof (gchar *));
1930 for (i = 0; values[i]; i++)
1931 g_array_append_val (*array_, values[i]);
1935 * gi_marshalling_tests_garray_utf8_full_out:
1936 * @array_: (out) (element-type utf8) (transfer full):
1939 gi_marshalling_tests_garray_utf8_full_out (GArray **array_)
1941 static gchar *values[] = { "0", "1", "2", NULL };
1946 *array_ = g_array_new (TRUE, TRUE, sizeof (gchar *));
1947 for (i = 0; values[i]; i++)
1949 gchar *str = g_strdup (values[i]);
1950 g_array_append_val (*array_, str);
1955 * gi_marshalling_tests_garray_utf8_full_out_caller_allocated:
1956 * @array_: (out caller-allocates) (array) (element-type utf8) (transfer full):
1959 gi_marshalling_tests_garray_utf8_full_out_caller_allocated (GArray *array_)
1961 static gchar *values[] = { "0", "1", "2", NULL };
1964 g_array_set_size (array_, 0);
1965 for (i = 0; values[i]; i++)
1967 gchar *str = g_strdup (values[i]);
1968 g_array_append_val (array_, str);
1973 * gi_marshalling_tests_garray_utf8_none_inout:
1974 * @array_: (inout) (element-type utf8) (transfer none):
1977 gi_marshalling_tests_garray_utf8_none_inout (GArray **array_)
1979 static GArray *internal = NULL;
1980 static gchar *values[] = { "-2", "-1", "0", "1", NULL };
1983 g_assert_cmpint ((*array_)->len, ==, 3);
1984 g_assert_cmpstr (g_array_index (*array_, gchar *, 0), ==, "0");
1985 g_assert_cmpstr (g_array_index (*array_, gchar *, 1), ==, "1");
1986 g_assert_cmpstr (g_array_index (*array_, gchar *, 2), ==, "2");
1988 if (internal == NULL)
1990 internal = g_array_new (TRUE, TRUE, sizeof (gchar *));
1991 for (i = 0; values[i]; i++)
1992 g_array_append_val (internal, values[i]);
1999 * gi_marshalling_tests_garray_utf8_container_inout:
2000 * @array_: (inout) (element-type utf8) (transfer container):
2003 gi_marshalling_tests_garray_utf8_container_inout (GArray **array_)
2005 static gchar *val1 = "-2";
2006 static gchar *val2 = "-1";
2007 static gchar *val3 = "0";
2008 static gchar *val4 = "1";
2011 g_assert_cmpint ((*array_)->len, ==, 3);
2012 g_assert_cmpstr (g_array_index (*array_, gchar *, 0), ==, "0");
2013 g_assert_cmpstr (g_array_index (*array_, gchar *, 1), ==, "1");
2014 g_assert_cmpstr (g_array_index (*array_, gchar *, 2), ==, "2");
2016 result = g_array_new (TRUE, TRUE, sizeof (gchar *));
2017 g_array_append_val (result, val1);
2018 g_array_append_val (result, val2);
2019 g_array_append_val (result, val3);
2020 g_array_append_val (result, val4);
2022 g_array_unref (*array_);
2027 * gi_marshalling_tests_garray_utf8_full_inout:
2028 * @array_: (inout) (element-type utf8) (transfer full):
2031 gi_marshalling_tests_garray_utf8_full_inout (GArray **array_)
2033 static gchar *val1 = "-1";
2034 static gchar *val2 = "-2";
2038 g_assert_cmpint ((*array_)->len, ==, 3);
2039 g_assert_cmpstr (g_array_index (*array_, gchar *, 0), ==, "0");
2040 g_assert_cmpstr (g_array_index (*array_, gchar *, 1), ==, "1");
2041 g_assert_cmpstr (g_array_index (*array_, gchar *, 2), ==, "2");
2043 result = g_array_new (TRUE, TRUE, sizeof (gchar *));
2044 val = g_strdup (val2);
2045 g_array_append_val (result, val);
2046 val = g_strdup (val1);
2047 g_array_append_val (result, val);
2048 val = g_strdup ("0");
2049 g_array_append_val (result, val);
2050 val = g_strdup ("1");
2051 g_array_append_val (result, val);
2053 g_array_unref (*array_);
2058 * gi_marshalling_tests_gptrarray_utf8_none_return:
2060 * Returns: (element-type utf8) (transfer none):
2063 gi_marshalling_tests_gptrarray_utf8_none_return (void)
2065 static GPtrArray *parray = NULL;
2066 static gchar *values[] = { "0", "1", "2" };
2071 parray = g_ptr_array_new ();
2072 for (i = 0; i < 3; i++)
2073 g_ptr_array_add (parray, (gpointer) values[i]);
2080 * gi_marshalling_tests_gptrarray_utf8_container_return:
2082 * Returns: (element-type utf8) (transfer container):
2085 gi_marshalling_tests_gptrarray_utf8_container_return (void)
2087 GPtrArray *parray = NULL;
2088 static gchar *values[] = { "0", "1", "2", NULL };
2091 parray = g_ptr_array_new ();
2092 for (i = 0; values[i]; i++)
2093 g_ptr_array_add (parray, (gpointer) values[i]);
2099 * gi_marshalling_tests_gptrarray_utf8_full_return:
2101 * Returns: (element-type utf8) (transfer full):
2104 gi_marshalling_tests_gptrarray_utf8_full_return (void)
2106 GPtrArray *parray = NULL;
2107 static gchar *values[] = { "0", "1", "2", NULL };
2110 parray = g_ptr_array_new ();
2111 for (i = 0; values[i]; i++)
2113 gchar *str = g_strdup (values[i]);
2114 g_ptr_array_add (parray, (gpointer) str);
2121 * gi_marshalling_tests_gptrarray_utf8_none_in:
2122 * @parray_: (element-type utf8) (transfer none):
2125 gi_marshalling_tests_gptrarray_utf8_none_in (GPtrArray *parray_)
2127 g_assert_cmpint (parray_->len, ==, 3);
2128 g_assert_cmpstr (g_ptr_array_index (parray_, 0), ==, "0");
2129 g_assert_cmpstr (g_ptr_array_index (parray_, 1), ==, "1");
2130 g_assert_cmpstr (g_ptr_array_index (parray_, 2), ==, "2");
2134 * gi_marshalling_tests_gptrarray_utf8_none_out:
2135 * @parray_: (out) (element-type utf8) (transfer none):
2138 gi_marshalling_tests_gptrarray_utf8_none_out (GPtrArray **parray_)
2140 static GPtrArray *internal = NULL;
2141 static gchar *values[] = { "0", "1", "2", NULL };
2144 if (internal == NULL)
2146 internal = g_ptr_array_new ();
2147 for (i = 0; values[i]; i++)
2148 g_ptr_array_add (internal, (gpointer) values[i]);
2151 *parray_ = internal;
2155 * gi_marshalling_tests_gptrarray_utf8_container_out:
2156 * @parray_: (out) (element-type utf8) (transfer container):
2159 gi_marshalling_tests_gptrarray_utf8_container_out (GPtrArray **parray_)
2161 static gchar *values[] = { "0", "1", "2", NULL };
2166 *parray_ = g_ptr_array_new ();
2167 for (i = 0; values[i]; i++)
2168 g_ptr_array_add (*parray_, (gpointer) values[i]);
2172 * gi_marshalling_tests_gptrarray_utf8_full_out:
2173 * @parray_: (out) (element-type utf8) (transfer full):
2176 gi_marshalling_tests_gptrarray_utf8_full_out (GPtrArray **parray_)
2178 static gchar *values[] = { "0", "1", "2", NULL };
2183 *parray_ = g_ptr_array_new ();
2184 for (i = 0; values[i]; i++)
2186 gchar *str = g_strdup (values[i]);
2187 g_ptr_array_add (*parray_, (gpointer) str);
2192 * gi_marshalling_tests_gptrarray_utf8_none_inout:
2193 * @parray_: (inout) (element-type utf8) (transfer none):
2196 gi_marshalling_tests_gptrarray_utf8_none_inout (GPtrArray **parray_)
2198 static GPtrArray *internal = NULL;
2199 static gchar *values[] = { "-2", "-1", "0", "1", NULL };
2202 g_assert_cmpint ((*parray_)->len, ==, 3);
2203 g_assert_cmpstr (g_ptr_array_index (*parray_, 0), ==, "0");
2204 g_assert_cmpstr (g_ptr_array_index (*parray_, 1), ==, "1");
2205 g_assert_cmpstr (g_ptr_array_index (*parray_, 2), ==, "2");
2207 if (internal == NULL)
2209 internal = g_ptr_array_new ();
2210 for (i = 0; values[i]; i++)
2211 g_ptr_array_add (internal, (gpointer) values[i]);
2214 *parray_ = internal;
2218 * gi_marshalling_tests_gptrarray_utf8_container_inout:
2219 * @parray_: (inout) (element-type utf8) (transfer container):
2222 gi_marshalling_tests_gptrarray_utf8_container_inout (GPtrArray **parray_)
2224 static gchar *val1 = "-2";
2225 static gchar *val2 = "-1";
2226 static gchar *val3 = "0";
2227 static gchar *val4 = "1";
2230 g_assert_cmpint ((*parray_)->len, ==, 3);
2231 g_assert_cmpstr (g_ptr_array_index (*parray_, 0), ==, "0");
2232 g_assert_cmpstr (g_ptr_array_index (*parray_, 1), ==, "1");
2233 g_assert_cmpstr (g_ptr_array_index (*parray_, 2), ==, "2");
2235 result = g_ptr_array_new ();
2236 g_ptr_array_add (result, (gpointer) val1);
2237 g_ptr_array_add (result, (gpointer) val2);
2238 g_ptr_array_add (result, (gpointer) val3);
2239 g_ptr_array_add (result, (gpointer) val4);
2241 g_ptr_array_unref (*parray_);
2246 * gi_marshalling_tests_gptrarray_utf8_full_inout:
2247 * @parray_: (inout) (element-type utf8) (transfer full):
2250 gi_marshalling_tests_gptrarray_utf8_full_inout (GPtrArray **parray_)
2252 static gchar *val1 = "-1";
2253 static gchar *val2 = "-2";
2257 g_assert_cmpint ((*parray_)->len, ==, 3);
2258 g_assert_cmpstr (g_ptr_array_index (*parray_, 0), ==, "0");
2259 g_assert_cmpstr (g_ptr_array_index (*parray_, 1), ==, "1");
2260 g_assert_cmpstr (g_ptr_array_index (*parray_, 2), ==, "2");
2262 result = g_ptr_array_new ();
2263 val = g_strdup (val2);
2264 g_ptr_array_add (result, (gpointer) val);
2265 val = g_strdup (val1);
2266 g_ptr_array_add (result, (gpointer) val);
2267 val = g_strdup ("0");
2268 g_ptr_array_add (result, (gpointer) val);
2269 val = g_strdup ("1");
2270 g_ptr_array_add (result, (gpointer) val);
2272 g_ptr_array_unref (*parray_);
2277 * gi_marshalling_tests_bytearray_full_return:
2279 * Returns: (transfer full):
2282 gi_marshalling_tests_bytearray_full_return (void)
2284 GByteArray *array = NULL;
2285 guint8 data[] = { '\0', '1', '\xFF', '3' };
2287 array = g_byte_array_new ();
2288 g_byte_array_append (array, (const guint8 *) data, G_N_ELEMENTS (data));
2295 * gi_marshalling_tests_bytearray_none_in:
2296 * @v: (element-type gint8) (transfer none):
2299 gi_marshalling_tests_bytearray_none_in (GByteArray *v)
2301 g_assert_cmpuint (v->len, ==, 4);
2302 g_assert_cmpuint (g_array_index (v, unsigned char, 0), ==, 0);
2303 g_assert_cmpuint (g_array_index (v, unsigned char, 1), ==, 49);
2304 g_assert_cmpuint (g_array_index (v, unsigned char, 2), ==, 0xFF);
2305 g_assert_cmpuint (g_array_index (v, unsigned char, 3), ==, 51);
2309 * gi_marshalling_tests_gbytes_full_return:
2311 * Returns: (transfer full):
2314 gi_marshalling_tests_gbytes_full_return (void)
2316 static guint8 data[] = { 0, 49, 0xFF, 51 };
2318 return g_bytes_new_static (data, G_N_ELEMENTS (data));
2322 * gi_marshalling_tests_gbytes_none_in:
2325 gi_marshalling_tests_gbytes_none_in (GBytes *v)
2329 data = g_bytes_get_data (v, &len);
2331 g_assert_cmpuint (len, ==, 4);
2332 g_assert_cmpuint (data[0], ==, 0);
2333 g_assert_cmpuint (data[1], ==, 49);
2334 g_assert_cmpuint (data[2], ==, 0xFF);
2335 g_assert_cmpuint (data[3], ==, 51);
2339 * gi_marshalling_tests_gstrv_return:
2341 * Returns: (transfer full): an array of strings
2344 gi_marshalling_tests_gstrv_return (void)
2346 GStrv values = g_new0 (gchar *, 4);
2347 values[0] = g_strdup ("0");
2348 values[1] = g_strdup ("1");
2349 values[2] = g_strdup ("2");
2355 * gi_marshalling_tests_gstrv_in:
2359 gi_marshalling_tests_gstrv_in (GStrv g_strv)
2361 g_assert_cmpint (g_strv_length (g_strv), ==, 3);
2362 g_assert_cmpstr (g_strv[0], ==, "0");
2363 g_assert_cmpstr (g_strv[1], ==, "1");
2364 g_assert_cmpstr (g_strv[2], ==, "2");
2368 * gi_marshalling_tests_gstrv_out:
2369 * @g_strv: (out) (transfer none):
2372 gi_marshalling_tests_gstrv_out (GStrv *g_strv)
2374 static gchar *values[] = { "0", "1", "2", NULL };
2379 * gi_marshalling_tests_gstrv_inout:
2380 * @g_strv: (inout) (transfer none):
2383 gi_marshalling_tests_gstrv_inout (GStrv *g_strv)
2385 static gchar *values[] = { "-1", "0", "1", "2", NULL };
2387 g_assert (g_strv_length (*g_strv) == 3);
2388 g_assert (strcmp ((*g_strv)[0], "0") == 0);
2389 g_assert (strcmp ((*g_strv)[1], "1") == 0);
2390 g_assert (strcmp ((*g_strv)[2], "2") == 0);
2396 * gi_marshalling_tests_glist_int_none_return:
2398 * Returns: (element-type gint) (transfer none):
2401 gi_marshalling_tests_glist_int_none_return (void)
2403 static GList *list = NULL;
2407 list = g_list_append (list, GINT_TO_POINTER (-1));
2408 list = g_list_append (list, GINT_TO_POINTER (0));
2409 list = g_list_append (list, GINT_TO_POINTER (1));
2410 list = g_list_append (list, GINT_TO_POINTER (2));
2417 * gi_marshalling_tests_glist_uint32_none_return:
2419 * Returns: (element-type guint32) (transfer none):
2422 gi_marshalling_tests_glist_uint32_none_return (void)
2424 static GList *list = NULL;
2428 list = g_list_append (list, GUINT_TO_POINTER (0));
2429 list = g_list_append (list, GUINT_TO_POINTER (G_MAXUINT32));
2436 * gi_marshalling_tests_glist_utf8_none_return:
2438 * Returns: (element-type utf8) (transfer none):
2441 gi_marshalling_tests_glist_utf8_none_return (void)
2443 static GList *list = NULL;
2447 list = g_list_append (list, "0");
2448 list = g_list_append (list, "1");
2449 list = g_list_append (list, "2");
2456 * gi_marshalling_tests_glist_utf8_container_return:
2458 * Returns: (element-type utf8) (transfer container):
2461 gi_marshalling_tests_glist_utf8_container_return (void)
2465 list = g_list_append (list, "0");
2466 list = g_list_append (list, "1");
2467 list = g_list_append (list, "2");
2473 * gi_marshalling_tests_glist_utf8_full_return:
2475 * Returns: (element-type utf8) (transfer full):
2478 gi_marshalling_tests_glist_utf8_full_return (void)
2482 list = g_list_append (list, g_strdup ("0"));
2483 list = g_list_append (list, g_strdup ("1"));
2484 list = g_list_append (list, g_strdup ("2"));
2490 * gi_marshalling_tests_glist_int_none_in:
2491 * @list: (element-type gint) (transfer none):
2494 gi_marshalling_tests_glist_int_none_in (GList *list)
2496 g_assert_cmpint (g_list_length (list), ==, 4);
2497 g_assert_cmpint (GPOINTER_TO_INT (g_list_nth_data (list, 0)), ==, -1);
2498 g_assert_cmpint (GPOINTER_TO_INT (g_list_nth_data (list, 1)), ==, 0);
2499 g_assert_cmpint (GPOINTER_TO_INT (g_list_nth_data (list, 2)), ==, 1);
2500 g_assert_cmpint (GPOINTER_TO_INT (g_list_nth_data (list, 3)), ==, 2);
2504 * gi_marshalling_tests_glist_uint32_none_in:
2505 * @list: (element-type guint32) (transfer none):
2508 gi_marshalling_tests_glist_uint32_none_in (GList *list)
2510 g_assert_cmpint (g_list_length (list), ==, 2);
2511 g_assert_cmpint (GPOINTER_TO_UINT (g_list_nth_data (list, 0)), ==, 0);
2512 g_assert_cmpint (GPOINTER_TO_UINT (g_list_nth_data (list, 1)), ==, G_MAXUINT32);
2516 * gi_marshalling_tests_glist_utf8_none_in:
2517 * @list: (element-type utf8) (transfer none):
2520 gi_marshalling_tests_glist_utf8_none_in (GList *list)
2522 g_assert_cmpint (g_list_length (list), ==, 3);
2523 g_assert_cmpint (strcmp (g_list_nth_data (list, 0), "0"), ==, 0);
2524 g_assert_cmpint (strcmp (g_list_nth_data (list, 1), "1"), ==, 0);
2525 g_assert_cmpint (strcmp (g_list_nth_data (list, 2), "2"), ==, 0);
2529 * gi_marshalling_tests_glist_utf8_none_out:
2530 * @list: (out) (element-type utf8) (transfer none):
2533 gi_marshalling_tests_glist_utf8_none_out (GList **list)
2535 static GList *values = NULL;
2539 values = g_list_append (values, "0");
2540 values = g_list_append (values, "1");
2541 values = g_list_append (values, "2");
2548 * gi_marshalling_tests_glist_utf8_container_out:
2549 * @list: (out) (element-type utf8) (transfer container):
2552 gi_marshalling_tests_glist_utf8_container_out (GList **list)
2556 *list = g_list_append (*list, "0");
2557 *list = g_list_append (*list, "1");
2558 *list = g_list_append (*list, "2");
2562 * gi_marshalling_tests_glist_utf8_full_out:
2563 * @list: (out) (element-type utf8) (transfer full):
2566 gi_marshalling_tests_glist_utf8_full_out (GList **list)
2570 *list = g_list_append (*list, g_strdup ("0"));
2571 *list = g_list_append (*list, g_strdup ("1"));
2572 *list = g_list_append (*list, g_strdup ("2"));
2576 * gi_marshalling_tests_glist_utf8_none_inout:
2577 * @list: (inout) (element-type utf8) (transfer none):
2580 gi_marshalling_tests_glist_utf8_none_inout (GList **list)
2582 static GList *values = NULL;
2584 g_assert_cmpint (g_list_length (*list), ==, 3);
2585 g_assert_cmpstr (g_list_nth_data (*list, 0), ==, "0");
2586 g_assert_cmpstr (g_list_nth_data (*list, 1), ==, "1");
2587 g_assert_cmpstr (g_list_nth_data (*list, 2), ==, "2");
2591 values = g_list_append (values, "-2");
2592 values = g_list_append (values, "-1");
2593 values = g_list_append (values, "0");
2594 values = g_list_append (values, "1");
2601 * gi_marshalling_tests_glist_utf8_container_inout:
2602 * @list: (inout) (element-type utf8) (transfer container):
2605 gi_marshalling_tests_glist_utf8_container_inout (GList **list)
2607 GList *result = NULL;
2609 g_assert_cmpint (g_list_length (*list), ==, 3);
2610 g_assert_cmpstr (g_list_nth_data (*list, 0), ==, "0");
2611 g_assert_cmpstr (g_list_nth_data (*list, 1), ==, "1");
2612 g_assert_cmpstr (g_list_nth_data (*list, 2), ==, "2");
2614 result = g_list_prepend (result, "1");
2615 result = g_list_prepend (result, "0");
2616 result = g_list_prepend (result, "-1");
2617 result = g_list_prepend (result, "-2");
2619 g_list_free (*list);
2624 * gi_marshalling_tests_glist_utf8_full_inout:
2625 * @list: (inout) (element-type utf8) (transfer full):
2628 gi_marshalling_tests_glist_utf8_full_inout (GList **list)
2630 GList *result = NULL;
2632 g_assert_cmpint (g_list_length (*list), ==, 3);
2633 g_assert_cmpstr (g_list_nth_data (*list, 0), ==, "0");
2634 g_assert_cmpstr (g_list_nth_data (*list, 1), ==, "1");
2635 g_assert_cmpstr (g_list_nth_data (*list, 2), ==, "2");
2637 result = g_list_prepend (result, g_strdup ("1"));
2638 result = g_list_prepend (result, g_strdup ("0"));
2639 result = g_list_prepend (result, g_strdup ("-1"));
2640 result = g_list_prepend (result, g_strdup ("-2"));
2642 g_list_free_full (*list, g_free);
2648 * gi_marshalling_tests_gslist_int_none_return:
2650 * Returns: (element-type gint) (transfer none):
2653 gi_marshalling_tests_gslist_int_none_return (void)
2655 static GSList *list = NULL;
2659 list = g_slist_prepend (list, GINT_TO_POINTER (-1));
2660 list = g_slist_prepend (list, GINT_TO_POINTER (0));
2661 list = g_slist_prepend (list, GINT_TO_POINTER (1));
2662 list = g_slist_prepend (list, GINT_TO_POINTER (2));
2663 list = g_slist_reverse (list);
2670 * gi_marshalling_tests_gslist_utf8_none_return:
2672 * Returns: (element-type utf8) (transfer none):
2675 gi_marshalling_tests_gslist_utf8_none_return (void)
2677 static GSList *list = NULL;
2681 list = g_slist_prepend (list, "0");
2682 list = g_slist_prepend (list, "1");
2683 list = g_slist_prepend (list, "2");
2684 list = g_slist_reverse (list);
2691 * gi_marshalling_tests_gslist_utf8_container_return:
2693 * Returns: (element-type utf8) (transfer container):
2696 gi_marshalling_tests_gslist_utf8_container_return (void)
2698 GSList *list = NULL;
2700 list = g_slist_prepend (list, "0");
2701 list = g_slist_prepend (list, "1");
2702 list = g_slist_prepend (list, "2");
2703 list = g_slist_reverse (list);
2709 * gi_marshalling_tests_gslist_utf8_full_return:
2711 * Returns: (element-type utf8) (transfer full):
2714 gi_marshalling_tests_gslist_utf8_full_return (void)
2716 GSList *list = NULL;
2718 list = g_slist_prepend (list, g_strdup ("0"));
2719 list = g_slist_prepend (list, g_strdup ("1"));
2720 list = g_slist_prepend (list, g_strdup ("2"));
2721 list = g_slist_reverse (list);
2727 * gi_marshalling_tests_gslist_int_none_in:
2728 * @list: (element-type gint) (transfer none):
2731 gi_marshalling_tests_gslist_int_none_in (GSList *list)
2733 g_assert_cmpint (g_slist_length (list), ==, 4);
2734 g_assert_cmpint (GPOINTER_TO_INT (g_slist_nth_data (list, 0)), ==, -1);
2735 g_assert_cmpint (GPOINTER_TO_INT (g_slist_nth_data (list, 1)), ==, 0);
2736 g_assert_cmpint (GPOINTER_TO_INT (g_slist_nth_data (list, 2)), ==, 1);
2737 g_assert_cmpint (GPOINTER_TO_INT (g_slist_nth_data (list, 3)), ==, 2);
2741 * gi_marshalling_tests_gslist_utf8_none_in:
2742 * @list: (element-type utf8) (transfer none):
2745 gi_marshalling_tests_gslist_utf8_none_in (GSList *list)
2747 g_assert_cmpint (g_slist_length (list), ==, 3);
2748 g_assert_cmpstr (g_slist_nth_data (list, 0), ==, "0");
2749 g_assert_cmpstr (g_slist_nth_data (list, 1), ==, "1");
2750 g_assert_cmpstr (g_slist_nth_data (list, 2), ==, "2");
2754 * gi_marshalling_tests_gslist_utf8_none_out:
2755 * @list: (out) (element-type utf8) (transfer none):
2758 gi_marshalling_tests_gslist_utf8_none_out (GSList **list)
2760 static GSList *values = NULL;
2764 values = g_slist_prepend (values, "0");
2765 values = g_slist_prepend (values, "1");
2766 values = g_slist_prepend (values, "2");
2767 values = g_slist_reverse (values);
2774 * gi_marshalling_tests_gslist_utf8_container_out:
2775 * @list: (out) (element-type utf8) (transfer container):
2778 gi_marshalling_tests_gslist_utf8_container_out (GSList **list)
2782 *list = g_slist_prepend (*list, "0");
2783 *list = g_slist_prepend (*list, "1");
2784 *list = g_slist_prepend (*list, "2");
2785 *list = g_slist_reverse (*list);
2789 * gi_marshalling_tests_gslist_utf8_full_out:
2790 * @list: (out) (element-type utf8) (transfer full):
2793 gi_marshalling_tests_gslist_utf8_full_out (GSList **list)
2797 *list = g_slist_prepend (*list, g_strdup ("0"));
2798 *list = g_slist_prepend (*list, g_strdup ("1"));
2799 *list = g_slist_prepend (*list, g_strdup ("2"));
2800 *list = g_slist_reverse (*list);
2804 * gi_marshalling_tests_gslist_utf8_none_inout:
2805 * @list: (inout) (element-type utf8) (transfer none):
2808 gi_marshalling_tests_gslist_utf8_none_inout (GSList **list)
2810 static GSList *values = NULL;
2812 g_assert_cmpint (g_slist_length (*list), ==, 3);
2813 g_assert_cmpstr (g_slist_nth_data (*list, 0), ==, "0");
2814 g_assert_cmpstr (g_slist_nth_data (*list, 1), ==, "1");
2815 g_assert_cmpstr (g_slist_nth_data (*list, 2), ==, "2");
2819 values = g_slist_prepend (values, "-2");
2820 values = g_slist_prepend (values, "-1");
2821 values = g_slist_prepend (values, "0");
2822 values = g_slist_prepend (values, "1");
2823 values = g_slist_reverse (values);
2830 * gi_marshalling_tests_gslist_utf8_container_inout:
2831 * @list: (inout) (element-type utf8) (transfer container):
2834 gi_marshalling_tests_gslist_utf8_container_inout (GSList **list)
2836 GSList *result = NULL;
2838 g_assert_cmpint (g_slist_length (*list), ==, 3);
2839 g_assert_cmpstr (g_slist_nth_data (*list, 0), ==, "0");
2840 g_assert_cmpstr (g_slist_nth_data (*list, 1), ==, "1");
2841 g_assert_cmpstr (g_slist_nth_data (*list, 2), ==, "2");
2843 result = g_slist_prepend (result, "1");
2844 result = g_slist_prepend (result, "0");
2845 result = g_slist_prepend (result, "-1");
2846 result = g_slist_prepend (result, "-2");
2848 g_slist_free (*list);
2853 * gi_marshalling_tests_gslist_utf8_full_inout:
2854 * @list: (inout) (element-type utf8) (transfer full):
2857 gi_marshalling_tests_gslist_utf8_full_inout (GSList **list)
2859 GSList *result = NULL;
2861 g_assert_cmpint (g_slist_length (*list), ==, 3);
2862 g_assert_cmpstr (g_slist_nth_data (*list, 0), ==, "0");
2863 g_assert_cmpstr (g_slist_nth_data (*list, 1), ==, "1");
2864 g_assert_cmpstr (g_slist_nth_data (*list, 2), ==, "2");
2866 result = g_slist_prepend (result, g_strdup ("1"));
2867 result = g_slist_prepend (result, g_strdup ("0"));
2868 result = g_slist_prepend (result, g_strdup ("-1"));
2869 result = g_slist_prepend (result, g_strdup ("-2"));
2871 g_slist_free_full (*list, g_free);
2877 * gi_marshalling_tests_ghashtable_int_none_return:
2879 * Returns: (element-type gint gint) (transfer none):
2882 gi_marshalling_tests_ghashtable_int_none_return (void)
2884 static GHashTable *hash_table = NULL;
2886 if (hash_table == NULL)
2888 hash_table = g_hash_table_new (NULL, NULL);
2889 g_hash_table_insert (hash_table, GINT_TO_POINTER (-1), GINT_TO_POINTER (1));
2890 g_hash_table_insert (hash_table, GINT_TO_POINTER (0), GINT_TO_POINTER (0));
2891 g_hash_table_insert (hash_table, GINT_TO_POINTER (1), GINT_TO_POINTER (-1));
2892 g_hash_table_insert (hash_table, GINT_TO_POINTER (2), GINT_TO_POINTER (-2));
2899 * gi_marshalling_tests_ghashtable_utf8_none_return:
2901 * Returns: (element-type utf8 utf8) (transfer none):
2904 gi_marshalling_tests_ghashtable_utf8_none_return (void)
2906 static GHashTable *hash_table = NULL;
2908 if (hash_table == NULL)
2910 hash_table = g_hash_table_new (g_str_hash, g_str_equal);
2911 g_hash_table_insert (hash_table, "-1", "1");
2912 g_hash_table_insert (hash_table, "0", "0");
2913 g_hash_table_insert (hash_table, "1", "-1");
2914 g_hash_table_insert (hash_table, "2", "-2");
2921 * gi_marshalling_tests_ghashtable_utf8_container_return:
2923 * Returns: (element-type utf8 utf8) (transfer container):
2926 gi_marshalling_tests_ghashtable_utf8_container_return (void)
2928 GHashTable *hash_table = NULL;
2930 hash_table = g_hash_table_new (g_str_hash, g_str_equal);
2931 g_hash_table_insert (hash_table, "-1", "1");
2932 g_hash_table_insert (hash_table, "0", "0");
2933 g_hash_table_insert (hash_table, "1", "-1");
2934 g_hash_table_insert (hash_table, "2", "-2");
2940 * gi_marshalling_tests_ghashtable_utf8_full_return:
2942 * Returns: (element-type utf8 utf8) (transfer full):
2945 gi_marshalling_tests_ghashtable_utf8_full_return (void)
2947 GHashTable *hash_table = NULL;
2949 hash_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
2950 g_hash_table_insert (hash_table, g_strdup ("-1"), g_strdup ("1"));
2951 g_hash_table_insert (hash_table, g_strdup ("0"), g_strdup ("0"));
2952 g_hash_table_insert (hash_table, g_strdup ("1"), g_strdup ("-1"));
2953 g_hash_table_insert (hash_table, g_strdup ("2"), g_strdup ("-2"));
2959 * gi_marshalling_tests_ghashtable_int_none_in:
2960 * @hash_table: (element-type gint gint) (transfer none):
2963 gi_marshalling_tests_ghashtable_int_none_in (GHashTable *hash_table)
2965 g_assert_cmpint (GPOINTER_TO_INT (g_hash_table_lookup (hash_table, GINT_TO_POINTER (-1))), ==, 1);
2966 g_assert_cmpint (GPOINTER_TO_INT (g_hash_table_lookup (hash_table, GINT_TO_POINTER (0))), ==, 0);
2967 g_assert_cmpint (GPOINTER_TO_INT (g_hash_table_lookup (hash_table, GINT_TO_POINTER (1))), ==, -1);
2968 g_assert_cmpint (GPOINTER_TO_INT (g_hash_table_lookup (hash_table, GINT_TO_POINTER (2))), ==, -2);
2972 * gi_marshalling_tests_ghashtable_utf8_none_in:
2973 * @hash_table: (element-type utf8 utf8) (transfer none):
2976 gi_marshalling_tests_ghashtable_utf8_none_in (GHashTable *hash_table)
2978 g_assert_cmpstr (g_hash_table_lookup (hash_table, "-1"), ==, "1");
2979 g_assert_cmpstr (g_hash_table_lookup (hash_table, "0"), ==, "0");
2980 g_assert_cmpstr (g_hash_table_lookup (hash_table, "1"), ==, "-1");
2981 g_assert_cmpstr (g_hash_table_lookup (hash_table, "2"), ==, "-2");
2985 * gi_marshalling_tests_ghashtable_utf8_none_out:
2986 * @hash_table: (out) (element-type utf8 utf8) (transfer none):
2989 gi_marshalling_tests_ghashtable_utf8_none_out (GHashTable **hash_table)
2991 static GHashTable *new_hash_table = NULL;
2993 if (new_hash_table == NULL)
2995 new_hash_table = g_hash_table_new (g_str_hash, g_str_equal);
2996 g_hash_table_insert (new_hash_table, "-1", "1");
2997 g_hash_table_insert (new_hash_table, "0", "0");
2998 g_hash_table_insert (new_hash_table, "1", "-1");
2999 g_hash_table_insert (new_hash_table, "2", "-2");
3002 *hash_table = new_hash_table;
3006 * gi_marshalling_tests_ghashtable_utf8_container_out:
3007 * @hash_table: (out) (element-type utf8 utf8) (transfer container):
3010 gi_marshalling_tests_ghashtable_utf8_container_out (GHashTable **hash_table)
3012 *hash_table = g_hash_table_new (g_str_hash, g_str_equal);
3013 g_hash_table_insert (*hash_table, "-1", "1");
3014 g_hash_table_insert (*hash_table, "0", "0");
3015 g_hash_table_insert (*hash_table, "1", "-1");
3016 g_hash_table_insert (*hash_table, "2", "-2");
3020 * gi_marshalling_tests_ghashtable_utf8_full_out:
3021 * @hash_table: (out) (element-type utf8 utf8) (transfer full):
3024 gi_marshalling_tests_ghashtable_utf8_full_out (GHashTable **hash_table)
3026 *hash_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
3027 g_hash_table_insert (*hash_table, g_strdup ("-1"), g_strdup ("1"));
3028 g_hash_table_insert (*hash_table, g_strdup ("0"), g_strdup ("0"));
3029 g_hash_table_insert (*hash_table, g_strdup ("1"), g_strdup ("-1"));
3030 g_hash_table_insert (*hash_table, g_strdup ("2"), g_strdup ("-2"));
3034 * gi_marshalling_tests_ghashtable_utf8_none_inout:
3035 * @hash_table: (inout) (element-type utf8 utf8) (transfer none):
3038 gi_marshalling_tests_ghashtable_utf8_none_inout (GHashTable **hash_table)
3040 static GHashTable *new_hash_table = NULL;
3042 g_assert_cmpstr (g_hash_table_lookup (*hash_table, "-1"), ==, "1");
3043 g_assert_cmpstr (g_hash_table_lookup (*hash_table, "0"), ==, "0");
3044 g_assert_cmpstr (g_hash_table_lookup (*hash_table, "1"), ==, "-1");
3045 g_assert_cmpstr (g_hash_table_lookup (*hash_table, "2"), ==, "-2");
3047 if (new_hash_table == NULL)
3049 new_hash_table = g_hash_table_new (g_str_hash, g_str_equal);
3050 g_hash_table_insert (new_hash_table, "-1", "1");
3051 g_hash_table_insert (new_hash_table, "0", "0");
3052 g_hash_table_insert (new_hash_table, "1", "1");
3055 *hash_table = new_hash_table;
3059 * gi_marshalling_tests_ghashtable_utf8_container_inout:
3060 * @hash_table: (inout) (element-type utf8 utf8) (transfer container):
3063 gi_marshalling_tests_ghashtable_utf8_container_inout (GHashTable **hash_table)
3065 GHashTable *result = g_hash_table_new (g_str_hash, g_str_equal);
3067 g_assert_cmpstr (g_hash_table_lookup (*hash_table, "-1"), ==, "1");
3068 g_assert_cmpstr (g_hash_table_lookup (*hash_table, "0"), ==, "0");
3069 g_assert_cmpstr (g_hash_table_lookup (*hash_table, "1"), ==, "-1");
3070 g_assert_cmpstr (g_hash_table_lookup (*hash_table, "2"), ==, "-2");
3072 g_hash_table_insert (result, "-1", "1");
3073 g_hash_table_insert (result, "0", "0");
3074 g_hash_table_insert (result, "1", "1");
3076 g_hash_table_unref (*hash_table);
3077 *hash_table = result;
3081 * gi_marshalling_tests_ghashtable_utf8_full_inout:
3082 * @hash_table: (inout) (element-type utf8 utf8) (transfer full):
3085 gi_marshalling_tests_ghashtable_utf8_full_inout (GHashTable **hash_table)
3087 GHashTable *result = g_hash_table_new_full (g_str_hash, g_str_equal,
3090 g_assert_cmpstr (g_hash_table_lookup (*hash_table, "-1"), ==, "1");
3091 g_assert_cmpstr (g_hash_table_lookup (*hash_table, "0"), ==, "0");
3092 g_assert_cmpstr (g_hash_table_lookup (*hash_table, "1"), ==, "-1");
3093 g_assert_cmpstr (g_hash_table_lookup (*hash_table, "2"), ==, "-2");
3095 g_hash_table_insert (result, g_strdup ("-1"), g_strdup ("1"));
3096 g_hash_table_insert (result, g_strdup ("0"), g_strdup ("0"));
3097 g_hash_table_insert (result, g_strdup ("1"), g_strdup ("1"));
3099 g_hash_table_unref (*hash_table);
3100 *hash_table = result;
3105 * gi_marshalling_tests_gvalue_return:
3107 * Returns: (transfer none):
3110 gi_marshalling_tests_gvalue_return (void)
3112 static GValue *value = NULL;
3116 value = g_new0 (GValue, 1);
3117 g_value_init (value, G_TYPE_INT);
3118 g_value_set_int (value, 42);
3125 * gi_marshalling_tests_gvalue_in:
3126 * @value: (transfer none):
3129 gi_marshalling_tests_gvalue_in (GValue *value)
3131 g_assert_cmpint (g_value_get_int (value), ==, 42);
3135 * gi_marshalling_tests_gvalue_int64_in:
3136 * @value: (transfer none):
3139 gi_marshalling_tests_gvalue_int64_in (GValue *value)
3141 g_assert_cmpint (g_value_get_int64 (value), ==, G_MAXINT64);
3145 * gi_marshalling_tests_gvalue_in_with_type:
3146 * @value: (transfer none):
3150 gi_marshalling_tests_gvalue_in_with_type (GValue *value, GType type)
3152 g_assert (g_type_is_a (G_VALUE_TYPE (value), type));
3156 * gi_marshalling_tests_gvalue_in_with_modification:
3157 * @value: (transfer none):
3159 * Expects a GValue passed by reference which is then modified by
3163 gi_marshalling_tests_gvalue_in_with_modification (GValue *value)
3165 g_assert_cmpint (g_value_get_int (value), ==, 42);
3166 g_value_set_int (value, 24);
3170 * gi_marshalling_tests_gvalue_in_enum:
3171 * @value: (transfer none):
3174 gi_marshalling_tests_gvalue_in_enum (GValue *value)
3176 g_assert (g_value_get_enum (value) == GI_MARSHALLING_TESTS_ENUM_VALUE3);
3180 * gi_marshalling_tests_gvalue_out:
3181 * @value: (out) (transfer none):
3184 gi_marshalling_tests_gvalue_out (GValue **value)
3186 static GValue *new_value = NULL;
3188 if (new_value == NULL)
3190 new_value = g_new0 (GValue, 1);
3191 g_value_init (new_value, G_TYPE_INT);
3192 g_value_set_int (new_value, 42);
3199 * gi_marshalling_tests_gvalue_int64_out:
3200 * @value: (out) (transfer none):
3203 gi_marshalling_tests_gvalue_int64_out (GValue **value)
3205 static GValue *new_value = NULL;
3207 if (new_value == NULL)
3209 new_value = g_new0 (GValue, 1);
3210 g_value_init (new_value, G_TYPE_INT64);
3211 g_value_set_int64 (new_value, G_MAXINT64);
3218 * gi_marshalling_tests_gvalue_out_caller_allocates:
3219 * @value: (out) (transfer none):
3222 gi_marshalling_tests_gvalue_out_caller_allocates (GValue *value)
3224 g_value_init (value, G_TYPE_INT);
3225 g_value_set_int (value, 42);
3229 * gi_marshalling_tests_gvalue_inout:
3230 * @value: (inout) (transfer none):
3233 gi_marshalling_tests_gvalue_inout (GValue **value)
3235 g_assert_cmpint (g_value_get_int (*value), ==, 42);
3236 g_value_unset (*value);
3237 g_value_init (*value, G_TYPE_STRING);
3238 g_value_set_string (*value, "42");
3242 * gi_marshalling_tests_gvalue_flat_array:
3243 * @n_values: number of values
3244 * @values: (array length=n_values): an array containing values
3247 gi_marshalling_tests_gvalue_flat_array (guint n_values, const GValue *values)
3249 g_assert (n_values == 3);
3251 g_assert_cmpint (g_value_get_int (&values[0]), ==, 42);
3252 g_assert_cmpstr (g_value_get_string (&values[1]), ==, "42");
3253 g_assert_cmpint (g_value_get_boolean (&values[2]), ==, TRUE);
3257 * gi_marshalling_tests_return_gvalue_flat_array:
3259 * Returns: (array fixed-size=3) (transfer full): a flat GValue array
3262 gi_marshalling_tests_return_gvalue_flat_array (void)
3264 GValue *array = g_new0 (GValue, 3);
3266 g_value_init (&array[0], G_TYPE_INT);
3267 g_value_set_int (&array[0], 42);
3269 g_value_init (&array[1], G_TYPE_STRING);
3270 g_value_set_static_string (&array[1], "42");
3272 g_value_init (&array[2], G_TYPE_BOOLEAN);
3273 g_value_set_boolean (&array[2], TRUE);
3279 * gi_marshalling_tests_gvalue_flat_array_round_trip:
3280 * @one: The first GValue
3281 * @two: The second GValue
3282 * @three: The third GValue
3284 * Returns: (array fixed-size=3) (transfer full): a flat array of [@one, @two, @three]
3287 gi_marshalling_tests_gvalue_flat_array_round_trip (const GValue one, const GValue two, const GValue three)
3289 GValue *array = g_new (GValue, 3);
3298 * gi_marshalling_tests_gclosure_in:
3299 * @closure: (transfer none):
3302 gi_marshalling_tests_gclosure_in (GClosure *closure)
3304 GValue return_value = { 0, };
3306 g_value_init (&return_value, G_TYPE_INT);
3308 g_closure_invoke (closure, &return_value, 0, NULL, NULL);
3310 g_assert_cmpint (g_value_get_int (&return_value), ==, 42);
3312 g_value_unset (&return_value);
3316 _closure_return_42 (void)
3322 _marshal_INT__VOID (GClosure *closure,
3323 GValue *return_value,
3324 guint n_param_values, const GValue *param_values, gpointer invocation_hint, gpointer marshal_data)
3326 typedef gint (*GMarshalFunc_INT__VOID) (void);
3327 register GMarshalFunc_INT__VOID callback;
3328 register GCClosure *cc = (GCClosure *) closure;
3330 callback = (GMarshalFunc_INT__VOID) cc->callback;
3331 g_value_set_int (return_value, callback ());
3335 * gi_marshalling_tests_gclosure_return:
3337 * Return: a #GClosure
3340 gi_marshalling_tests_gclosure_return (void)
3342 GClosure *closure = g_cclosure_new ((GCallback) _closure_return_42,
3344 g_closure_set_marshal (closure, _marshal_INT__VOID);
3351 * gi_marshalling_tests_callback_return_value_only:
3352 * @callback: (scope call):
3354 glong gi_marshalling_tests_callback_return_value_only (GIMarshallingTestsCallbackReturnValueOnly callback)
3360 * gi_marshalling_tests_callback_one_out_parameter:
3361 * @callback: (scope call):
3364 void gi_marshalling_tests_callback_one_out_parameter (GIMarshallingTestsCallbackOneOutParameter callback, gfloat *a)
3370 * gi_marshalling_tests_callback_multiple_out_parameters:
3371 * @callback: (scope call):
3376 gi_marshalling_tests_callback_multiple_out_parameters
3377 (GIMarshallingTestsCallbackMultipleOutParameters callback, gfloat *a, gfloat *b)
3383 * gi_marshalling_tests_callback_return_value_and_one_out_parameter:
3384 * @callback: (scope call):
3388 gi_marshalling_tests_callback_return_value_and_one_out_parameter
3389 (GIMarshallingTestsCallbackReturnValueAndOneOutParameter callback, glong *a)
3391 return callback (a);
3395 * gi_marshalling_tests_callback_return_value_and_multiple_out_parameters:
3396 * @callback: (scope call):
3401 gi_marshalling_tests_callback_return_value_and_multiple_out_parameters
3402 (GIMarshallingTestsCallbackReturnValueAndMultipleOutParameters callback, glong *a, glong *b)
3404 return callback (a, b);
3410 * gi_marshalling_tests_pointer_in_return:
3412 * Returns: The same pointer
3415 gi_marshalling_tests_pointer_in_return (gpointer pointer)
3421 gi_marshalling_tests_genum_get_type (void)
3423 static GType type = 0;
3424 if (G_UNLIKELY (type == 0))
3426 static const GEnumValue values[] = {
3427 {GI_MARSHALLING_TESTS_GENUM_VALUE1,
3428 "GI_MARSHALLING_TESTS_GENUM_VALUE1", "value1"},
3429 {GI_MARSHALLING_TESTS_GENUM_VALUE2,
3430 "GI_MARSHALLING_TESTS_GENUM_VALUE2", "value2"},
3431 {GI_MARSHALLING_TESTS_GENUM_VALUE3,
3432 "GI_MARSHALLING_TESTS_GENUM_VALUE3", "value3"},
3435 type = g_enum_register_static (g_intern_static_string ("GIMarshallingTestsGEnum"), values);
3441 GIMarshallingTestsGEnum
3442 gi_marshalling_tests_genum_returnv (void)
3444 return GI_MARSHALLING_TESTS_GENUM_VALUE3;
3448 gi_marshalling_tests_genum_in (GIMarshallingTestsGEnum v)
3450 g_assert_cmpint (v, ==, GI_MARSHALLING_TESTS_GENUM_VALUE3);
3454 * gi_marshalling_tests_genum_out:
3458 gi_marshalling_tests_genum_out (GIMarshallingTestsGEnum *v)
3460 *v = GI_MARSHALLING_TESTS_GENUM_VALUE3;
3464 * gi_marshalling_tests_genum_inout:
3468 gi_marshalling_tests_genum_inout (GIMarshallingTestsGEnum *v)
3470 g_assert_cmpint (*v, ==, GI_MARSHALLING_TESTS_GENUM_VALUE3);
3471 *v = GI_MARSHALLING_TESTS_GENUM_VALUE1;
3475 GIMarshallingTestsEnum
3476 gi_marshalling_tests_enum_returnv (void)
3478 return GI_MARSHALLING_TESTS_ENUM_VALUE3;
3482 gi_marshalling_tests_enum_in (GIMarshallingTestsEnum v)
3484 g_assert_cmpint (v, ==, GI_MARSHALLING_TESTS_ENUM_VALUE3);
3488 * gi_marshalling_tests_enum_out:
3492 gi_marshalling_tests_enum_out (GIMarshallingTestsEnum *v)
3494 *v = GI_MARSHALLING_TESTS_ENUM_VALUE3;
3498 * gi_marshalling_tests_enum_inout:
3502 gi_marshalling_tests_enum_inout (GIMarshallingTestsEnum *v)
3504 g_assert_cmpint (*v, ==, GI_MARSHALLING_TESTS_ENUM_VALUE3);
3505 *v = GI_MARSHALLING_TESTS_ENUM_VALUE1;
3510 gi_marshalling_tests_flags_get_type (void)
3512 static GType type = 0;
3513 if (G_UNLIKELY (type == 0))
3515 static const GFlagsValue values[] = {
3516 {GI_MARSHALLING_TESTS_FLAGS_VALUE1,
3517 "GI_MARSHALLING_TESTS_FLAGS_VALUE1", "value1"},
3518 {GI_MARSHALLING_TESTS_FLAGS_VALUE2,
3519 "GI_MARSHALLING_TESTS_FLAGS_VALUE2", "value2"},
3520 {GI_MARSHALLING_TESTS_FLAGS_VALUE3,
3521 "GI_MARSHALLING_TESTS_FLAGS_VALUE3", "value3"},
3522 {GI_MARSHALLING_TESTS_FLAGS_MASK, "GI_MARSHALLING_TESTS_FLAGS_MASK",
3524 {GI_MARSHALLING_TESTS_FLAGS_MASK2, "GI_MARSHALLING_TESTS_FLAGS_MASK2",
3528 type = g_flags_register_static (g_intern_static_string ("GIMarshallingTestsFlags"), values);
3534 GIMarshallingTestsFlags
3535 gi_marshalling_tests_flags_returnv (void)
3537 return GI_MARSHALLING_TESTS_FLAGS_VALUE2;
3541 gi_marshalling_tests_flags_in (GIMarshallingTestsFlags v)
3543 g_assert (v == GI_MARSHALLING_TESTS_FLAGS_VALUE2);
3547 gi_marshalling_tests_flags_in_zero (GIMarshallingTestsFlags v)
3553 * gi_marshalling_tests_flags_out:
3557 gi_marshalling_tests_flags_out (GIMarshallingTestsFlags *v)
3559 *v = GI_MARSHALLING_TESTS_FLAGS_VALUE2;
3563 * gi_marshalling_tests_flags_inout:
3567 gi_marshalling_tests_flags_inout (GIMarshallingTestsFlags *v)
3569 g_assert (*v == GI_MARSHALLING_TESTS_FLAGS_VALUE2);
3570 *v = GI_MARSHALLING_TESTS_FLAGS_VALUE1;
3574 GIMarshallingTestsNoTypeFlags
3575 gi_marshalling_tests_no_type_flags_returnv (void)
3577 return GI_MARSHALLING_TESTS_NO_TYPE_FLAGS_VALUE2;
3581 gi_marshalling_tests_no_type_flags_in (GIMarshallingTestsNoTypeFlags v)
3583 g_assert (v == GI_MARSHALLING_TESTS_NO_TYPE_FLAGS_VALUE2);
3587 gi_marshalling_tests_no_type_flags_in_zero (GIMarshallingTestsNoTypeFlags v)
3593 * gi_marshalling_tests_no_type_flags_out:
3597 gi_marshalling_tests_no_type_flags_out (GIMarshallingTestsNoTypeFlags *v)
3599 *v = GI_MARSHALLING_TESTS_NO_TYPE_FLAGS_VALUE2;
3603 * gi_marshalling_tests_no_type_flags_inout:
3607 gi_marshalling_tests_no_type_flags_inout (GIMarshallingTestsNoTypeFlags *v)
3609 g_assert (*v == GI_MARSHALLING_TESTS_NO_TYPE_FLAGS_VALUE2);
3610 *v = GI_MARSHALLING_TESTS_NO_TYPE_FLAGS_VALUE1;
3615 * gi_marshalling_tests_simple_struct_returnv:
3617 * Returns: (transfer none):
3619 GIMarshallingTestsSimpleStruct *
3620 gi_marshalling_tests_simple_struct_returnv (void)
3622 static GIMarshallingTestsSimpleStruct *struct_ = NULL;
3624 if (struct_ == NULL)
3626 struct_ = g_new (GIMarshallingTestsSimpleStruct, 1);
3636 * gi_marshalling_tests_simple_struct_inv:
3637 * @struct_: (transfer none):
3640 gi_marshalling_tests_simple_struct_inv (GIMarshallingTestsSimpleStruct *struct_)
3642 g_assert_cmpint (struct_->long_, ==, 6);
3643 g_assert_cmpint (struct_->int8, ==, 7);
3647 gi_marshalling_tests_simple_struct_method (GIMarshallingTestsSimpleStruct *struct_)
3649 g_assert_cmpint (struct_->long_, ==, 6);
3650 g_assert_cmpint (struct_->int8, ==, 7);
3655 gi_marshalling_tests_pointer_struct_get_type (void)
3657 static GType type = 0;
3661 type = g_pointer_type_register_static ("GIMarshallingTestsPointerStruct");
3668 * gi_marshalling_tests_pointer_struct_returnv:
3670 * Returns: (transfer none):
3672 GIMarshallingTestsPointerStruct *
3673 gi_marshalling_tests_pointer_struct_returnv (void)
3675 static GIMarshallingTestsPointerStruct *struct_ = NULL;
3677 if (struct_ == NULL)
3679 struct_ = g_new (GIMarshallingTestsPointerStruct, 1);
3681 struct_->long_ = 42;
3688 * gi_marshalling_tests_pointer_struct_inv:
3689 * @struct_: (transfer none):
3692 gi_marshalling_tests_pointer_struct_inv (GIMarshallingTestsPointerStruct *struct_)
3694 g_assert_cmpint (struct_->long_, ==, 42);
3697 static GIMarshallingTestsBoxedStruct *
3698 gi_marshalling_tests_boxed_struct_copy (GIMarshallingTestsBoxedStruct *struct_)
3700 GIMarshallingTestsBoxedStruct *new_struct;
3702 if (struct_ == NULL)
3705 new_struct = g_slice_new (GIMarshallingTestsBoxedStruct);
3707 *new_struct = *struct_;
3708 new_struct->string_ = g_strdup (struct_->string_);
3714 gi_marshalling_tests_boxed_struct_free (GIMarshallingTestsBoxedStruct *struct_)
3716 if (struct_ != NULL)
3718 g_free (struct_->string_);
3719 g_slice_free (GIMarshallingTestsBoxedStruct, struct_);
3724 gi_marshalling_tests_boxed_struct_get_type (void)
3726 static GType type = 0;
3730 type = g_boxed_type_register_static ("GIMarshallingTestsBoxedStruct",
3732 gi_marshalling_tests_boxed_struct_copy,
3733 (GBoxedFreeFunc) gi_marshalling_tests_boxed_struct_free);
3740 gi_marshalling_tests_boxed_glist_get_type (void)
3742 static GType type = 0;
3746 type = g_boxed_type_register_static ("GIMarshallingTestsBoxedGList",
3747 (GBoxedCopyFunc) g_list_copy, (GBoxedFreeFunc) g_list_free);
3753 GIMarshallingTestsBoxedStruct *
3754 gi_marshalling_tests_boxed_struct_new (void)
3756 return g_slice_new0 (GIMarshallingTestsBoxedStruct);
3760 * gi_marshalling_tests_boxed_struct_returnv:
3762 * Returns: (transfer none):
3764 GIMarshallingTestsBoxedStruct *
3765 gi_marshalling_tests_boxed_struct_returnv (void)
3767 static GIMarshallingTestsBoxedStruct *struct_ = NULL;
3769 if (struct_ == NULL)
3771 struct_ = g_new (GIMarshallingTestsBoxedStruct, 1);
3773 struct_->long_ = 42;
3774 struct_->string_ = g_strdup ("hello");
3775 struct_->g_strv = g_new0 (gchar *, 4);
3776 struct_->g_strv[0] = g_strdup ("0");
3777 struct_->g_strv[1] = g_strdup ("1");
3778 struct_->g_strv[2] = g_strdup ("2");
3779 struct_->g_strv[3] = NULL;
3786 * gi_marshalling_tests_boxed_struct_inv:
3787 * @struct_: (transfer none):
3790 gi_marshalling_tests_boxed_struct_inv (GIMarshallingTestsBoxedStruct *struct_)
3792 g_assert_cmpint (struct_->long_, ==, 42);
3796 * gi_marshalling_tests_boxed_struct_out:
3797 * @struct_: (out) (transfer none):
3800 gi_marshalling_tests_boxed_struct_out (GIMarshallingTestsBoxedStruct **struct_)
3802 static GIMarshallingTestsBoxedStruct *new_struct = NULL;
3804 if (new_struct == NULL)
3806 new_struct = g_new0 (GIMarshallingTestsBoxedStruct, 1);
3808 new_struct->long_ = 42;
3811 *struct_ = new_struct;
3815 * gi_marshalling_tests_boxed_struct_inout:
3816 * @struct_: (inout) (transfer full):
3819 gi_marshalling_tests_boxed_struct_inout (GIMarshallingTestsBoxedStruct **struct_)
3821 g_assert_cmpint ((*struct_)->long_, ==, 42);
3823 g_boxed_free (gi_marshalling_tests_boxed_struct_get_type(), *struct_);
3824 (*struct_) = g_slice_new0 (GIMarshallingTestsBoxedStruct);
3825 (*struct_)->long_ = 0;
3828 static GIMarshallingTestsUnion *
3829 gi_marshalling_tests_union_copy (GIMarshallingTestsUnion *union_)
3831 GIMarshallingTestsUnion *new_union;
3833 new_union = g_slice_new (GIMarshallingTestsUnion);
3835 *new_union = *union_;
3841 gi_marshalling_tests_union_free (GIMarshallingTestsUnion *union_)
3843 g_slice_free (GIMarshallingTestsUnion, union_);
3847 gi_marshalling_tests_union_get_type (void)
3849 static GType type = 0;
3853 type = g_boxed_type_register_static ("GIMarshallingTestsUnion",
3855 gi_marshalling_tests_union_copy,
3856 (GBoxedFreeFunc) gi_marshalling_tests_union_free);
3863 * gi_marshalling_tests_union_returnv:
3865 * Returns: (transfer none):
3867 GIMarshallingTestsUnion *
3868 gi_marshalling_tests_union_returnv (void)
3870 static GIMarshallingTestsUnion *union_ = NULL;
3874 union_ = g_new (GIMarshallingTestsUnion, 1);
3883 * gi_marshalling_tests_union_inv:
3884 * @union_: (transfer none):
3887 gi_marshalling_tests_union_inv (GIMarshallingTestsUnion *union_)
3889 g_assert_cmpint (union_->long_, ==, 42);
3893 gi_marshalling_tests_union_method (GIMarshallingTestsUnion *union_)
3895 g_assert_cmpint (union_->long_, ==, 42);
3907 gi_marshalling_tests_object_real_method_with_default_implementation (GIMarshallingTestsObject *self, gint8 in);
3909 G_DEFINE_TYPE (GIMarshallingTestsObject, gi_marshalling_tests_object, G_TYPE_OBJECT);
3912 gi_marshalling_tests_object_init (GIMarshallingTestsObject *object)
3917 gi_marshalling_tests_object_finalize (GObject *object)
3919 G_OBJECT_CLASS (gi_marshalling_tests_object_parent_class)->finalize (object);
3923 gi_marshalling_tests_object_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
3925 g_return_if_fail (GI_MARSHALLING_TESTS_IS_OBJECT (object));
3930 GI_MARSHALLING_TESTS_OBJECT (object)->int_ = g_value_get_int (value);
3933 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
3939 gi_marshalling_tests_object_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
3941 g_return_if_fail (GI_MARSHALLING_TESTS_IS_OBJECT (object));
3946 g_value_set_int (value, GI_MARSHALLING_TESTS_OBJECT (object)->int_);
3949 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
3955 gi_marshalling_tests_object_class_init (GIMarshallingTestsObjectClass *klass)
3957 GObjectClass *object_class = G_OBJECT_CLASS (klass);
3959 GObjectClass *parent_class = G_OBJECT_CLASS (klass);
3962 object_class->finalize = gi_marshalling_tests_object_finalize;
3963 object_class->set_property = gi_marshalling_tests_object_set_property;
3964 object_class->get_property = gi_marshalling_tests_object_get_property;
3966 g_object_class_install_property (object_class, PROP_INT_,
3967 g_param_spec_int ("int", "Integer",
3968 "An integer", G_MININT,
3970 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
3972 klass->method_with_default_implementation = gi_marshalling_tests_object_real_method_with_default_implementation;
3977 gi_marshalling_tests_object_static_method (void)
3982 gi_marshalling_tests_object_method (GIMarshallingTestsObject *object)
3984 g_return_if_fail (GI_MARSHALLING_TESTS_IS_OBJECT (object));
3985 g_assert_cmpint (object->int_, ==, 42);
3989 gi_marshalling_tests_object_overridden_method (GIMarshallingTestsObject *object)
3991 g_return_if_fail (GI_MARSHALLING_TESTS_IS_OBJECT (object));
3992 g_assert_cmpint (object->int_, ==, 0);
3995 GIMarshallingTestsObject *
3996 gi_marshalling_tests_object_new (gint int_)
3998 return g_object_new (GI_MARSHALLING_TESTS_TYPE_OBJECT, "int", int_, NULL);
4001 GIMarshallingTestsObject *
4002 gi_marshalling_tests_object_new_fail (gint int_, GError **error)
4004 g_return_val_if_fail (error == NULL || *error == NULL, NULL);
4006 g_set_error_literal (error,
4007 g_quark_from_static_string (GI_MARSHALLING_TESTS_CONSTANT_GERROR_DOMAIN),
4008 GI_MARSHALLING_TESTS_CONSTANT_GERROR_CODE,
4009 GI_MARSHALLING_TESTS_CONSTANT_GERROR_MESSAGE);
4015 * gi_marshalling_tests_object_method_array_in:
4016 * @ints: (array length=length):
4019 gi_marshalling_tests_object_method_array_in (GIMarshallingTestsObject *object, const gint *ints, gint length)
4021 g_assert_cmpint (length, ==, 4);
4022 g_assert_cmpint (ints[0], ==, -1);
4023 g_assert_cmpint (ints[1], ==, 0);
4024 g_assert_cmpint (ints[2], ==, 1);
4025 g_assert_cmpint (ints[3], ==, 2);
4029 * gi_marshalling_tests_object_method_array_out:
4030 * @ints: (out) (array length=length) (transfer none):
4033 gi_marshalling_tests_object_method_array_out (GIMarshallingTestsObject *object, gint **ints, gint *length)
4035 static gint values[] = { -1, 0, 1, 2 };
4042 * gi_marshalling_tests_object_method_array_inout:
4043 * @ints: (inout) (array length=length) (transfer none):
4047 gi_marshalling_tests_object_method_array_inout (GIMarshallingTestsObject *object, gint **ints, gint *length)
4049 static gint values[] = { -2, -1, 0, 1, 2 };
4051 g_assert_cmpint (*length, ==, 4);
4052 g_assert_cmpint ((*ints)[0], ==, -1);
4053 g_assert_cmpint ((*ints)[1], ==, 0);
4054 g_assert_cmpint ((*ints)[2], ==, 1);
4055 g_assert_cmpint ((*ints)[3], ==, 2);
4062 * gi_marshalling_tests_object_method_array_return:
4064 * Returns: (array length=length):
4067 gi_marshalling_tests_object_method_array_return (GIMarshallingTestsObject *object, gint *length)
4069 static gint ints[] = { -1, 0, 1, 2 };
4076 * gi_marshalling_tests_object_method_int8_in:
4080 gi_marshalling_tests_object_method_int8_in (GIMarshallingTestsObject *self, gint8 in)
4082 GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->method_int8_in (self, in);
4086 * gi_marshalling_tests_object_method_int8_out:
4090 gi_marshalling_tests_object_method_int8_out (GIMarshallingTestsObject *self, gint8 *out)
4092 GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->method_int8_out (self, out);
4096 * gi_marshalling_tests_object_method_int8_arg_and_out_caller:
4097 * @out: (out caller-allocates):
4100 gi_marshalling_tests_object_method_int8_arg_and_out_caller (GIMarshallingTestsObject *self, gint8 arg, gint8 *out)
4102 GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->method_int8_arg_and_out_caller (self, arg, out);
4106 * gi_marshalling_tests_object_method_int8_arg_and_out_callee:
4110 gi_marshalling_tests_object_method_int8_arg_and_out_callee (GIMarshallingTestsObject *self, gint8 arg, gint8 **out)
4112 GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->method_int8_arg_and_out_callee (self, arg, out);
4116 * gi_marshalling_tests_object_method_str_arg_out_ret:
4117 * @out: (out caller-allocates):
4119 * Returns: (transfer none)
4122 gi_marshalling_tests_object_method_str_arg_out_ret (GIMarshallingTestsObject *self, const gchar *arg, guint *out)
4124 return GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->method_str_arg_out_ret (self, arg, out);
4128 * gi_marshalling_tests_object_method_with_default_implementation:
4131 void gi_marshalling_tests_object_method_with_default_implementation (GIMarshallingTestsObject *self, gint8 in)
4133 GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->method_with_default_implementation (self, in);
4137 gi_marshalling_tests_object_real_method_with_default_implementation (GIMarshallingTestsObject *self, gint8 in)
4139 GValue val = { 0, };
4140 g_value_init (&val, G_TYPE_INT);
4141 g_value_set_int (&val, in);
4142 g_object_set_property (G_OBJECT (self), "int", &val);
4146 * gi_marshalling_tests_object_vfunc_with_callback: (virtual vfunc_with_callback)
4147 * @callback: (scope call) (closure callback_data):
4148 * @callback_data: (allow-none):
4151 gi_marshalling_tests_object_vfunc_with_callback (GIMarshallingTestsObject *
4152 object, GIMarshallingTestsCallbackIntInt callback, void *callback_data)
4158 _callback (int val, void *user_data)
4160 g_assert (user_data == (gpointer) 0xdeadbeef);
4165 gi_marshalling_tests_object_call_vfunc_with_callback (GIMarshallingTestsObject *object)
4167 GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (object)->vfunc_with_callback (object, _callback, (void *) 0xdeadbeef);
4171 * gi_marshalling_tests_object_none_return:
4173 * Returns: (transfer none):
4175 GIMarshallingTestsObject *
4176 gi_marshalling_tests_object_none_return (void)
4178 static GIMarshallingTestsObject *object = NULL;
4182 object = g_object_new (GI_MARSHALLING_TESTS_TYPE_OBJECT, NULL);
4189 * gi_marshalling_tests_object_full_return:
4191 * Returns: (transfer full):
4193 GIMarshallingTestsObject *
4194 gi_marshalling_tests_object_full_return (void)
4196 return g_object_new (GI_MARSHALLING_TESTS_TYPE_OBJECT, NULL);
4200 * gi_marshalling_tests_object_none_in:
4201 * @object: (transfer none):
4204 gi_marshalling_tests_object_none_in (GIMarshallingTestsObject *object)
4206 g_assert_cmpint (object->int_, ==, 42);
4210 * gi_marshalling_tests_object_none_out:
4211 * @object: (out) (transfer none):
4214 gi_marshalling_tests_object_none_out (GIMarshallingTestsObject **object)
4216 static GIMarshallingTestsObject *new_object = NULL;
4218 if (new_object == NULL)
4220 new_object = g_object_new (GI_MARSHALLING_TESTS_TYPE_OBJECT, NULL);
4223 *object = new_object;
4227 * gi_marshalling_tests_object_full_out:
4228 * @object: (out) (transfer full):
4231 gi_marshalling_tests_object_full_out (GIMarshallingTestsObject **object)
4233 *object = g_object_new (GI_MARSHALLING_TESTS_TYPE_OBJECT, NULL);
4237 * gi_marshalling_tests_object_none_inout:
4238 * @object: (inout) (transfer none):
4241 gi_marshalling_tests_object_none_inout (GIMarshallingTestsObject **object)
4243 static GIMarshallingTestsObject *new_object = NULL;
4245 g_assert_cmpint ((*object)->int_, ==, 42);
4247 if (new_object == NULL)
4249 new_object = g_object_new (GI_MARSHALLING_TESTS_TYPE_OBJECT, NULL);
4250 new_object->int_ = 0;
4253 *object = new_object;
4257 * gi_marshalling_tests_object_full_inout:
4258 * @object: (inout) (transfer full):
4261 gi_marshalling_tests_object_full_inout (GIMarshallingTestsObject **object)
4263 g_assert_cmpint ((*object)->int_, ==, 42);
4265 g_object_unref (*object);
4266 *object = g_object_new (GI_MARSHALLING_TESTS_TYPE_OBJECT, NULL);
4270 * gi_marshalling_tests_object_int8_in:
4274 gi_marshalling_tests_object_int8_in (GIMarshallingTestsObject *object, gint8 in)
4276 gi_marshalling_tests_object_method_int8_in (object, in);
4280 * gi_marshalling_tests_object_int8_out:
4284 gi_marshalling_tests_object_int8_out (GIMarshallingTestsObject *object, gint8 *out)
4286 gi_marshalling_tests_object_method_int8_out (object, out);
4290 * gi_marshalling_tests_object_vfunc_return_value_only:
4293 gi_marshalling_tests_object_vfunc_return_value_only (GIMarshallingTestsObject *self)
4295 /* make sure that local variables don't get smashed */
4297 gulong local = 0x12345678;
4298 return_value = GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_return_value_only (self);
4299 g_assert_cmpint (local, ==, 0x12345678);
4300 return return_value;
4304 * gi_marshalling_tests_object_vfunc_one_out_parameter:
4308 gi_marshalling_tests_object_vfunc_one_out_parameter (GIMarshallingTestsObject *self, gfloat *a)
4310 /* make sure that local variables don't get smashed */
4311 gulong local = 0x12345678;
4312 GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_one_out_parameter (self, a);
4313 g_assert_cmpint (local, ==, 0x12345678);
4317 * gi_marshalling_tests_object_vfunc_multiple_out_parameters:
4321 void gi_marshalling_tests_object_vfunc_multiple_out_parameters (GIMarshallingTestsObject *self, gfloat *a, gfloat *b)
4323 /* make sure that local variables don't get smashed */
4324 gulong local = 0x12345678;
4325 GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_multiple_out_parameters (self, a, b);
4326 g_assert_cmpint (local, ==, 0x12345678);
4330 * gi_marshalling_tests_object_vfunc_caller_allocated_out_parameter:
4333 void gi_marshalling_tests_object_vfunc_caller_allocated_out_parameter (GIMarshallingTestsObject *self, GValue *a)
4335 /* make sure that local variables don't get smashed */
4336 gulong local = 0x12345678;
4337 GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_caller_allocated_out_parameter (self, a);
4338 g_assert_cmpint (local, ==, 0x12345678);
4342 * gi_marshalling_tests_object_vfunc_array_out_parameter:
4343 * @a: (out) (array zero-terminated):
4345 void gi_marshalling_tests_object_vfunc_array_out_parameter (GIMarshallingTestsObject *self, gfloat **a)
4347 /* make sure that local variables don't get smashed */
4348 gulong local = 0x12345678;
4349 GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_array_out_parameter (self, a);
4350 g_assert_cmpint (local, ==, 0x12345678);
4354 * gi_marshalling_tests_object_vfunc_return_value_and_one_out_parameter:
4357 glong gi_marshalling_tests_object_vfunc_return_value_and_one_out_parameter (GIMarshallingTestsObject *self, glong *a)
4359 /* make sure that local variables don't get smashed */
4360 gulong return_value;
4361 gulong local = 0x12345678;
4362 return_value = GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_return_value_and_one_out_parameter (self, a);
4363 g_assert_cmpint (local, ==, 0x12345678);
4364 return return_value;
4368 * gi_marshalling_tests_object_vfunc_return_value_and_multiple_out_parameters:
4373 gi_marshalling_tests_object_vfunc_return_value_and_multiple_out_parameters
4374 (GIMarshallingTestsObject *self, glong *a, glong *b)
4376 gulong return_value;
4377 gulong local = 0x12345678;
4379 GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_return_value_and_multiple_out_parameters (self, a, b);
4380 g_assert_cmpint (local, ==, 0x12345678);
4381 return return_value;
4385 * gi_marshalling_tests_callback_owned_boxed:
4386 * @callback: (scope call) (closure callback_data):
4387 * @callback_data: (allow-none):
4390 gi_marshalling_tests_callback_owned_boxed (GIMarshallingTestsCallbackOwnedBoxed callback,
4391 void *callback_data)
4393 static GIMarshallingTestsBoxedStruct *box = NULL;
4397 box = gi_marshalling_tests_boxed_struct_new ();
4399 callback (box, callback_data);
4405 gi_marshalling_tests_object_vfunc_meth_with_error (GIMarshallingTestsObject *self, gint x, GError **error)
4407 gulong local = 0x12345678;
4408 gboolean ret = GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_meth_with_err (self,
4411 g_assert_cmpint (local, ==, 0x12345678);
4416 * gi_marshalling_tests_object_vfunc_return_enum:
4418 GIMarshallingTestsEnum
4419 gi_marshalling_tests_object_vfunc_return_enum (GIMarshallingTestsObject *self)
4421 /* make sure that local variables don't get smashed */
4422 GIMarshallingTestsEnum return_value;
4423 glong local = 0x12345678;
4424 return_value = GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_return_enum (self);
4425 g_assert_cmpint (local, ==, 0x12345678);
4426 return return_value;
4430 * gi_marshalling_tests_object_vfunc_out_enum:
4434 gi_marshalling_tests_object_vfunc_out_enum (GIMarshallingTestsObject *self, GIMarshallingTestsEnum *_enum)
4436 /* make sure that local variables don't get smashed */
4437 gulong local = 0x12345678;
4438 GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_out_enum (self, _enum);
4439 g_assert_cmpint (local, ==, 0x12345678);
4445 * The following (get_ref_info_for_*) methods are designed to call vfuncs related
4446 * to object argument marshaling. They do not pass the resulting objects through them
4447 * as regular vfunc wrapper method do, but rather return reference count and floating
4448 * information back to the callers. This is useful because callers can do testing of
4449 * expected reference counts in isolation and from the perspective of C. This is important
4450 * because if there are bugs in the reverse marshaling, they can obfuscate or compound
4451 * bugs in marshaling from the vfuncs.
4455 * gi_marshalling_tests_object_get_ref_info_for_vfunc_return_object_transfer_none:
4456 * @ref_count: (out): Ref count of the object returned from the vfunc directly after vfunc call.
4457 * @is_floating: (out): Floating state object returned from the vfunc directly after vfunc call.
4460 gi_marshalling_tests_object_get_ref_info_for_vfunc_return_object_transfer_none
4461 (GIMarshallingTestsObject *self, guint *ref_count, gboolean *is_floating)
4463 GObject *object = GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_return_object_transfer_none (self);
4464 *ref_count = object->ref_count;
4465 *is_floating = g_object_is_floating (object);
4467 /* Attempt to sink and unref the returned object and avoid any potential leaks */
4468 g_object_ref_sink (object);
4469 g_object_unref (object);
4473 * gi_marshalling_tests_object_get_ref_info_for_vfunc_return_object_transfer_full:
4474 * @ref_count: (out): Ref count of the object returned from the vfunc directly after vfunc call.
4475 * @is_floating: (out): Floating state object returned from the vfunc directly after vfunc call.
4478 gi_marshalling_tests_object_get_ref_info_for_vfunc_return_object_transfer_full
4479 (GIMarshallingTestsObject *self, guint *ref_count, gboolean *is_floating)
4481 GObject *object = GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_return_object_transfer_full (self);
4482 *ref_count = object->ref_count;
4483 *is_floating = g_object_is_floating (object);
4484 g_object_unref (object);
4488 * gi_marshalling_tests_object_get_ref_info_for_vfunc_out_object_transfer_none:
4489 * @ref_count: (out): Ref count of the object returned from the vfunc directly after vfunc call.
4490 * @is_floating: (out): Floating state object returned from the vfunc directly after vfunc call.
4493 gi_marshalling_tests_object_get_ref_info_for_vfunc_out_object_transfer_none
4494 (GIMarshallingTestsObject *self, guint *ref_count, gboolean *is_floating)
4496 GObject *object = NULL;
4497 GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_out_object_transfer_none (self, &object);
4498 *ref_count = object->ref_count;
4499 *is_floating = g_object_is_floating (object);
4501 /* Attempt to sink and unref the returned object and avoid any potential leaks */
4502 g_object_ref_sink (object);
4503 g_object_unref (object);
4507 * gi_marshalling_tests_object_get_ref_info_for_vfunc_out_object_transfer_full:
4508 * @ref_count: (out): Ref count of the object returned from the vfunc directly after vfunc call.
4509 * @is_floating: (out): Floating state object returned from the vfunc directly after vfunc call.
4512 gi_marshalling_tests_object_get_ref_info_for_vfunc_out_object_transfer_full
4513 (GIMarshallingTestsObject *self, guint *ref_count, gboolean *is_floating)
4515 GObject *object = NULL;
4516 GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_out_object_transfer_full (self, &object);
4517 *ref_count = object->ref_count;
4518 *is_floating = g_object_is_floating (object);
4519 g_object_unref (object);
4523 _vfunc_in_object_destroy_callback (gboolean *destroy_called, GObject *where_the_object_was)
4525 *destroy_called = TRUE;
4529 * gi_marshalling_tests_object_get_ref_info_for_vfunc_in_object_transfer_none:
4530 * @type: GType of object to create and pass as in argument to the vfunc
4531 * @ref_count: (out): Ref count of the in object directly after vfunc call.
4532 * @is_floating: (out): Floating state of in object directly after vfunc call.
4534 * Calls vfunc_in_object_transfer_none with a new object of the given type.
4537 gi_marshalling_tests_object_get_ref_info_for_vfunc_in_object_transfer_none
4538 (GIMarshallingTestsObject *self, GType type, guint *ref_count, gboolean *is_floating)
4540 static gboolean destroy_called;
4542 destroy_called = FALSE;
4544 object = g_object_new (type, NULL);
4545 g_object_weak_ref (object, (GWeakNotify) _vfunc_in_object_destroy_callback, &destroy_called);
4547 GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_in_object_transfer_none (self, object);
4551 *is_floating = FALSE;
4555 *ref_count = object->ref_count;
4556 *is_floating = g_object_is_floating (object);
4557 g_object_unref (object);
4563 * gi_marshalling_tests_object_get_ref_info_for_vfunc_in_object_transfer_full:
4564 * @type: GType of object to create and pass as in argument to the vfunc
4565 * @ref_count: (out): Ref count of the in object directly after vfunc call.
4566 * @is_floating: (out): Floating state of in object directly after vfunc call.
4569 gi_marshalling_tests_object_get_ref_info_for_vfunc_in_object_transfer_full
4570 (GIMarshallingTestsObject *self, GType type, guint *ref_count, gboolean *is_floating)
4572 static gboolean destroy_called;
4574 destroy_called = FALSE;
4576 object = g_object_new (type, NULL);
4577 g_object_weak_ref (object, (GWeakNotify) _vfunc_in_object_destroy_callback, &destroy_called);
4579 /* Calling the vfunc takes ownership of the object, so we use a weak_ref to determine
4580 * if the object gets destroyed after the call and appropriately return 0 as the ref count.
4582 GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_in_object_transfer_full (self, object);
4586 *is_floating = FALSE;
4590 *ref_count = object->ref_count;
4591 *is_floating = g_object_is_floating (object);
4596 G_DEFINE_TYPE (GIMarshallingTestsSubObject, gi_marshalling_tests_sub_object, GI_MARSHALLING_TESTS_TYPE_OBJECT);
4599 gi_marshalling_tests_sub_object_init (GIMarshallingTestsSubObject *object)
4604 gi_marshalling_tests_sub_object_finalize (GObject *object)
4606 G_OBJECT_CLASS (gi_marshalling_tests_sub_object_parent_class)->finalize (object);
4610 method_deep_hierarchy (GIMarshallingTestsObject *self, gint8 in)
4612 GValue val = { 0, };
4613 g_value_init (&val, G_TYPE_INT);
4614 g_value_set_int (&val, in);
4615 g_object_set_property (G_OBJECT (self), "int", &val);
4619 gi_marshalling_tests_sub_object_class_init (GIMarshallingTestsSubObjectClass *klass)
4621 G_OBJECT_CLASS (klass)->finalize = gi_marshalling_tests_sub_object_finalize;
4622 GI_MARSHALLING_TESTS_OBJECT_CLASS (klass)->method_deep_hierarchy = method_deep_hierarchy;
4626 gi_marshalling_tests_sub_object_sub_method (GIMarshallingTestsSubObject *object)
4628 g_assert_cmpint (GI_MARSHALLING_TESTS_OBJECT (object)->int_, ==, 0);
4631 void gi_marshalling_tests_sub_object_overwritten_method (GIMarshallingTestsSubObject *object)
4633 g_assert_cmpint (GI_MARSHALLING_TESTS_OBJECT (object)->int_, ==, 0);
4636 G_DEFINE_TYPE (GIMarshallingTestsSubSubObject,
4637 gi_marshalling_tests_sub_sub_object, GI_MARSHALLING_TESTS_TYPE_SUB_OBJECT);
4640 gi_marshalling_tests_sub_sub_object_init (GIMarshallingTestsSubSubObject *object)
4644 static void gi_marshalling_tests_sub_sub_object_class_init (GIMarshallingTestsSubSubObjectClass *klass)
4651 gi_marshalling_tests_interface_class_init (void *g_iface)
4656 gi_marshalling_tests_interface_get_type (void)
4658 static GType type = 0;
4661 /* Not adding prerequisite here for test purposes */
4662 type = g_type_register_static_simple (G_TYPE_INTERFACE,
4663 "GIMarshallingTestsInterface",
4665 (GIMarshallingTestsInterfaceIface),
4666 (GClassInitFunc) gi_marshalling_tests_interface_class_init, 0, NULL, 0);
4673 * gi_marshalling_tests_interface_test_int8_in:
4677 gi_marshalling_tests_interface_test_int8_in (GIMarshallingTestsInterface *self, gint8 in)
4679 GI_MARSHALLING_TESTS_INTERFACE_GET_IFACE (self)->test_int8_in (self, in);
4683 * gi_marshalling_tests_test_interface_test_int8_in:
4687 gi_marshalling_tests_test_interface_test_int8_in (GIMarshallingTestsInterface *test_iface, gint8 in)
4689 gi_marshalling_tests_interface_test_int8_in (test_iface, in);
4693 static void test_interface_init (GIMarshallingTestsInterfaceIface *iface);
4695 G_DEFINE_TYPE_WITH_CODE (GIMarshallingTestsInterfaceImpl, gi_marshalling_tests_interface_impl, G_TYPE_OBJECT,
4696 G_IMPLEMENT_INTERFACE(GI_MARSHALLING_TESTS_TYPE_INTERFACE, test_interface_init))
4699 gi_marshalling_tests_interface_impl_test_int8_in (GIMarshallingTestsInterface *self, gint8 in)
4703 static void test_interface_init (GIMarshallingTestsInterfaceIface *iface)
4705 iface->test_int8_in = gi_marshalling_tests_interface_impl_test_int8_in;
4709 gi_marshalling_tests_interface_impl_init (GIMarshallingTestsInterfaceImpl *object)
4714 gi_marshalling_tests_interface_impl_class_init (GIMarshallingTestsInterfaceImplClass *klass)
4719 * gi_marshalling_tests_interface_impl_get_as_interface:
4721 * Returns: (transfer none):
4723 GIMarshallingTestsInterface *
4724 gi_marshalling_tests_interface_impl_get_as_interface (GIMarshallingTestsInterfaceImpl *self)
4726 return (GIMarshallingTestsInterface *) self;
4730 gi_marshalling_tests_interface2_class_init (void *g_iface)
4735 gi_marshalling_tests_interface2_get_type (void)
4737 static GType type = 0;
4740 type = g_type_register_static_simple (G_TYPE_INTERFACE,
4741 "GIMarshallingTestsInterface2",
4743 (GIMarshallingTestsInterface2Iface),
4744 (GClassInitFunc) gi_marshalling_tests_interface2_class_init, 0, NULL, 0);
4751 gi_marshalling_tests_interface3_class_init (void *g_iface)
4756 gi_marshalling_tests_interface3_get_type (void)
4758 static GType type = 0;
4761 type = g_type_register_static_simple (G_TYPE_INTERFACE,
4762 "GIMarshallingTestsInterface3",
4764 (GIMarshallingTestsInterface3Iface),
4765 (GClassInitFunc) gi_marshalling_tests_interface3_class_init, 0, NULL, 0);
4772 * gi_marshalling_tests_interface3_test_variant_array_in:
4773 * @in: (array length=n_in):
4777 gi_marshalling_tests_interface3_test_variant_array_in
4778 (GIMarshallingTestsInterface3 *self, GVariant **in, gsize n_in)
4780 GI_MARSHALLING_TESTS_INTERFACE3_GET_IFACE (self)->test_variant_array_in (self, in, n_in);
4784 * gi_marshalling_tests_int_out_out:
4789 gi_marshalling_tests_int_out_out (gint *int0, gint *int1)
4796 * gi_marshalling_tests_int_three_in_three_out:
4805 gi_marshalling_tests_int_three_in_three_out (gint a, gint b, gint c, gint *out0, gint *out1, gint *out2)
4813 * gi_marshalling_tests_int_return_out:
4817 gi_marshalling_tests_int_return_out (gint *int_)
4824 * gi_marshalling_tests_int_two_in_utf8_two_in_with_allow_none:
4825 * @a: (in): Must be 1
4826 * @b: (in): Must be 2
4827 * @c: (in) (allow-none): Must be "3" or NULL
4828 * @d: (in) (allow-none): Must be "4" or NULL
4831 gi_marshalling_tests_int_two_in_utf8_two_in_with_allow_none (gint a, gint b, const gchar *c, const gchar *d)
4833 g_assert_cmpint (a, ==, 1);
4834 g_assert_cmpint (b, ==, 2);
4836 g_assert_cmpstr (c, ==, "3");
4838 g_assert_cmpstr (d, ==, "4");
4842 * gi_marshalling_tests_int_one_in_utf8_two_in_one_allows_none:
4843 * @a: (in): Must be 1
4844 * @b: (in) (allow-none): Must be "2" or NULL
4845 * @c: (in): Must be "3"
4848 gi_marshalling_tests_int_one_in_utf8_two_in_one_allows_none (gint a, const gchar *b, const gchar *c)
4850 g_assert_cmpint (a, ==, 1);
4852 g_assert_cmpstr (b, ==, "2");
4853 g_assert_cmpstr (c, ==, "3");
4857 * gi_marshalling_tests_array_in_utf8_two_in:
4858 * @ints: (array length=length):
4860 * @a: (in) (allow-none): Must be "1" or NULL
4861 * @b: (in) (allow-none): Must be "2" or NULL
4864 gi_marshalling_tests_array_in_utf8_two_in (const gint *ints, gint length, const gchar *a, const gchar *b)
4866 g_assert_cmpint (length, ==, 4);
4867 g_assert_cmpint (ints[0], ==, -1);
4868 g_assert_cmpint (ints[1], ==, 0);
4869 g_assert_cmpint (ints[2], ==, 1);
4870 g_assert_cmpint (ints[3], ==, 2);
4873 g_assert_cmpstr (a, ==, "1");
4875 g_assert_cmpstr (b, ==, "2");
4879 * gi_marshalling_tests_array_in_utf8_two_in_out_of_order:
4881 * @a: (in) (allow-none): Must be "1" or NULL
4882 * @ints: (array length=length):
4883 * @b: (in) (allow-none): Must be "2" or NULL
4886 gi_marshalling_tests_array_in_utf8_two_in_out_of_order (gint length, const gchar *a, const gint *ints, const gchar *b)
4888 g_assert_cmpint (length, ==, 4);
4889 g_assert_cmpint (ints[0], ==, -1);
4890 g_assert_cmpint (ints[1], ==, 0);
4891 g_assert_cmpint (ints[2], ==, 1);
4892 g_assert_cmpint (ints[3], ==, 2);
4895 g_assert_cmpstr (a, ==, "1");
4897 g_assert_cmpstr (b, ==, "2");
4903 gi_marshalling_tests_gerror (GError **error)
4905 GQuark quark = g_quark_from_static_string (GI_MARSHALLING_TESTS_CONSTANT_GERROR_DOMAIN);
4906 g_set_error_literal (error, quark,
4907 GI_MARSHALLING_TESTS_CONSTANT_GERROR_CODE, GI_MARSHALLING_TESTS_CONSTANT_GERROR_MESSAGE);
4911 * gi_marshalling_tests_gerror_array_in:
4912 * @in_ints: (array zero-terminated):
4915 gi_marshalling_tests_gerror_array_in (gint *in_ints, GError **error)
4917 GQuark quark = g_quark_from_static_string (GI_MARSHALLING_TESTS_CONSTANT_GERROR_DOMAIN);
4918 g_set_error_literal (error, quark,
4919 GI_MARSHALLING_TESTS_CONSTANT_GERROR_CODE, GI_MARSHALLING_TESTS_CONSTANT_GERROR_MESSAGE);
4923 * gi_marshalling_tests_gerror_out:
4924 * @error: (out) (allow-none) (transfer full): location for the GError.
4925 * @debug: (out) (allow-none) (transfer full): location for the debug message
4927 * Inspired by gst_message_parse_error.
4930 gi_marshalling_tests_gerror_out (GError **error, gchar **debug)
4932 GQuark quark = g_quark_from_static_string (GI_MARSHALLING_TESTS_CONSTANT_GERROR_DOMAIN);
4933 g_set_error_literal (error, quark,
4934 GI_MARSHALLING_TESTS_CONSTANT_GERROR_CODE, GI_MARSHALLING_TESTS_CONSTANT_GERROR_MESSAGE);
4938 *debug = g_strdup (GI_MARSHALLING_TESTS_CONSTANT_GERROR_DEBUG_MESSAGE);
4943 * gi_marshalling_tests_gerror_out_transfer_none:
4944 * @err: (out) (allow-none) (transfer none): location for the GError.
4945 * @debug: (out) (allow-none) (transfer none): location for the debug message
4947 * A variant of gi_marshalling_tests_gerror_out() which returns data the caller
4951 gi_marshalling_tests_gerror_out_transfer_none (GError **err, const gchar **debug)
4953 static GError error = { 0,
4954 GI_MARSHALLING_TESTS_CONSTANT_GERROR_CODE,
4955 GI_MARSHALLING_TESTS_CONSTANT_GERROR_MESSAGE
4957 error.domain = g_quark_from_static_string (GI_MARSHALLING_TESTS_CONSTANT_GERROR_DOMAIN);
4959 *debug = GI_MARSHALLING_TESTS_CONSTANT_GERROR_DEBUG_MESSAGE;
4963 * gi_marshalling_tests_gerror_return:
4965 * Yet another variant of gi_marshalling_tests_gerror_out().
4967 * Returns: (transfer full): a GError
4970 gi_marshalling_tests_gerror_return (void)
4972 GQuark quark = g_quark_from_static_string (GI_MARSHALLING_TESTS_CONSTANT_GERROR_DOMAIN);
4974 return g_error_new (quark, GI_MARSHALLING_TESTS_CONSTANT_GERROR_CODE, GI_MARSHALLING_TESTS_CONSTANT_GERROR_MESSAGE);
4977 static GIMarshallingTestsOverridesStruct *
4978 gi_marshalling_tests_overrides_struct_copy (GIMarshallingTestsOverridesStruct *struct_)
4980 GIMarshallingTestsOverridesStruct *new_struct;
4982 new_struct = g_slice_new (GIMarshallingTestsOverridesStruct);
4984 *new_struct = *struct_;
4990 gi_marshalling_tests_overrides_struct_free (GIMarshallingTestsOverridesStruct *struct_)
4992 g_slice_free (GIMarshallingTestsOverridesStruct, struct_);
4996 gi_marshalling_tests_overrides_struct_get_type (void)
4998 static GType type = 0;
5003 g_boxed_type_register_static ("GIMarshallingTestsOverridesStruct",
5005 gi_marshalling_tests_overrides_struct_copy,
5006 (GBoxedFreeFunc) gi_marshalling_tests_overrides_struct_free);
5012 GIMarshallingTestsOverridesStruct *
5013 gi_marshalling_tests_overrides_struct_new (void)
5015 return g_slice_new (GIMarshallingTestsOverridesStruct);
5018 glong gi_marshalling_tests_overrides_struct_method (GIMarshallingTestsOverridesStruct *struct_)
5025 * gi_marshalling_tests_overrides_struct_returnv:
5027 * Returns: (transfer full):
5029 GIMarshallingTestsOverridesStruct *
5030 gi_marshalling_tests_overrides_struct_returnv (void)
5032 return gi_marshalling_tests_overrides_struct_new ();
5036 G_DEFINE_TYPE (GIMarshallingTestsOverridesObject, gi_marshalling_tests_overrides_object, G_TYPE_OBJECT);
5039 gi_marshalling_tests_overrides_object_init (GIMarshallingTestsOverridesObject *object)
5044 gi_marshalling_tests_overrides_object_finalize (GObject *object)
5046 G_OBJECT_CLASS (gi_marshalling_tests_overrides_object_parent_class)->finalize (object);
5049 static void gi_marshalling_tests_overrides_object_class_init (GIMarshallingTestsOverridesObjectClass *klass)
5051 GObjectClass *object_class = G_OBJECT_CLASS (klass);
5053 GObjectClass *parent_class = G_OBJECT_CLASS (klass);
5056 object_class->finalize = gi_marshalling_tests_overrides_object_finalize;
5059 GIMarshallingTestsOverridesObject *
5060 gi_marshalling_tests_overrides_object_new (void)
5062 return g_object_new (GI_MARSHALLING_TESTS_TYPE_OVERRIDES_OBJECT, NULL);
5065 glong gi_marshalling_tests_overrides_object_method (GIMarshallingTestsOverridesObject *object)
5071 * gi_marshalling_tests_overrides_object_returnv:
5073 * Returns: (transfer full):
5075 GIMarshallingTestsOverridesObject *
5076 gi_marshalling_tests_overrides_object_returnv (void)
5078 return g_object_new (GI_MARSHALLING_TESTS_TYPE_OVERRIDES_OBJECT, NULL);
5082 * gi_marshalling_tests_filename_list_return:
5084 * Returns: (transfer none) (element-type filename): List of filenames
5087 gi_marshalling_tests_filename_list_return (void)
5093 * gi_marshalling_tests_param_spec_in_bool:
5096 gi_marshalling_tests_param_spec_in_bool (const GParamSpec *param)
5098 g_assert (G_IS_PARAM_SPEC (param));
5099 g_assert_cmpint (G_PARAM_SPEC_VALUE_TYPE (param), ==, G_TYPE_BOOLEAN);
5100 g_assert_cmpstr (g_param_spec_get_name ((GParamSpec *) param), ==, "mybool");
5104 * gi_marshalling_tests_param_spec_return:
5106 * Returns: (transfer full): a #GParamSpec
5109 gi_marshalling_tests_param_spec_return (void)
5111 return g_param_spec_string ("test-param", "test", "This is a test", "42", G_PARAM_READABLE);
5115 * gi_marshalling_tests_param_spec_out:
5119 gi_marshalling_tests_param_spec_out (GParamSpec **param)
5121 *param = g_param_spec_string ("test-param", "test", "This is a test", "42", G_PARAM_READABLE);
5128 SOME_BOOLEAN_PROPERTY,
5130 SOME_UCHAR_PROPERTY,
5134 SOME_ULONG_PROPERTY,
5135 SOME_INT64_PROPERTY,
5136 SOME_UINT64_PROPERTY,
5137 SOME_FLOAT_PROPERTY,
5138 SOME_DOUBLE_PROPERTY,
5140 SOME_BOXED_STRUCT_PROPERTY,
5141 SOME_VARIANT_PROPERTY,
5142 SOME_BOXED_GLIST_PROPERTY,
5143 SOME_OBJECT_PROPERTY,
5146 G_DEFINE_TYPE (GIMarshallingTestsPropertiesObject, gi_marshalling_tests_properties_object, G_TYPE_OBJECT);
5148 static void gi_marshalling_tests_properties_object_init (GIMarshallingTestsPropertiesObject *self)
5153 gi_marshalling_tests_properties_object_finalize (GObject *obj)
5155 GIMarshallingTestsPropertiesObject *self;
5156 self = GI_MARSHALLING_TESTS_PROPERTIES_OBJECT (obj);
5158 if (self->some_strv != NULL) {
5159 g_strfreev (self->some_strv);
5160 self->some_strv = NULL;
5163 G_OBJECT_CLASS (gi_marshalling_tests_properties_object_parent_class)->finalize (obj);
5167 gi_marshalling_tests_properties_object_get_property (GObject *object,
5168 guint property_id, GValue *value, GParamSpec *pspec)
5170 GIMarshallingTestsPropertiesObject *self;
5171 self = GI_MARSHALLING_TESTS_PROPERTIES_OBJECT (object);
5172 switch (property_id)
5174 case SOME_BOOLEAN_PROPERTY:
5175 g_value_set_boolean (value, self->some_boolean);
5177 case SOME_CHAR_PROPERTY:
5178 g_value_set_schar (value, self->some_char);
5180 case SOME_UCHAR_PROPERTY:
5181 g_value_set_uchar (value, self->some_uchar);
5183 case SOME_INT_PROPERTY:
5184 g_value_set_int (value, self->some_int);
5186 case SOME_UINT_PROPERTY:
5187 g_value_set_uint (value, self->some_uint);
5189 case SOME_LONG_PROPERTY:
5190 g_value_set_long (value, self->some_long);
5192 case SOME_ULONG_PROPERTY:
5193 g_value_set_ulong (value, self->some_ulong);
5195 case SOME_INT64_PROPERTY:
5196 g_value_set_int64 (value, self->some_int64);
5198 case SOME_UINT64_PROPERTY:
5199 g_value_set_uint64 (value, self->some_uint64);
5201 case SOME_FLOAT_PROPERTY:
5202 g_value_set_float (value, self->some_float);
5204 case SOME_DOUBLE_PROPERTY:
5205 g_value_set_double (value, self->some_double);
5207 case SOME_STRV_PROPERTY:
5208 g_value_set_boxed (value, self->some_strv);
5210 case SOME_BOXED_STRUCT_PROPERTY:
5211 g_value_set_boxed (value, self->some_boxed_struct);
5213 case SOME_BOXED_GLIST_PROPERTY:
5214 g_value_set_boxed (value, self->some_boxed_glist);
5216 case SOME_VARIANT_PROPERTY:
5217 g_value_set_variant (value, self->some_variant);
5219 case SOME_OBJECT_PROPERTY:
5220 g_value_set_object (value, self->some_object);
5223 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
5229 gi_marshalling_tests_properties_object_set_property (GObject *object,
5230 guint property_id, const GValue *value, GParamSpec *pspec)
5232 GIMarshallingTestsPropertiesObject *self;
5233 self = GI_MARSHALLING_TESTS_PROPERTIES_OBJECT (object);
5234 switch (property_id)
5236 case SOME_BOOLEAN_PROPERTY:
5237 self->some_boolean = g_value_get_boolean (value);
5239 case SOME_CHAR_PROPERTY:
5240 self->some_char = g_value_get_schar (value);
5242 case SOME_UCHAR_PROPERTY:
5243 self->some_uchar = g_value_get_uchar (value);
5245 case SOME_INT_PROPERTY:
5246 self->some_int = g_value_get_int (value);
5248 case SOME_UINT_PROPERTY:
5249 self->some_uint = g_value_get_uint (value);
5251 case SOME_LONG_PROPERTY:
5252 self->some_long = g_value_get_long (value);
5254 case SOME_ULONG_PROPERTY:
5255 self->some_ulong = g_value_get_ulong (value);
5257 case SOME_INT64_PROPERTY:
5258 self->some_int64 = g_value_get_int64 (value);
5260 case SOME_UINT64_PROPERTY:
5261 self->some_uint64 = g_value_get_uint64 (value);
5263 case SOME_FLOAT_PROPERTY:
5264 self->some_float = g_value_get_float (value);
5266 case SOME_DOUBLE_PROPERTY:
5267 self->some_double = g_value_get_double (value);
5269 case SOME_STRV_PROPERTY:
5270 g_strfreev (self->some_strv);
5271 self->some_strv = g_strdupv (g_value_get_boxed (value));
5273 case SOME_BOXED_STRUCT_PROPERTY:
5274 gi_marshalling_tests_boxed_struct_free (self->some_boxed_struct);
5275 self->some_boxed_struct = gi_marshalling_tests_boxed_struct_copy (g_value_get_boxed (value));
5277 case SOME_BOXED_GLIST_PROPERTY:
5278 g_list_free (self->some_boxed_glist);
5279 self->some_boxed_glist = g_list_copy (g_value_get_boxed (value));
5281 case SOME_VARIANT_PROPERTY:
5282 if (self->some_variant != NULL)
5283 g_variant_unref (self->some_variant);
5284 self->some_variant = g_value_get_variant (value);
5285 if (self->some_variant != NULL)
5286 g_variant_ref (self->some_variant);
5288 case SOME_OBJECT_PROPERTY:
5289 if (self->some_object != NULL)
5290 g_object_unref (self->some_object);
5291 self->some_object = g_value_dup_object (value);
5294 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
5299 static void gi_marshalling_tests_properties_object_class_init (GIMarshallingTestsPropertiesObjectClass *klass)
5301 GObjectClass *object_class = G_OBJECT_CLASS (klass);
5303 object_class->finalize = gi_marshalling_tests_properties_object_finalize;
5304 object_class->get_property = gi_marshalling_tests_properties_object_get_property;
5305 object_class->set_property = gi_marshalling_tests_properties_object_set_property;
5307 g_object_class_install_property (object_class, SOME_BOOLEAN_PROPERTY,
5308 g_param_spec_boolean ("some-boolean",
5312 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
5314 g_object_class_install_property (object_class, SOME_CHAR_PROPERTY,
5315 g_param_spec_char ("some-char",
5317 "some-char", G_MININT8,
5319 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
5321 g_object_class_install_property (object_class, SOME_UCHAR_PROPERTY,
5322 g_param_spec_uchar ("some-uchar",
5326 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
5328 g_object_class_install_property (object_class, SOME_INT_PROPERTY,
5329 g_param_spec_int ("some-int", "some-int",
5330 "some-int", G_MININT,
5332 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
5334 g_object_class_install_property (object_class, SOME_UINT_PROPERTY,
5335 g_param_spec_uint ("some-uint",
5339 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
5341 g_object_class_install_property (object_class, SOME_LONG_PROPERTY,
5342 g_param_spec_long ("some-long",
5344 "some-long", G_MINLONG,
5346 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
5348 g_object_class_install_property (object_class, SOME_ULONG_PROPERTY,
5349 g_param_spec_ulong ("some-ulong",
5353 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
5355 g_object_class_install_property (object_class, SOME_INT64_PROPERTY,
5356 g_param_spec_int64 ("some-int64",
5359 G_MININT64, G_MAXINT64,
5360 0, G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
5362 g_object_class_install_property (object_class, SOME_UINT64_PROPERTY,
5363 g_param_spec_uint64 ("some-uint64",
5367 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
5369 g_object_class_install_property (object_class, SOME_FLOAT_PROPERTY,
5370 g_param_spec_float ("some-float",
5375 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
5377 g_object_class_install_property (object_class, SOME_DOUBLE_PROPERTY,
5378 g_param_spec_double ("some-double",
5383 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
5385 g_object_class_install_property (object_class, SOME_STRV_PROPERTY,
5386 g_param_spec_boxed ("some-strv",
5390 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
5392 g_object_class_install_property (object_class, SOME_BOXED_STRUCT_PROPERTY,
5393 g_param_spec_boxed ("some-boxed-struct",
5394 "some-boxed-struct",
5395 "some-boxed-struct",
5396 gi_marshalling_tests_boxed_struct_get_type
5397 (), G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
5400 * GIMarshallingTestsPropertiesObject:some-boxed-glist: (type GLib.List(gint)) (transfer none):
5402 g_object_class_install_property (object_class, SOME_BOXED_GLIST_PROPERTY,
5403 g_param_spec_boxed ("some-boxed-glist",
5406 gi_marshalling_tests_boxed_glist_get_type
5407 (), G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
5409 g_object_class_install_property (object_class, SOME_VARIANT_PROPERTY,
5410 g_param_spec_variant ("some-variant",
5415 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
5417 g_object_class_install_property (object_class, SOME_OBJECT_PROPERTY,
5418 g_param_spec_object ("some-object",
5422 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
5425 GIMarshallingTestsPropertiesObject *
5426 gi_marshalling_tests_properties_object_new (void)
5428 return g_object_new (GI_MARSHALLING_TESTS_TYPE_PROPERTIES_OBJECT, NULL);