[gnome-settings-daemon/gnome-3-24] color: Make the testcase able to run uninstalled



commit 63b73af23efd97de34a9dde58938c5c772040974
Author: Iain Lane <iain orangesquash org uk>
Date:   Fri May 19 16:38:07 2017 +0100

    color: Make the testcase able to run uninstalled
    
    Distributions might want to be able to run their tests during package
    builds, for example.
    
    Compile the schema and set GSETTINGS_SCHEMA_DIR to the build dir.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=782170

 Makefile.am                   |    2 +-
 plugins/color/Makefile.am     |   11 ++++++++++-
 plugins/color/gcm-self-test.c |    6 ++++++
 3 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 0a32954..096c245 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,8 +2,8 @@ NULL =
 
 SUBDIRS =                      \
        gnome-settings-daemon   \
-       plugins                 \
        data                    \
+       plugins                 \
        po                      \
        tests                   \
        $(NULL)
diff --git a/plugins/color/Makefile.am b/plugins/color/Makefile.am
index a280ba8..35dcad4 100644
--- a/plugins/color/Makefile.am
+++ b/plugins/color/Makefile.am
@@ -30,6 +30,15 @@ gcm_self_test_LDADD =                        \
 
 TESTS = gcm-self-test
 
+BUILT_SOURCES = gschemas.compiled
+
+CLEANFILES = gschemas.compiled
+
+gschemas.compiled: $(top_builddir)/data/org.gnome.settings-daemon.plugins.color.gschema.xml
+       $(AM_V_GEN) $(GLIB_COMPILE_SCHEMAS) --schema-file=$< --targetdir=$(builddir)
+
+all-am: gschemas.compiled
+
 libexec_PROGRAMS = gsd-color
 gsd_color_SOURCES =                    \
        main.c                          \
@@ -80,7 +89,7 @@ EXTRA_DIST =                                  \
        test-data/Lenovo-T61-Internal.bin       \
        test-data/LG-L225W-External.bin
 
-CLEANFILES =                           \
+CLEANFILES +=                          \
        $(desktop_DATA)
 
 DISTCLEANFILES =                       \
diff --git a/plugins/color/gcm-self-test.c b/plugins/color/gcm-self-test.c
index 83c06c5..3f00b60 100644
--- a/plugins/color/gcm-self-test.c
+++ b/plugins/color/gcm-self-test.c
@@ -281,11 +281,17 @@ gcm_test_frac_day (void)
 int
 main (int argc, char **argv)
 {
+        char *schema_dir;
+
         g_setenv ("GSETTINGS_BACKEND", "memory", TRUE);
 
         gtk_init (&argc, &argv);
         g_test_init (&argc, &argv, NULL);
 
+        schema_dir = g_test_build_filename (G_TEST_BUILT, "", NULL);
+        g_setenv("GSETTINGS_SCHEMA_DIR", schema_dir, TRUE);
+        g_free (schema_dir);
+
         g_test_add_func ("/color/edid", gcm_test_edid_func);
         g_test_add_func ("/color/sunset-sunrise", gcm_test_sunset_sunrise);
         g_test_add_func ("/color/sunset-sunrise/fractional-timezone", 
gcm_test_sunset_sunrise_fractional_timezone);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]