[test] hb_ot_layout_table_find_script()

This commit is contained in:
Khaled Hosny 2021-08-11 23:12:00 +02:00 committed by Behdad Esfahbod
parent f60caad7ff
commit 2f88ea5a20
1 changed files with 24 additions and 0 deletions

View File

@ -68,10 +68,34 @@ test_ot_layout_table_get_script_tags (void)
hb_face_destroy (face);
}
static void
test_ot_layout_table_find_script (void)
{
hb_face_t *face = hb_test_open_font_file ("fonts/NotoNastaliqUrdu-Regular.ttf");
unsigned int index;
g_assert (hb_ot_layout_table_find_script (face, HB_OT_TAG_GSUB, HB_TAG ('a','r','a','b'), &index));
g_assert_cmpuint (0, ==, index);
g_assert (hb_ot_layout_table_find_script (face, HB_OT_TAG_GSUB, HB_TAG ('d','f','l','t'), &index));
g_assert_cmpuint (1, ==, index);
g_assert (hb_ot_layout_table_find_script (face, HB_OT_TAG_GSUB, HB_TAG ('l','a','t','n'), &index));
g_assert_cmpuint (2, ==, index);
g_assert (hb_ot_layout_table_find_script (face, HB_OT_TAG_GPOS, HB_TAG ('a','r','a','b'), &index));
g_assert_cmpuint (0, ==, index);
g_assert (!hb_ot_layout_table_find_script (face, HB_OT_TAG_GPOS, HB_TAG ('d','f','l','t'), &index));
g_assert_cmpuint (0xFFFF, ==, index);
g_assert (!hb_ot_layout_table_find_script (face, HB_OT_TAG_GPOS, HB_TAG ('l','a','t','n'), &index));
g_assert_cmpuint (0xFFFF, ==, index);
hb_face_destroy (face);
}
int
main (int argc, char **argv)
{
hb_test_init (&argc, &argv);
hb_test_add (test_ot_layout_table_get_script_tags);
hb_test_add (test_ot_layout_table_find_script);
return hb_test_run ();
}