[libgweather/wip/hadess/fix-utc-sunrise] fixup! tests: Add test for named timezone sunrise fetching
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgweather/wip/hadess/fix-utc-sunrise] fixup! tests: Add test for named timezone sunrise fetching
- Date: Mon, 8 Oct 2018 11:36:35 +0000 (UTC)
commit cacafe5c3876ba23be54b4c4898ad20d7549edfb
Author: Bastien Nocera <hadess hadess net>
Date: Mon Oct 8 13:36:18 2018 +0200
fixup! tests: Add test for named timezone sunrise fetching
libgweather/test_libgweather.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
---
diff --git a/libgweather/test_libgweather.c b/libgweather/test_libgweather.c
index 11a594c..ab2942f 100644
--- a/libgweather/test_libgweather.c
+++ b/libgweather/test_libgweather.c
@@ -381,6 +381,37 @@ test_metar_weather_stations (void)
test_metar_weather_stations_children (world, stations_ht);
}
+static void
+set_gsettings (void)
+{
+ char *tmpdir, *schemadir, *cmdline;
+ int result;
+ const char *orig_data_dirs;
+
+ tmpdir = g_strdup_printf ("libgweather-test-XXXXXX");
+ tmpdir = g_dir_make_tmp (tmpdir, NULL);
+ g_assert_nonnull (tmpdir);
+ schemadir = g_strdup_printf ("%s/glib-2.0/schemas", tmpdir);
+ g_assert_cmpint (g_mkdir_with_parents (schemadir, 0700), ==, 0);
+ cmdline = g_strdup_printf ("glib-compile-schemas --targetdir=%s "
+ "--schema-file=%s/org.gnome.GWeather.enums.xml "
+ "--schema-file=%s/org.gnome.GWeather.gschema.xml",
+ schemadir, TEST_SRCDIR "/../schemas", TEST_SRCDIR "/../schemas");
+ g_assert (g_spawn_command_line_sync (cmdline, NULL, NULL, &result, NULL));
+ g_assert (result == 0);
+ g_free (cmdline);
+
+ orig_data_dirs = g_getenv ("XDG_DATA_DIRS");
+ if (!orig_data_dirs) {
+ g_setenv ("XDG_DATA_DIRS", tmpdir, TRUE);
+ } else {
+ char *data_dirs;
+
+ data_dirs = g_strdup_printf ("%s:%s", orig_data_dirs, tmpdir);
+ g_setenv ("XDG_DATA_DIRS", data_dirs, TRUE);
+ }
+}
+
static void
test_utc_sunset (void)
{
@@ -391,6 +422,8 @@ test_utc_sunset (void)
GWeatherMoonLatitude lat;
gboolean ret;
+ set_gsettings ();
+
world = gweather_location_get_world ();
g_assert_nonnull (world);
utc = gweather_location_find_by_station_code (world, "@UTC");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]