[pango] test-break: Some fixes



commit 21081ce6a196f3665f06ce6fee013ed513f7acd7
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Jun 11 14:02:15 2020 -0400

    test-break: Some fixes
    
    Try to make test-break not fail on my system. First
    I made it skip tests that produce missing glyphs,
    then I made it call setlocale(). In the end, I needed
    to just install the right Thai fonts. But these
    fixes are still useful.

 tests/test-break.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/tests/test-break.c b/tests/test-break.c
index aec36008..df9b78e2 100644
--- a/tests/test-break.c
+++ b/tests/test-break.c
@@ -70,6 +70,14 @@ test_file (const gchar *filename, GString *string)
   layout = pango_layout_new (context);
   pango_layout_set_text (layout, text, length);
   pango_layout_set_attributes (layout, attributes);
+
+  if (pango_layout_get_unknown_glyphs_count (layout) > 0)
+    {
+      char *msg = g_strdup_printf ("Missing glyphs - skipping %s. Maybe fonts are missing?", filename);
+      g_test_skip (msg);
+      g_free (msg);
+    }
+
   pango_layout_get_log_attrs (layout, &attrs, &len);
 
   s1 = g_string_new ("Breaks: ");
@@ -251,9 +259,6 @@ test_break (gconstpointer d)
       return;
     }
 
-  if (context == NULL)
-    context = pango_font_map_create_context (pango_cairo_font_map_get_default ());
-
   expected_file = get_expected_filename (filename);
 
   dump = g_string_sized_new (0);
@@ -296,6 +301,10 @@ main (int argc, char *argv[])
 
   g_test_init (&argc, &argv, NULL);
 
+  setlocale (LC_ALL, "");
+
+  context = pango_font_map_create_context (pango_cairo_font_map_get_default ());
+
   /* allow to easily generate expected output for new test cases */
   if (argc > 1)
     {


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