[src] Add test-use-table

Fixes https://github.com/harfbuzz/harfbuzz/issues/3758
This commit is contained in:
Behdad Esfahbod 2022-08-02 12:18:18 -06:00
parent e387b3acd3
commit 826639fab2
5 changed files with 24 additions and 42 deletions

View File

@ -321,6 +321,7 @@ noinst_PROGRAMS = \
test-ot-glyphname \
test-gpos-size-params \
test-gsub-would-substitute \
test-use-table \
$(NULL)
bin_PROGRAMS =
@ -348,6 +349,10 @@ test_ot_glyphname_SOURCES = test-ot-glyphname.cc
test_ot_glyphname_CPPFLAGS = $(HBCFLAGS)
test_ot_glyphname_LDADD = libharfbuzz.la $(HBLIBS)
test_use_table_SOURCES = test-use-table.cc
test_use_table_CPPFLAGS = $(HBCFLAGS)
test_use_table_LDADD = libharfbuzz.la $(HBLIBS)
test_gpos_size_params_SOURCES = test-gpos-size-params.cc
test_gpos_size_params_CPPFLAGS = $(HBCFLAGS)
test_gpos_size_params_LDADD = libharfbuzz.la $(HBLIBS)

View File

@ -497,27 +497,6 @@ for k,v in sorted(use_positions.items()):
tag = k + suf
print ("#undef %s" % tag)
print ()
print (r"""
#ifdef HB_USE_TABLE_MAIN
int main (int argc, char **argv)
{
if (argc != 2)
{
for (unsigned u = 0; u < 0x10FFFFu; u++)
printf ("U+%04X %d\n", u, hb_use_get_category (u));
return 0;
}
hb_codepoint_t u;
sscanf (argv[1], "%x", &u);
printf ("%d\n", hb_use_get_category (u));
return 0;
}
#endif
""")
print ()
print ("#endif /* HB_OT_SHAPER_USE_TABLE_HH */")
print ("/* == End of generated table == */")

View File

@ -393,26 +393,5 @@ hb_use_get_category (unsigned u)
#undef VMPre
#ifdef HB_USE_TABLE_MAIN
int main (int argc, char **argv)
{
if (argc != 2)
{
for (unsigned u = 0; u < 0x10FFFFu; u++)
printf ("U+%04X %d\n", u, hb_use_get_category (u));
return 0;
}
hb_codepoint_t u;
sscanf (argv[1], "%x", &u);
printf ("%d\n", hb_use_get_category (u));
return 0;
}
#endif
#endif /* HB_OT_SHAPER_USE_TABLE_HH */
/* == End of generated table == */

View File

@ -558,6 +558,7 @@ if get_option('tests').enabled()
'test-ot-glyphname': 'test-ot-glyphname.cc',
'test-ot-gpos-size-params': 'test-gpos-size-params.cc',
'test-ot-gsub-would-substitute': 'test-gsub-would-substitute.cc',
'test-use-table': 'test-use-table.cc',
}
foreach name, source : noinst_programs
executable(name, source,

18
src/test-use-table.cc Normal file
View File

@ -0,0 +1,18 @@
#include "hb-ot-shaper-use-table.hh"
int main (int argc, char **argv)
{
if (argc != 2)
{
for (unsigned u = 0; u < 0x10FFFFu; u++)
printf ("U+%04X %d\n", u, hb_use_get_category (u));
return 0;
}
hb_codepoint_t u;
sscanf (argv[1], "%x", &u);
printf ("%d\n", hb_use_get_category (u));
return 0;
}