diff options
author | Philip Withnall <philip@tecnocode.co.uk> | 2018-07-17 20:17:44 +0200 |
---|---|---|
committer | Philip Withnall <philip@tecnocode.co.uk> | 2018-07-17 20:51:47 +0200 |
commit | 532c45b5cedf734d8794064f829b697f2baac1f6 (patch) | |
tree | 1511dfbc3d9912c4c8585070bd371885f54b5ad0 | |
parent | 27eb6b4290c74c582691ccaa3cd2ce5fa6c0a708 (diff) | |
download | glib-532c45b5cedf734d8794064f829b697f2baac1f6.tar.gz |
tests: Skip some more date tests if translations are not installed
These tests will work if the glibc translations are up to date, or if
the GLib translations are installed and up to date; but not if neither
are in place.
Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
https://gitlab.gnome.org/GNOME/glib/issues/1447
-rw-r--r-- | glib/tests/date.c | 11 | ||||
-rw-r--r-- | glib/tests/gdatetime.c | 11 |
2 files changed, 22 insertions, 0 deletions
diff --git a/glib/tests/date.c b/glib/tests/date.c index 106e5c1f3..d65aab7e8 100644 --- a/glib/tests/date.c +++ b/glib/tests/date.c @@ -196,6 +196,17 @@ test_month_names (void) g_test_bug ("749206"); + /* If running uninstalled (G_TEST_BUILDDIR is set), skip this test, since we + * need the translations to be installed. We can’t mess around with + * bindtextdomain() here, as the compiled .gmo files in po/ are not in the + * right installed directory hierarchy to be successfully loaded by gettext. */ + if (g_getenv ("G_TEST_BUILDDIR") != NULL) + { + g_test_skip ("Skipping due to running uninstalled. " + "This test can only be run when the translations are installed."); + return; + } + /* This test can only work (on non-Windows platforms) if libc supports * the %OB (etc.) format placeholders. If it doesn’t, strftime() (and hence * g_date_strftime()) will return the placeholder unsubstituted. diff --git a/glib/tests/gdatetime.c b/glib/tests/gdatetime.c index 400a2efa3..c6837fcce 100644 --- a/glib/tests/gdatetime.c +++ b/glib/tests/gdatetime.c @@ -1441,6 +1441,17 @@ test_non_utf8_printf (void) { gchar *oldlocale; + /* If running uninstalled (G_TEST_BUILDDIR is set), skip this test, since we + * need the translations to be installed. We can’t mess around with + * bindtextdomain() here, as the compiled .gmo files in po/ are not in the + * right installed directory hierarchy to be successfully loaded by gettext. */ + if (g_getenv ("G_TEST_BUILDDIR") != NULL) + { + g_test_skip ("Skipping due to running uninstalled. " + "This test can only be run when the translations are installed."); + return; + } + oldlocale = g_strdup (setlocale (LC_ALL, NULL)); setlocale (LC_ALL, "ja_JP.eucjp"); if (strstr (setlocale (LC_ALL, NULL), "ja_JP") == NULL) |