[subset] add test for hb_subset_input_set (...).

This commit is contained in:
Garret Rieger 2021-08-27 10:31:37 -07:00
parent 7194c2a2a3
commit 102666dab7
2 changed files with 30 additions and 1 deletions

View File

@ -352,7 +352,6 @@ hb_subset_input_drop_tables_set (hb_subset_input_t *input)
HB_EXTERN hb_set_t *
hb_subset_input_set (hb_subset_input_t *input, hb_subset_sets_t set_type)
{
// TODO(garretrieger): add test for this method.
return input->sets_iter () [set_type];
}

View File

@ -127,6 +127,35 @@ test_subset_set_flags (void)
}
static void
test_subset_sets (void)
{
hb_subset_input_t *input = hb_subset_input_create_or_fail ();
hb_set_t* set = hb_set_create ();
hb_set_add (hb_subset_input_set (input, HB_SUBSET_SETS_GLYPH_INDEX), 83);
hb_set_add (hb_subset_input_set (input, HB_SUBSET_SETS_UNICODE), 85);
hb_set_clear (hb_subset_input_set (input, HB_SUBSET_SETS_LAYOUT_FEATURE_TAG));
hb_set_add (hb_subset_input_set (input, HB_SUBSET_SETS_LAYOUT_FEATURE_TAG), 87);
hb_set_add (set, 83);
g_assert (hb_set_is_equal (hb_subset_input_glyph_set (input), set));
hb_set_clear (set);
hb_set_add (set, 85);
g_assert (hb_set_is_equal (hb_subset_input_unicode_set (input), set));
hb_set_clear (set);
hb_set_add (set, 87);
g_assert (hb_set_is_equal (hb_subset_input_layout_features_set (input), set));
hb_set_clear (set);
hb_set_destroy (set);
hb_subset_input_destroy (input);
}
static void
test_subset_legacy_api (void)
{
@ -185,6 +214,7 @@ main (int argc, char **argv)
hb_test_add (test_subset_no_inf_loop);
hb_test_add (test_subset_crash);
hb_test_add (test_subset_set_flags);
hb_test_add (test_subset_sets);
hb_test_add (test_subset_legacy_api);
return hb_test_run();