summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorChristoph Reiter <creiter@src.gnome.org>2018-02-17 09:48:12 +0100
committerChristoph Reiter <creiter@src.gnome.org>2018-02-17 09:48:12 +0100
commit1253e7bfcbc80f88328a923568be63f831941a39 (patch)
tree7afc4148c4844a0c0346238b4bf22137a759e172 /testsuite
parent1b8a768279e1cf093b16c6c71965aa5cb1c80682 (diff)
downloadgtk+-1253e7bfcbc80f88328a923568be63f831941a39.tar.gz
tests: Make GSETTINGS_SCHEMA_DIR point to the compiled schemas in the build dir
With autotools the schemas were compiled into each test suite directory and the tests set GSETTINGS_SCHEMA_DIR to the test build directory. With meson's gnome.compile_schemas() we can not define a target directory so just make sure it is built in the gtk directory and set GSETTINGS_SCHEMA_DIR to the gtk build directory when running the tests. This makes the gtk+:gtk suite pass when no gtk is installed on the system.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/a11y/meson.build3
-rw-r--r--testsuite/gtk/defaultvalue.c6
-rw-r--r--testsuite/gtk/meson.build11
-rw-r--r--testsuite/gtk/notify.c7
-rw-r--r--testsuite/gtk/object.c6
-rw-r--r--testsuite/gtk/objects-finalize.c6
-rw-r--r--testsuite/gtk/templates.c8
-rw-r--r--testsuite/reftests/gtk-reftest.c6
-rw-r--r--testsuite/reftests/meson.build6
9 files changed, 7 insertions, 52 deletions
diff --git a/testsuite/a11y/meson.build b/testsuite/a11y/meson.build
index 164eda40ab..4ae009a2cb 100644
--- a/testsuite/a11y/meson.build
+++ b/testsuite/a11y/meson.build
@@ -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
diff --git a/testsuite/gtk/defaultvalue.c b/testsuite/gtk/defaultvalue.c
index 1be85556c3..f011682fc4 100644
--- a/testsuite/gtk/defaultvalue.c
+++ b/testsuite/gtk/defaultvalue.c
@@ -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;
}
diff --git a/testsuite/gtk/meson.build b/testsuite/gtk/meson.build
index c5b4ade9fa..e8adb56336 100644
--- a/testsuite/gtk/meson.build
+++ b/testsuite/gtk/meson.build
@@ -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)
diff --git a/testsuite/gtk/notify.c b/testsuite/gtk/notify.c
index 0dfc8c7315..3f922a2cbe 100644
--- a/testsuite/gtk/notify.c
+++ b/testsuite/gtk/notify.c
@@ -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;
}
diff --git a/testsuite/gtk/object.c b/testsuite/gtk/object.c
index 2da75f5cea..afbe9fda98 100644
--- a/testsuite/gtk/object.c
+++ b/testsuite/gtk/object.c
@@ -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 ();
}
diff --git a/testsuite/gtk/objects-finalize.c b/testsuite/gtk/objects-finalize.c
index b7b358641d..d08c42619c 100644
--- a/testsuite/gtk/objects-finalize.c
+++ b/testsuite/gtk/objects-finalize.c
@@ -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;
}
diff --git a/testsuite/gtk/templates.c b/testsuite/gtk/templates.c
index affd0845a4..712bf3e6aa 100644
--- a/testsuite/gtk/templates.c
+++ b/testsuite/gtk/templates.c
@@ -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();
}
diff --git a/testsuite/reftests/gtk-reftest.c b/testsuite/reftests/gtk-reftest.c
index 0179e0b344..3a4792e031 100644
--- a/testsuite/reftests/gtk-reftest.c
+++ b/testsuite/reftests/gtk-reftest.c
@@ -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)
diff --git a/testsuite/reftests/meson.build b/testsuite/reftests/meson.build
index 1604776bca..479e10b326 100644
--- a/testsuite/reftests/meson.build
+++ b/testsuite/reftests/meson.build
@@ -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],