[pango/simple-fontmap: 2/9] Add a test for PangoHbFace getters




commit 520003047a5c62ecd15fdafec6161884d85555cd
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Oct 31 19:48:52 2021 -0400

    Add a test for PangoHbFace getters
    
    Test that is_variable() and is_monospace() work
    as expected for PangoHbFace.

 tests/testmisc.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
---
diff --git a/tests/testmisc.c b/tests/testmisc.c
index 1aa90948..67e28495 100644
--- a/tests/testmisc.c
+++ b/tests/testmisc.c
@@ -818,6 +818,38 @@ test_small_caps_crash (void)
   g_object_unref (context);
 }
 
+static void
+test_hbfont_monospace (void)
+{
+  PangoSimpleFontMap *map;
+  PangoFontFamily *family;
+  char *path;
+
+  map = pango_simple_font_map_new ();
+
+  path = g_test_build_filename (G_TEST_DIST, "fonts", "Cantarell-VF.otf", NULL);
+  pango_simple_font_map_add_file (map, path, 0, 0);
+  g_free (path);
+
+  family = pango_font_map_get_family (PANGO_FONT_MAP (map), "Cantarell");
+
+  g_assert_nonnull (family);
+  g_assert_true (pango_font_family_is_variable (family));
+  g_assert_false (pango_font_family_is_monospace (family));
+
+  path = g_test_build_filename (G_TEST_DIST, "fonts", "DejaVuSansMono.ttf", NULL);
+  pango_simple_font_map_add_file (map, path, 0, -1);
+  g_free (path);
+
+  family = pango_font_map_get_family (PANGO_FONT_MAP (map), "DejaVu Sans Mono");
+
+  g_assert_nonnull (family);
+  g_assert_false (pango_font_family_is_variable (family));
+  g_assert_true (pango_font_family_is_monospace (family));
+
+  g_object_unref (map);
+}
+
 int
 main (int argc, char *argv[])
 {
@@ -853,6 +885,7 @@ main (int argc, char *argv[])
   g_test_add_func ("/layout/wrap-char", test_wrap_char);
   g_test_add_func ("/matrix/transform-rectangle", test_transform_rectangle);
   g_test_add_func ("/itemize/small-caps-crash", test_small_caps_crash);
+  g_test_add_func ("/hbfont/monospace", test_hbfont_monospace);
 
   return g_test_run ();
 }


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