[gobject-introspection] tests: Add flags and enum to GValue GHash in/out
- From: Martin Pitt <martinpitt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] tests: Add flags and enum to GValue GHash in/out
- Date: Wed, 25 Apr 2012 07:14:17 +0000 (UTC)
commit 36e2ddc12905d49cf4a212a411efc4ef18c3858e
Author: Martin Pitt <martinpitt gnome org>
Date: Tue Apr 24 13:19:43 2012 +0200
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
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 5254fa3..386e10d 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);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]