summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-07-10 19:03:21 -0400
committerMatthias Clasen <mclasen@redhat.com>2021-07-21 08:20:04 -0400
commit2a253d9bc76c0333e424aa0200a212b3fc57ab33 (patch)
tree9224daa93f0a3551fcec655eac67a7f4f3e30540
parent26fa82a51cd6d123f3af1cb9b7e3514549eca922 (diff)
downloadpango-2a253d9bc76c0333e424aa0200a212b3fc57ab33.tar.gz
Try harder to skip tests on MacOs
For tests where the wrong fonts break things, check that we have Cantarell, and skip them if not.
-rw-r--r--tests/test-itemize.c24
-rw-r--r--tests/test-layout.c24
2 files changed, 48 insertions, 0 deletions
diff --git a/tests/test-itemize.c b/tests/test-itemize.c
index 52556284..0a8515b8 100644
--- a/tests/test-itemize.c
+++ b/tests/test-itemize.c
@@ -236,6 +236,9 @@ test_itemize (gconstpointer d)
GError *error = NULL;
GString *dump;
gchar *diff;
+ PangoFontFamily **families;
+ int n_families;
+ gboolean found_cantarell;
char *old_locale = g_strdup (setlocale (LC_ALL, NULL));
setlocale (LC_ALL, "en_US.UTF-8");
@@ -250,6 +253,27 @@ test_itemize (gconstpointer d)
context = pango_font_map_create_context (pango_cairo_font_map_get_default ());
+ found_cantarell = FALSE;
+ pango_context_list_families (context, &families, &n_families);
+ for (int i = 0; i < n_families; i++)
+ {
+ if (strcmp (pango_font_family_get_name (families[i]), "Cantarell") == 0)
+ {
+ found_cantarell = TRUE;
+ break;
+ }
+ }
+ g_free (families);
+
+ if (!found_cantarell)
+ {
+ char *msg = g_strdup_printf ("Cantarell font not available, skipping itemization %s", filename);
+ g_test_skip (msg);
+ g_free (msg);
+ g_free (old_locale);
+ return;
+ }
+
expected_file = get_expected_filename (filename);
dump = g_string_sized_new (0);
diff --git a/tests/test-layout.c b/tests/test-layout.c
index 1e531031..8a1054b4 100644
--- a/tests/test-layout.c
+++ b/tests/test-layout.c
@@ -703,6 +703,9 @@ test_layout (gconstpointer d)
GError *error = NULL;
GString *dump;
gchar *diff;
+ PangoFontFamily **families;
+ int n_families;
+ gboolean found_cantarell;
char *old_locale = g_strdup (setlocale (LC_ALL, NULL));
setlocale (LC_ALL, "en_US.UTF-8");
@@ -718,6 +721,27 @@ test_layout (gconstpointer d)
if (context == NULL)
context = pango_font_map_create_context (pango_cairo_font_map_get_default ());
+ found_cantarell = FALSE;
+ pango_context_list_families (context, &families, &n_families);
+ for (int i = 0; i < n_families; i++)
+ {
+ if (strcmp (pango_font_family_get_name (families[i]), "Cantarell") == 0)
+ {
+ found_cantarell = TRUE;
+ break;
+ }
+ }
+ g_free (families);
+
+ if (!found_cantarell)
+ {
+ char *msg = g_strdup_printf ("Cantarell font not available, skipping itemization %s", filename);
+ g_test_skip (msg);
+ g_free (msg);
+ g_free (old_locale);
+ return;
+ }
+
expected_file = get_expected_filename (filename);
dump = g_string_sized_new (0);