提交 6faac8df 编写于 作者: Q Qunxin Liu 提交者: Garret Rieger

[subset] Subsetting Name Table Step 4

Add unit test and integration test
上级 e501ea14
......@@ -52,6 +52,7 @@ TEST_PROGS = \
test-subset-cff2 \
test-unicode \
test-version \
test-subset-nameids \
$(NULL)
test_subset_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la
......@@ -64,6 +65,7 @@ test_subset_post_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la
test_subset_vmtx_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la
test_subset_cff1_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la
test_subset_cff2_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la
test_subset_nameids_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la
test_unicode_CPPFLAGS = \
$(AM_CPPFLAGS) \
......
......@@ -65,6 +65,15 @@ hb_subset_test_create_input_from_glyphs (const hb_set_t *glyphs)
return input;
}
static inline hb_subset_input_t *
hb_subset_test_create_input_from_nameids (const hb_set_t *name_ids)
{
hb_subset_input_t *input = hb_subset_input_create_or_fail ();
hb_set_t * input_name_ids = hb_subset_input_nameid_set (input);
hb_set_union (input_name_ids, name_ids);
return input;
}
static inline hb_face_t *
hb_subset_test_create_subset (hb_face_t *source,
hb_subset_input_t *input)
......
/*
* Copyright © 2018 Google, Inc.
*
* This is part of HarfBuzz, a text shaping library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Google Author(s): Garret Rieger
*/
#include "hb-test.h"
#include "hb-subset-test.h"
static void
test_subset_nameids (void)
{
hb_face_t *face_origin = hb_test_open_font_file ("fonts/nameID.origin.ttf");
hb_face_t *face_expected = hb_test_open_font_file ("fonts/nameID.expected.ttf");
hb_set_t *name_ids = hb_set_create();
hb_face_t *face_subset;
hb_set_add (name_ids, 0);
hb_set_add (name_ids, 9);
face_subset = hb_subset_test_create_subset (face_origin, hb_subset_test_create_input_from_nameids (name_ids));
hb_set_destroy (name_ids);
hb_subset_test_check (face_expected, face_subset, HB_TAG ('n','a','m','e'));
hb_face_destroy (face_subset);
hb_face_destroy (face_origin);
hb_face_destroy (face_expected);
}
int
main (int argc, char **argv)
{
hb_test_init (&argc, &argv);
hb_test_add (test_subset_nameids);
return hb_test_run();
}
......@@ -6,6 +6,7 @@ default.txt
drop-hints.txt
drop-hints-retain-gids.txt
retain-gids.txt
name-ids.txt
SUBSETS:
abc
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册