[libgweather] tests: Use uninstalled Locations.xml for other tests



commit 3cd7b21ceb42eeb860819ceafa558c06cd900906
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Dec 7 15:40:06 2017 +0100

    tests: Use uninstalled Locations.xml for other tests

 libgweather/meson.build          |    5 ++++-
 libgweather/test_locations.c     |    4 ++++
 libgweather/test_locations_utc.c |    4 ++++
 3 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/libgweather/meson.build b/libgweather/meson.build
index 4f8b3d2..847fd1a 100644
--- a/libgweather/meson.build
+++ b/libgweather/meson.build
@@ -95,16 +95,19 @@ if enable_vala
   )
 endif
 
+test_cargs = ['-DTEST_SRCDIR="@0@/"'.format(meson.current_source_dir())]
+
 executable('test_locations',
   ['test_locations.c'],
+  c_args: test_cargs,
   dependencies: libgweather_dep,
   install: false)
 executable('test_locations_utc',
   ['test_locations_utc.c'],
+  c_args: test_cargs,
   dependencies: libgweather_dep,
   install: false)
 
-test_cargs = ['-DTEST_SRCDIR="@0@/"'.format(meson.current_source_dir())]
 exe = executable('test_libgweather',
   ['test_libgweather.c'],
   c_args: test_cargs,
diff --git a/libgweather/test_locations.c b/libgweather/test_locations.c
index fcb39f9..b03375e 100644
--- a/libgweather/test_locations.c
+++ b/libgweather/test_locations.c
@@ -37,6 +37,10 @@ main (int argc, char **argv)
     GtkWidget *combo;
     gtk_init (&argc, &argv);
 
+    g_setenv ("LIBGWEATHER_LOCATIONS_PATH",
+              TEST_SRCDIR "../data/Locations.xml",
+              FALSE);
+
     window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
     gtk_window_set_title (GTK_WINDOW (window), "location");
     gtk_container_set_border_width (GTK_CONTAINER (window), 8);
diff --git a/libgweather/test_locations_utc.c b/libgweather/test_locations_utc.c
index a071318..3c599af 100644
--- a/libgweather/test_locations_utc.c
+++ b/libgweather/test_locations_utc.c
@@ -38,6 +38,10 @@ main (int argc, char **argv)
 
     gtk_init (&argc, &argv);
 
+    g_setenv ("LIBGWEATHER_LOCATIONS_PATH",
+              TEST_SRCDIR "../data/Locations.xml",
+              FALSE);
+
     window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
     gtk_window_set_title (GTK_WINDOW (window), "location");
     gtk_container_set_border_width (GTK_CONTAINER (window), 8);


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