From ec47cd95ba6c550314a1cbcc46fafd7946e52ece Mon Sep 17 00:00:00 2001 From: Garret Rieger Date: Wed, 7 Mar 2018 10:33:02 -0800 Subject: [PATCH] [subset] Unit test to check that post subsetting drops glyph names. --- test/api/Makefile.am | 2 + ...-Regular.660E,6975,73E0,5EA6,8F38,6E05.ttf | Bin 3572 -> 3724 bytes test/api/test-subset-post.c | 61 ++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 test/api/test-subset-post.c diff --git a/test/api/Makefile.am b/test/api/Makefile.am index 3c5a5ccfc..54e367faa 100644 --- a/test/api/Makefile.am +++ b/test/api/Makefile.am @@ -36,6 +36,7 @@ TEST_PROGS = \ test-subset-hdmx \ test-subset-hmtx \ test-subset-os2 \ + test-subset-post \ test-subset-vmtx \ test-unicode \ test-version \ @@ -47,6 +48,7 @@ test_subset_glyf_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la test_subset_hdmx_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la test_subset_hmtx_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la test_subset_os2_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la +test_subset_post_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la test_subset_vmtx_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la test_unicode_CPPFLAGS = \ diff --git a/test/api/fonts/Mplus1p-Regular.660E,6975,73E0,5EA6,8F38,6E05.ttf b/test/api/fonts/Mplus1p-Regular.660E,6975,73E0,5EA6,8F38,6E05.ttf index 89c7a1accde325ab37f39472069986cb4d753ee3..2a978fbdc621c828b235634e7ac2f011d6a1e273 100644 GIT binary patch delta 353 zcmew&-6K0e!J_L*s1pMNI|C3LNiHie+FitRKUcDe8(IH2Ij_s{Nj?b)2~?=7#h%Z`$TWEtue?1lKp2@AnHgCaSsB?F+1X3;GEH3_%|Nu7nSm>q bwlp^d)2;?!+T7UH0K~U&Gq#w#gVzQC!mLt# delta 205 zcmeB?{USX + +#include "hb-test.h" +#include "hb-subset-test.h" + +/* Unit tests for hmtx subsetting */ + +static void +test_post_drops_glyph_names (void) +{ + hb_face_t *face_full = hb_subset_test_open_font ("fonts/Mplus1p-Regular.660E,6975,73E0,5EA6,8F38,6E05.ttf"); + hb_face_t *face_subset = hb_subset_test_open_font ("fonts/Mplus1p-Regular.660E.ttf"); + + hb_set_t *codepoints = hb_set_create (); + hb_set_add (codepoints, 0x660E); + + hb_face_t *face_full_subset = hb_subset_test_create_subset (face_full, hb_subset_test_create_input (codepoints)); + hb_set_destroy (codepoints); + + hb_subset_test_check (face_subset, face_full_subset, HB_TAG ('p','o','s','t')); + + hb_face_destroy (face_full_subset); + hb_face_destroy (face_full); + hb_face_destroy (face_subset); +} + +int +main (int argc, char **argv) +{ + hb_test_init (&argc, &argv); + + hb_test_add (test_post_drops_glyph_names); + + return hb_test_run(); +}