gsettings test: fix srcdir != builddir

Just copy the schemas to the builddir and compile them in place instead
of trying to mess around with creating the compiled file in a different
dir.  This solves issues in the summary/description testcase when
GSettings expects the usual situation of having the .xml files present
in the same directory.
This commit is contained in:
Ryan Lortie 2013-11-11 23:17:32 -05:00
parent 1e5e3b64a8
commit 5c4f3f4dab
2 changed files with 6 additions and 5 deletions

View File

@ -324,6 +324,7 @@ dist_uninstalled_test_data += \
enums.xml.template
# Generated while running the testcase itself...
CLEANFILES += \
org.gtk.test.gschema.xml \
org.gtk.test.enums.xml \
gsettings.store \
gschemas.compiled \

View File

@ -2340,7 +2340,6 @@ test_read_descriptions (void)
GSettingsSchema *schema;
GSettingsSchemaKey *key;
GSettings *settings;
const gchar *str;
settings = g_settings_new ("org.gtk.test");
g_object_get (settings, "settings-schema", &schema, NULL);
@ -2386,6 +2385,7 @@ test_extended_schema (void)
int
main (int argc, char *argv[])
{
gchar *schema_text;
gchar *enums;
gint result;
@ -2412,11 +2412,11 @@ main (int argc, char *argv[])
g_assert (g_file_set_contents ("org.gtk.test.enums.xml", enums, -1, NULL));
g_free (enums);
g_assert (g_file_get_contents (SRCDIR "/org.gtk.test.gschema.xml", &schema_text, NULL, NULL));
g_assert (g_file_set_contents ("org.gtk.test.gschema.xml", schema_text, -1, NULL));
g_remove ("gschemas.compiled");
g_assert (g_spawn_command_line_sync ("../glib-compile-schemas --targetdir=. "
"--schema-file=org.gtk.test.enums.xml "
"--schema-file=" SRCDIR "/org.gtk.test.gschema.xml",
NULL, NULL, &result, NULL));
g_assert (g_spawn_command_line_sync ("../glib-compile-schemas .", NULL, NULL, &result, NULL));
g_assert (result == 0);
g_remove ("schema-source/gschemas.compiled");