From ef57996f44d57a3c6f7abda5a447ca8baf9dfbea Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Sun, 27 Oct 2013 17:22:38 -0700 Subject: [PATCH] Add test for extended schemas The test checks that the keys of the base schema are all present in the extended schema. https://bugzilla.gnome.org/show_bug.cgi?id=645453 --- gio/tests/gsettings.c | 16 ++++++++++++++++ gio/tests/org.gtk.test.gschema.xml | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/gio/tests/gsettings.c b/gio/tests/gsettings.c index 35330b9..ab54ad4 100644 --- a/gio/tests/gsettings.c +++ b/gio/tests/gsettings.c @@ -2044,6 +2044,8 @@ test_list_schemas (void) g_assert (strv_set_equal ((gchar **)relocs, "org.gtk.test.no-path", + "org.gtk.test.extends.base", + "org.gtk.test.extends.extended", NULL)); g_assert (strv_set_equal ((gchar **)schemas, @@ -2368,6 +2370,19 @@ test_read_descriptions (void) g_object_unref (settings); } +static void +test_extended_schema (void) +{ + GSettings *settings; + gchar **keys; + + settings = g_settings_new_with_path ("org.gtk.test.extends.extended", "/test/extendes/"); + keys = g_settings_list_keys (settings); + g_assert (strv_set_equal (keys, "int32", "string", "another-int32", NULL)); + g_strfreev (keys); + g_object_unref (settings); +} + int main (int argc, char *argv[]) { @@ -2482,6 +2497,7 @@ main (int argc, char *argv[]) g_test_add_func ("/gsettings/null-backend", test_null_backend); g_test_add_func ("/gsettings/memory-backend", test_memory_backend); g_test_add_func ("/gsettings/read-descriptions", test_read_descriptions); + g_test_add_func ("/gsettings/test-extended-schema", test_extended_schema); result = g_test_run (); diff --git a/gio/tests/org.gtk.test.gschema.xml b/gio/tests/org.gtk.test.gschema.xml index 1ea8750..bda05a2 100644 --- a/gio/tests/org.gtk.test.gschema.xml +++ b/gio/tests/org.gtk.test.gschema.xml @@ -185,4 +185,20 @@ 0 + + + + 0 + + + '' + + + + 42 + + 0 + + + -- 2.7.4