gsettings test: fix srcdir != builddir
authorRyan Lortie <desrt@desrt.ca>
Tue, 12 Nov 2013 04:17:32 +0000 (23:17 -0500)
committerRyan Lortie <desrt@desrt.ca>
Tue, 12 Nov 2013 05:05:04 +0000 (00:05 -0500)
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.

gio/tests/Makefile.am
gio/tests/gsettings.c

index 89a7cbd..5ac09d1 100644 (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               \
index ab54ad4..18156d6 100644 (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");