[glib] tests: Skip the gdatetime month names test when running uninstalled



commit c4f58e362eca05ca3d5e3ea2683dd46c9f66e594
Author: Philip Withnall <withnall endlessm com>
Date:   Fri Mar 9 17:48:35 2018 +0000

    tests: Skip the gdatetime month names test when running uninstalled
    
    It needs the translations to be installed. See the comment added to the
    code.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=794180

 glib/tests/gdatetime.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
---
diff --git a/glib/tests/gdatetime.c b/glib/tests/gdatetime.c
index 844f29e15..f62f988a7 100644
--- a/glib/tests/gdatetime.c
+++ b/glib/tests/gdatetime.c
@@ -1562,6 +1562,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;
+    }
+
   oldlocale = g_strdup (setlocale (LC_ALL, NULL));
 
   /* Make sure that nothing has been changed in western European languages.  */


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