diff --git a/test/api/test-ot-layout.c b/test/api/test-ot-layout.c index 026270b53..11cc9c031 100644 --- a/test/api/test-ot-layout.c +++ b/test/api/test-ot-layout.c @@ -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 (); }