add gvar & HVAR retain-gids test cases

This commit is contained in:
Michiharu Ariza 2019-03-19 12:34:03 -07:00
parent 43420dfa96
commit dc10a7ef60
3 changed files with 45 additions and 0 deletions

View File

@ -68,6 +68,27 @@ test_subset_gvar (void)
hb_face_destroy (face_ac);
}
static void
test_subset_gvar_retaingids (void)
{
hb_face_t *face_abc = hb_test_open_font_file ("fonts/SourceSansVariable-Roman.abc.ttf");
hb_face_t *face_ac = hb_test_open_font_file ("fonts/SourceSansVariable-Roman.ac.retaingids.ttf");
hb_set_t *codepoints = hb_set_create ();
hb_face_t *face_abc_subset;
hb_set_add (codepoints, 'a');
hb_set_add (codepoints, 'c');
hb_subset_input_t *input = hb_subset_test_create_input (codepoints);
hb_subset_input_set_retain_gids (input, true);
face_abc_subset = hb_subset_test_create_subset (face_abc, input);
hb_set_destroy (codepoints);
hb_subset_test_check (face_ac, face_abc_subset, HB_TAG ('g','v','a','r'));
hb_face_destroy (face_abc_subset);
hb_face_destroy (face_abc);
hb_face_destroy (face_ac);
}
int
main (int argc, char **argv)
@ -76,6 +97,7 @@ main (int argc, char **argv)
hb_test_add (test_subset_gvar_noop);
hb_test_add (test_subset_gvar);
hb_test_add (test_subset_gvar_retaingids);
return hb_test_run ();
}

View File

@ -68,6 +68,28 @@ test_subset_HVAR (void)
hb_face_destroy (face_ac);
}
static void
test_subset_HVAR_retaingids (void)
{
hb_face_t *face_abc = hb_test_open_font_file ("fonts/SourceSansVariable-Roman.abc.ttf");
hb_face_t *face_ac = hb_test_open_font_file ("fonts/SourceSansVariable-Roman.ac.retaingids.ttf");
hb_set_t *codepoints = hb_set_create ();
hb_face_t *face_abc_subset;
hb_set_add (codepoints, 'a');
hb_set_add (codepoints, 'c');
hb_subset_input_t *input = hb_subset_test_create_input (codepoints);
hb_subset_input_set_retain_gids (input, true);
face_abc_subset = hb_subset_test_create_subset (face_abc, input);
hb_set_destroy (codepoints);
hb_subset_test_check (face_ac, face_abc_subset, HB_TAG ('H','V','A','R'));
hb_face_destroy (face_abc_subset);
hb_face_destroy (face_abc);
hb_face_destroy (face_ac);
}
int
main (int argc, char **argv)
@ -76,6 +98,7 @@ main (int argc, char **argv)
hb_test_add (test_subset_HVAR_noop);
hb_test_add (test_subset_HVAR);
hb_test_add (test_subset_HVAR_retaingids);
return hb_test_run ();
}