diff options
author | Ryan Lortie <desrt@desrt.ca> | 2012-07-15 19:54:19 -0400 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2012-07-15 19:54:19 -0400 |
commit | 294003a9aec3a47c9fc2aff97f92d84a1f4f143d (patch) | |
tree | 2ed87c1d41770b1c1ab301191f728b1a9440fc6a /tests/dconf-mock-gvdb.c | |
parent | 0c9bee1cc0963f6c57dc8f7ffe9e86f216f6ac13 (diff) | |
download | dconf-294003a9aec3a47c9fc2aff97f92d84a1f4f143d.tar.gz |
tests/: test reading from various profile setups
Add a testcase that tests the engine by reading from an exhaustive
combination of different profile types and states (missing databases,
empty databases, databases with values, databases with locks, etc).
Among other things, this makes sure the lockdown logic is sane.
This is the testcase that caught the bug fixed in the last commit
(listing with a missing database file).
Diffstat (limited to 'tests/dconf-mock-gvdb.c')
-rw-r--r-- | tests/dconf-mock-gvdb.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/dconf-mock-gvdb.c b/tests/dconf-mock-gvdb.c index cb639e3..6bc6d14 100644 --- a/tests/dconf-mock-gvdb.c +++ b/tests/dconf-mock-gvdb.c @@ -147,19 +147,25 @@ GVariant * gvdb_table_get_value (GvdbTable *table, const gchar *key) { - GHashTable *hash_table = (GHashTable *) table; DConfMockGvdbItem *item; - item = g_hash_table_lookup (hash_table, key); + item = g_hash_table_lookup (table->table, key); - return item ? g_variant_ref (item->value) : NULL; + return (item && item->value) ? g_variant_ref (item->value) : NULL; } gchar ** -gvdb_table_list (GvdbTable *table, +gvdb_table_list (GvdbTable *table, const gchar *key) { - g_assert_not_reached (); + const gchar * const result[] = { "value", NULL }; + + g_assert_cmpstr (key, ==, "/"); + + if (!gvdb_table_has_value (table, "/value")) + return NULL; + + return g_strdupv ((gchar **) result); } GvdbTable * |