diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2020-06-08 17:08:08 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2020-06-08 17:18:52 +0100 |
commit | fb8664764b6d2432a8f91f309439b00a60f07106 (patch) | |
tree | 16530ae2775e6d411bfe9674d585c84cb7989f2b /tests | |
parent | 5dfa88dc880079fb314f24525f940cdd9b2d08b5 (diff) | |
download | pango-fb8664764b6d2432a8f91f309439b00a60f07106.tar.gz |
Skip layout tests if the en_US locale is not available
There's no point in running a tests if we know the locale isn't there.
The reason gets logged, so the developer can decide to install it.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-layout.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/test-layout.c b/tests/test-layout.c index 2fc78240..9661457b 100644 --- a/tests/test-layout.c +++ b/tests/test-layout.c @@ -304,6 +304,16 @@ test_layout (gconstpointer d) GString *dump; gchar *diff; + const char *old_locale = setlocale (LC_ALL, NULL); + setlocale (LC_ALL, "en_US.UTF-8"); + if (strstr (setlocale (LC_ALL, NULL), "en_US") == NULL) + { + char *msg = g_strdup_printf ("Locale en_US.UTF-8 not available, skipping layout %s", filename); + g_test_skip (msg); + g_free (msg); + return; + } + expected_file = get_expected_filename (filename); dump = g_string_sized_new (0); @@ -323,6 +333,8 @@ test_layout (gconstpointer d) g_string_free (dump, TRUE); g_free (expected_file); + + setlocale (LC_ALL, old_locale); } int @@ -333,9 +345,6 @@ main (int argc, char *argv[]) const gchar *name; gchar *path; - g_setenv ("LC_ALL", "en_US.UTF-8", TRUE); - setlocale (LC_ALL, ""); - g_test_init (&argc, &argv, NULL); context = pango_font_map_create_context (pango_cairo_font_map_get_default ()); |