reftests: override GSETTINGS_SCHEMA_DIR when running tests

The reftest depends on a schema we install ourselves. Instruct GIO to
look in the build directory to avoid a cyclic dep.

https://bugzilla.gnome.org/show_bug.cgi?id=768930
This commit is contained in:
Cosimo Cecchi 2016-07-16 11:48:32 -07:00 committed by Matthias Clasen
parent f44baf51d9
commit d9dd7eb757
2 changed files with 22 additions and 0 deletions

View File

@ -464,6 +464,22 @@ EXTRA_DIST += \
reftests.test.in \
$(NULL)
GTK_GSETTINGS_SCHEMAS = \
$(top_srcdir)/gtk/org.gtk.Settings.ColorChooser.gschema.xml \
$(top_srcdir)/gtk/org.gtk.Settings.FileChooser.gschema.xml \
$(NULL)
BUILT_SOURCES = gschemas.compiled
CLEANFILES = gschemas.compiled
gschemas.compiled: $(GTK_GSETTINGS_SCHEMAS)
$(AM_V_GEN) $(GLIB_COMPILE_SCHEMAS) \
$(addprefix --schema-file=,$(GTK_GSETTINGS_SCHEMAS)) \
--targetdir=$(builddir)
all-am: gschemas.compiled
if BUILDOPT_INSTALL_TESTS
insttestdir=$(libexecdir)/installed-tests/$(PACKAGE)
insttest_PROGRAMS = gtk-reftest

View File

@ -58,6 +58,7 @@ parse_command_line (int *argc, char ***argv)
{
GError *error = NULL;
GOptionContext *context;
char *schema_dir;
context = g_option_context_new ("- run GTK reftests");
g_option_context_add_main_entries (context, test_args, NULL);
@ -71,6 +72,11 @@ parse_command_line (int *argc, char ***argv)
gtk_test_init (argc, argv);
/* g_test_build_filename must be called after gtk_test_init */
schema_dir = g_test_build_filename (G_TEST_BUILT, "", NULL);
g_setenv ("GSETTINGS_SCHEMA_DIR", schema_dir, TRUE);
g_free (schema_dir);
if (g_strcmp0 (arg_direction, "rtl") == 0)
gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL);
else if (g_strcmp0 (arg_direction, "ltr") == 0)