mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-03 06:32:10 +01:00
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
This commit is contained in:
parent
cbf8cf8598
commit
ef57996f44
@ -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 ();
|
||||
|
||||
|
@ -185,4 +185,20 @@
|
||||
<default>0</default>
|
||||
</key>
|
||||
</schema>
|
||||
|
||||
<schema id='org.gtk.test.extends.base'>
|
||||
<key name='int32' type='i'>
|
||||
<default>0</default>
|
||||
</key>
|
||||
<key name='string' type='s'>
|
||||
<default>''</default>
|
||||
</key>
|
||||
</schema>
|
||||
<schema id='org.gtk.test.extends.extended' extends='org.gtk.test.extends.base'>
|
||||
<override name="int32">42</override>
|
||||
<key name='another-int32' type='i'>
|
||||
<default>0</default>
|
||||
</key>
|
||||
</schema>
|
||||
|
||||
</schemalist>
|
||||
|
Loading…
x
Reference in New Issue
Block a user