diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-11-27 15:17:15 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-11-27 15:17:15 +0000 |
commit | 80b197df0c7d66929e40989ff23021126d6c9881 (patch) | |
tree | 5fc0b846de72005be91db902f1438fdab1655665 /tests/test-font.c | |
parent | ac2bf585e04c49be419f44a97c4ef0de0fd21014 (diff) | |
parent | b2aabec7ca3d46d7833fef694915e4ddb5a179fe (diff) | |
download | pango-80b197df0c7d66929e40989ff23021126d6c9881.tar.gz |
Merge branch 'font-serialize-test' into 'main'
Avoid cosmetic ugliness
See merge request GNOME/pango!522
Diffstat (limited to 'tests/test-font.c')
-rw-r--r-- | tests/test-font.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/tests/test-font.c b/tests/test-font.c index bfe321a0..2eef4396 100644 --- a/tests/test-font.c +++ b/tests/test-font.c @@ -82,7 +82,7 @@ test_roundtrip (void) } static void -test_variation (void) +test_variations (void) { PangoFontDescription *desc1; PangoFontDescription *desc2; @@ -119,6 +119,32 @@ test_variation (void) } static void +test_empty_variations (void) +{ + PangoFontDescription *desc; + gchar *str; + + desc = pango_font_description_from_string ("Cantarell 14"); + g_assert_nonnull (desc); + g_assert_cmpint ((pango_font_description_get_set_fields (desc) & PANGO_FONT_MASK_VARIATIONS), ==, 0); + g_assert_null (pango_font_description_get_variations (desc)); + + str = pango_font_description_to_string (desc); + g_assert_cmpstr (str, ==, "Cantarell 14"); + g_free (str); + + pango_font_description_set_variations (desc, ""); + g_assert_cmpint ((pango_font_description_get_set_fields (desc) & PANGO_FONT_MASK_VARIATIONS), ==, PANGO_FONT_MASK_VARIATIONS); + g_assert_cmpstr (pango_font_description_get_variations (desc), ==, ""); + + str = pango_font_description_to_string (desc); + g_assert_cmpstr (str, ==, "Cantarell 14"); + g_free (str); + + pango_font_description_free (desc); +} + +static void test_metrics (void) { PangoFontDescription *desc; @@ -543,7 +569,8 @@ main (int argc, char *argv[]) g_test_add_func ("/pango/font/metrics", test_metrics); g_test_add_func ("/pango/fontdescription/parse", test_parse); g_test_add_func ("/pango/fontdescription/roundtrip", test_roundtrip); - g_test_add_func ("/pango/fontdescription/variation", test_variation); + g_test_add_func ("/pango/fontdescription/variations", test_variations); + g_test_add_func ("/pango/fontdescription/empty-variations", test_empty_variations); g_test_add_func ("/pango/fontdescription/to-filename", test_to_filename); g_test_add_func ("/pango/fontdescription/set-gravity", test_set_gravity); g_test_add_func ("/pango/fontdescription/match", test_match); |