diff options
author | Martin Pitt <martinpitt@gnome.org> | 2012-04-24 13:19:43 +0200 |
---|---|---|
committer | Martin Pitt <martinpitt@gnome.org> | 2012-04-24 13:19:43 +0200 |
commit | 36e2ddc12905d49cf4a212a411efc4ef18c3858e (patch) | |
tree | bf3916c64c5afc4646d8693e5c50aee61e6b0248 /tests/scanner/regress.c | |
parent | d4b37b82ac49eacb17c3e7e2acf54533e27a11e4 (diff) | |
download | gobject-introspection-36e2ddc12905d49cf4a212a411efc4ef18c3858e.tar.gz |
tests: Add flags and enum to GValue GHash in/out
Add a flag and enum check to
the GHashes returned/expected by regress_test_ghash_gvalue_{return,in}().
https://bugzilla.gnome.org/show_bug.cgi?id=637466
Diffstat (limited to 'tests/scanner/regress.c')
-rw-r--r-- | tests/scanner/regress.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c index 5254fa34..386e10dd 100644 --- a/tests/scanner/regress.c +++ b/tests/scanner/regress.c @@ -1265,6 +1265,14 @@ regress_test_ghash_gvalue_return (void) g_value_set_boxed(value, string_array); g_hash_table_insert(hash, g_strdup("strings"), value); + value = g_value_new(REGRESS_TEST_TYPE_FLAGS); + g_value_set_flags(value, REGRESS_TEST_FLAG1 | REGRESS_TEST_FLAG3); + g_hash_table_insert(hash, g_strdup("flags"), value); + + value = g_value_new(regress_test_enum_get_type()); + g_value_set_enum(value, REGRESS_TEST_VALUE2); + g_hash_table_insert(hash, g_strdup("enum"), value); + return hash; } @@ -1304,6 +1312,16 @@ regress_test_ghash_gvalue_in (GHashTable *hash) g_assert(strings != NULL); for (i = 0; string_array[i] != NULL; i++) g_assert(strcmp(strings[i], string_array[i]) == 0); + + value = g_hash_table_lookup(hash, "flags"); + g_assert(value != NULL); + g_assert(G_VALUE_HOLDS_FLAGS(value)); + g_assert(g_value_get_flags(value) == REGRESS_TEST_FLAG1 | REGRESS_TEST_FLAG3); + + value = g_hash_table_lookup(hash, "enum"); + g_assert(value != NULL); + g_assert(G_VALUE_HOLDS_ENUM(value)); + g_assert(g_value_get_enum(value) == REGRESS_TEST_VALUE2); } /** |