[test] hb_ot_layout_language_get_feature_tags()

This commit is contained in:
Khaled Hosny 2021-08-12 00:04:32 +02:00 committed by Behdad Esfahbod
parent e9b743b26d
commit 6ac6a2b27b
1 changed files with 45 additions and 0 deletions

View File

@ -171,6 +171,50 @@ test_ot_layout_script_get_language_tags (void)
hb_face_destroy (face);
}
static void
test_ot_layout_language_get_feature_tags (void)
{
hb_face_t *face = hb_test_open_font_file ("fonts/Estedad-VF.ttf");
unsigned int total = 0;
unsigned int count = STATIC_ARRAY_SIZE;
unsigned int offset = 0;
hb_tag_t tags[STATIC_ARRAY_SIZE];
while (count == STATIC_ARRAY_SIZE)
{
total = hb_ot_layout_language_get_feature_tags (face, HB_OT_TAG_GSUB, 0, 0, offset, &count, tags);
g_assert_cmpuint (6, ==, total);
offset += count;
if (count)
{
g_assert_cmpuint (6, ==, count);
g_assert_cmpuint (HB_TAG ('c','a','l','t'), ==, tags[0]);
g_assert_cmpuint (HB_TAG ('f','i','n','a'), ==, tags[1]);
g_assert_cmpuint (HB_TAG ('i','n','i','t'), ==, tags[2]);
g_assert_cmpuint (HB_TAG ('l','i','g','a'), ==, tags[3]);
g_assert_cmpuint (HB_TAG ('m','e','d','i'), ==, tags[4]);
g_assert_cmpuint (HB_TAG ('r','l','i','g'), ==, tags[5]);
}
}
count = STATIC_ARRAY_SIZE;
offset = 0;
while (count == STATIC_ARRAY_SIZE)
{
total = hb_ot_layout_language_get_feature_tags (face, HB_OT_TAG_GPOS, 1, 0, offset, &count, tags);
g_assert_cmpuint (3, ==, total);
offset += count;
if (count)
{
g_assert_cmpuint (3, ==, count);
g_assert_cmpuint (HB_TAG ('k','e','r','n'), ==, tags[0]);
g_assert_cmpuint (HB_TAG ('m','a','r','k'), ==, tags[1]);
g_assert_cmpuint (HB_TAG ('m','k','m','k'), ==, tags[2]);
}
}
hb_face_destroy (face);
}
int
main (int argc, char **argv)
{
@ -179,5 +223,6 @@ main (int argc, char **argv)
hb_test_add (test_ot_layout_table_find_script);
hb_test_add (test_ot_layout_script_get_language_tags);
hb_test_add (test_ot_layout_table_get_feature_tags);
hb_test_add (test_ot_layout_language_get_feature_tags);
return hb_test_run ();
}