[pango/simple-fontmap: 2/12] Add a test for PangoHbFace getters
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/simple-fontmap: 2/12] Add a test for PangoHbFace getters
- Date: Sun, 26 Dec 2021 18:08:35 +0000 (UTC)
commit b4861bcb81ece4f2ef96e47fab7fd2ccfdbf615e
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..c9b55487 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)
+{
+ PangoHbFontMap *map;
+ PangoFontFamily *family;
+ char *path;
+
+ map = pango_hb_font_map_new ();
+
+ path = g_test_build_filename (G_TEST_DIST, "fonts", "Cantarell-VF.otf", NULL);
+ pango_hb_font_map_add_file (map, path);
+ 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_hb_font_map_add_file (map, path);
+ 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]