summaryrefslogtreecommitdiff
path: root/tests/test-itemize.c
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2020-06-08 17:29:28 +0100
committerEmmanuele Bassi <ebassi@gnome.org>2020-06-08 17:29:28 +0100
commit85167fff28951658fa89b3bcfe13a78176d2a8d7 (patch)
tree6e452a9c2c5bd27fd607081a02fd7ada214a1ecd /tests/test-itemize.c
parentce2258484f22e43c83ffb6825cfa0e5af2c40925 (diff)
downloadpango-85167fff28951658fa89b3bcfe13a78176d2a8d7.tar.gz
Skip test-itemize when the en_US locale is missing
Just like test-layout.
Diffstat (limited to 'tests/test-itemize.c')
-rw-r--r--tests/test-itemize.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/test-itemize.c b/tests/test-itemize.c
index 167e4e80..51f2bb9c 100644
--- a/tests/test-itemize.c
+++ b/tests/test-itemize.c
@@ -110,7 +110,7 @@ test_file (const gchar *filename, GString *string)
gchar *contents;
gsize length;
GError *error = NULL;
- GString *s1, *s2, *s3, *s4, *s5, *s6;
+ GString *s1, *s2, *s3, *s4, *s5, *s6;
char *test;
char *text;
PangoAttrList *attrs;
@@ -237,6 +237,16 @@ test_itemize (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 itemization %s", filename);
+ g_test_skip (msg);
+ g_free (msg);
+ return;
+ }
+
expected_file = get_expected_filename (filename);
dump = g_string_sized_new (0);
@@ -256,6 +266,8 @@ test_itemize (gconstpointer d)
g_string_free (dump, TRUE);
g_free (expected_file);
+
+ setlocale (LC_ALL, old_locale);
}
int
@@ -266,9 +278,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 ());