Merge branch 'tests-set-schema-dir' into 'master'

tests: Make GSETTINGS_SCHEMA_DIR point to the compiled schemas in the build dir

See merge request GNOME/gtk!21
This commit is contained in:
Matthias Clasen 2018-02-19 18:28:00 +00:00
commit 4a0854484f
10 changed files with 10 additions and 53 deletions

View File

@ -855,7 +855,9 @@ gtk_settings_schemas = [
'org.gtk.Settings.Debug.gschema.xml',
]
install_data(gtk_settings_schemas, install_dir: gtk_schemasdir)
gnome.compile_schemas()
gnome.compile_schemas(depend_files: files(gtk_settings_schemas),
build_by_default: true)
gtk_schema_build_dir = meson.current_build_dir()
# Check for more things
if cc.has_header('langinfo.h')

View File

@ -27,7 +27,8 @@ foreach t: a11y_tests
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir),
],
suite: 'a11y')
endforeach

View File

@ -367,7 +367,6 @@ main (int argc, char **argv)
{
const GType *otypes;
guint i;
gchar *schema_dir;
GTestDBus *bus;
GMainLoop *loop;
gint result;
@ -380,10 +379,6 @@ main (int argc, char **argv)
gtk_test_init (&argc, &argv);
gtk_test_register_all_types();
/* 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);
/* Create one test bus for all tests, as we have a lot of very small
* and quick tests.
*/
@ -418,7 +413,6 @@ main (int argc, char **argv)
g_test_dbus_down (bus);
g_object_unref (bus);
g_free (schema_dir);
return result;
}

View File

@ -80,7 +80,8 @@ foreach t : tests
'G_ENABLE_DIAGNOSTIC=0',
'GSK_RENDERER=cairo',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir),
],
suite: 'gtk')
endforeach
@ -100,7 +101,8 @@ if add_languages('cpp')
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir),
],
suite: 'gtk')
if get_option('install-tests')
@ -114,11 +116,6 @@ if add_languages('cpp')
endif
endif
# FIXME: schemas from gtk+ dir?
# $(top_srcdir)/gtk/org.gtk.Settings.ColorChooser.gschema.xml
# $(top_srcdir)/gtk/org.gtk.Settings.FileChooser.gschema.xml
# gnome.compile_schemas()
if get_option('install-tests')
foreach t : tests
test_name = t.get(0)

View File

@ -657,16 +657,11 @@ main (int argc, char **argv)
{
const GType *otypes;
guint i;
gchar *schema_dir;
gint result;
gtk_test_init (&argc, &argv);
gtk_test_register_all_types();
/* 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);
otypes = gtk_test_list_all_types (NULL);
for (i = 0; otypes[i]; i++)
{
@ -679,7 +674,5 @@ main (int argc, char **argv)
result = g_test_run ();
g_free (schema_dir);
return result;
}

View File

@ -323,7 +323,6 @@ main (int argc,
{
const GType *otypes;
guint i;
gchar *schema_dir;
g_setenv ("GSETTINGS_BACKEND", "memory", TRUE);
@ -331,10 +330,6 @@ main (int argc,
gtk_test_init (&argc, &argv);
gtk_test_register_all_types ();
/* 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);
/* install a property test for each widget type */
otypes = gtk_test_list_all_types (NULL);
for (i = 0; otypes[i]; i++)
@ -347,6 +342,5 @@ main (int argc,
g_free (testpath);
}
g_free (schema_dir);
return g_test_run ();
}

View File

@ -82,7 +82,6 @@ main (int argc, char **argv)
{
const GType *all_types;
guint n_types = 0, i;
gchar *schema_dir;
GTestDBus *bus;
gint result;
@ -94,10 +93,6 @@ main (int argc, char **argv)
gtk_test_init (&argc, &argv);
gtk_test_register_all_types ();
/* 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);
/* Create one test bus for all tests, as we have a lot of very small
* and quick tests.
*/
@ -136,7 +131,6 @@ main (int argc, char **argv)
g_test_dbus_down (bus);
g_object_unref (bus);
g_free (schema_dir);
return result;
}

View File

@ -328,8 +328,6 @@ test_print_unix_dialog_basic (void)
int
main (int argc, char **argv)
{
gchar *schema_dir;
/* These must be set before before gtk_test_init */
g_setenv ("GIO_USE_VFS", "local", TRUE);
g_setenv ("GSETTINGS_BACKEND", "memory", TRUE);
@ -337,10 +335,6 @@ main (int argc, char **argv)
/* initialize test program */
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);
/* This environment variable cooperates with gtk_widget_destroy()
* to assert that all automated compoenents are properly finalized
* when a given composite widget is destroyed.
@ -374,7 +368,5 @@ main (int argc, char **argv)
g_test_add_func ("/Template/UnixPrint/GtkPrintUnixDialog/Basic", test_print_unix_dialog_basic);
#endif
g_free (schema_dir);
return g_test_run();
}

View File

@ -62,7 +62,6 @@ 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);
@ -76,11 +75,6 @@ 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)

View File

@ -4,6 +4,7 @@ test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
test_env.set('REFTEST_MODULE_DIR', meson.current_build_dir())
test_env.set('GTK_IM_MODULE', 'gtk-im-context-simple')
test_env.set('GSETTINGS_BACKEND', 'memory')
test_env.set('GSETTINGS_SCHEMA_DIR', gtk_schema_build_dir)
test_env.set('G_ENABLE_DIAGNOSTIC', '0')
gtk_reftest_cargs = ['-DGDK_DISABLE_DEPRECATED', '-DGTK_DISABLE_DEPRECATED']
@ -37,11 +38,6 @@ tcdata.set('libexecdir', join_paths(get_option('prefix'), get_option('libexecdir
# configuration : tcdata)
#endforeach
# FIXME: schemas from gtk+ dir?
# $(top_srcdir)/gtk/org.gtk.Settings.ColorChooser.gschema.xml
# $(top_srcdir)/gtk/org.gtk.Settings.FileChooser.gschema.xml
# gnome.compile_schemas()
gtk_reftest = executable('gtk-reftest', 'gtk-reftest.c',
c_args : gtk_reftest_cargs,
link_with : [libgtkreftestprivate, libreftest],