From cdb153175f8a1521cde112c65b173f548ca6ee5c Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 11 May 2011 23:12:58 -0400 Subject: [PATCH] [test/font] More tests --- test/test-font.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/test/test-font.c b/test/test-font.c index e888838..cfd299e 100644 --- a/test/test-font.c +++ b/test/test-font.c @@ -67,6 +67,7 @@ test_font_properties (void) hb_blob_t *blob; hb_face_t *face; hb_font_t *font; + hb_font_t *subfont; int x_scale, y_scale; unsigned int x_ppem, y_ppem; @@ -144,7 +145,44 @@ test_font_properties (void) g_assert_cmpint (y_ppem, ==, 19); + /* sub_font now */ + subfont = hb_font_create_sub_font (font); hb_font_destroy (font); + + g_assert (hb_font_get_parent (subfont) == font); + g_assert (hb_font_get_face (subfont) == face); + + /* scale */ + x_scale = y_scale = 13; + hb_font_get_scale (subfont, &x_scale, &y_scale); + g_assert_cmpint (x_scale, ==, 17); + g_assert_cmpint (y_scale, ==, 19); + hb_font_set_scale (subfont, 10, 12); + x_scale = y_scale = 13; + hb_font_get_scale (subfont, &x_scale, &y_scale); + g_assert_cmpint (x_scale, ==, 10); + g_assert_cmpint (y_scale, ==, 12); + x_scale = y_scale = 13; + hb_font_get_scale (font, &x_scale, &y_scale); + g_assert_cmpint (x_scale, ==, 17); + g_assert_cmpint (y_scale, ==, 19); + + /* ppem */ + x_ppem = y_ppem = 13; + hb_font_get_ppem (subfont, &x_ppem, &y_ppem); + g_assert_cmpint (x_ppem, ==, 17); + g_assert_cmpint (y_ppem, ==, 19); + hb_font_set_ppem (subfont, 10, 12); + x_ppem = y_ppem = 13; + hb_font_get_ppem (subfont, &x_ppem, &y_ppem); + g_assert_cmpint (x_ppem, ==, 10); + g_assert_cmpint (y_ppem, ==, 12); + x_ppem = y_ppem = 13; + hb_font_get_ppem (font, &x_ppem, &y_ppem); + g_assert_cmpint (x_ppem, ==, 17); + g_assert_cmpint (y_ppem, ==, 19); + + hb_font_destroy (subfont); } int @@ -159,5 +197,11 @@ main (int argc, char **argv) hb_test_add (test_font_empty); hb_test_add (test_font_properties); + /* + * hb_font_set_funcs + * hb_font_funcs + * hb_face_create_for_tables + */ + return hb_test_run(); } -- 2.7.4