summaryrefslogtreecommitdiff
path: root/tests/test-layout.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-07-10 17:14:39 -0400
committerMatthias Clasen <mclasen@redhat.com>2021-07-21 08:19:53 -0400
commitcd4dde8a3dee8199c545d7f6a5ca9808d9634e7d (patch)
tree7ac3bfc64761c7c7d43ef507e304e2df663a152e /tests/test-layout.c
parenta4ad59a23a5ab169644bad157a0890c415c5da6c (diff)
downloadpango-cd4dde8a3dee8199c545d7f6a5ca9808d9634e7d.tar.gz
tests: Locale handling fixes
The return value of setlocale is only good until the next call. Also, consistently use en_US.UTF-8.
Diffstat (limited to 'tests/test-layout.c')
-rw-r--r--tests/test-layout.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/test-layout.c b/tests/test-layout.c
index ca9e5da5..502bc98a 100644
--- a/tests/test-layout.c
+++ b/tests/test-layout.c
@@ -703,13 +703,14 @@ test_layout (gconstpointer d)
GString *dump;
gchar *diff;
- const char *old_locale = setlocale (LC_ALL, NULL);
- setlocale (LC_ALL, "en_US.utf8");
+ char *old_locale = g_strdup (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);
+ g_free (old_locale);
return;
}
@@ -726,6 +727,7 @@ test_layout (gconstpointer d)
g_assert_no_error (error);
setlocale (LC_ALL, old_locale);
+ g_free (old_locale);
if (diff && diff[0])
{
@@ -755,6 +757,8 @@ main (int argc, char *argv[])
const gchar *name;
gchar *path;
+ setlocale (LC_ALL, "");
+
if (g_getenv ("PANGO_TEST_SHOW_FONT"))
opt_show_font = TRUE;
@@ -763,8 +767,6 @@ main (int argc, char *argv[])
{
GString *string;
- setlocale (LC_ALL, "en_US.utf8");
-
string = g_string_sized_new (0);
test_file (argv[1], string);
g_print ("%s", string->str);