summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-09-17 18:30:29 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-09-17 19:21:27 -0400
commit553841ac75aa69f562391b98b983ec4881a89855 (patch)
tree16aa958636316e7d6ea97f145e3e587e39522ba5 /tests
parent0b9c264a5ee8b2766ae37f6b0426655452919b4b (diff)
downloadpango-553841ac75aa69f562391b98b983ec4881a89855.tar.gz
Make test-layout work for generating data again
This was broken in f6032b754fd76ebbf0ae6.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-layout.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/test-layout.c b/tests/test-layout.c
index 58ab46eb..0506acd8 100644
--- a/tests/test-layout.c
+++ b/tests/test-layout.c
@@ -238,6 +238,9 @@ test_file (const gchar *filename, GString *string)
PangoWrapMode wrap = PANGO_WRAP_WORD;
PangoFontDescription *desc;
+ if (context == NULL)
+ context = pango_font_map_create_context (pango_cairo_font_map_get_default ());
+
g_file_get_contents (filename, &contents, &length, &error);
g_assert_no_error (error);
@@ -359,13 +362,13 @@ main (int argc, char *argv[])
const gchar *name;
gchar *path;
- g_test_init (&argc, &argv, NULL);
-
/* allow to easily generate expected output for new test cases */
- if (argc > 1)
+ if (argc > 1 && argv[1][0] != '-')
{
GString *string;
+ setlocale (LC_ALL, "en_US.utf8");
+
string = g_string_sized_new (0);
test_file (argv[1], string);
g_test_message ("%s", string->str);
@@ -373,6 +376,8 @@ main (int argc, char *argv[])
return 0;
}
+ g_test_init (&argc, &argv, NULL);
+
path = g_test_build_filename (G_TEST_DIST, "layouts", NULL);
dir = g_dir_open (path, 0, &error);
g_free (path);