Add test suite for shaping results

The new test suite runs tests included under
hb/test/shaping/tests/*.tests, which themselves reference
font files stored by sha1sum under hb/test/shaping/fonts/sha1sum.
The fonts are produced using a subsetter to only include glyphs
needed to run the test.

Four initial tests are added for (Chain)Context matching,
of which three currently fail.
This commit is contained in:
Behdad Esfahbod 2013-10-14 18:47:51 +02:00
parent e2dab69291
commit 841e20d083
8 changed files with 48 additions and 1 deletions

View File

@ -7,7 +7,7 @@ DISTCLEANFILES =
MAINTAINERCLEANFILES =
manifests:
@$(srcdir)/hb-manifest-update "$(srcdir)/texts" "$(srcdir)/fonts"
@$(srcdir)/hb-manifest-update "$(srcdir)/texts" "$(srcdir)/fonts" "$(srcdir)/tests"
EXTRA_DIST += \
hb-diff \
@ -20,6 +20,7 @@ EXTRA_DIST += \
hb-unicode-decode \
hb-unicode-encode \
hb-unicode-prettyname \
run-tests.sh \
$(NULL)
# TODO Figure out Python stuff
@ -30,6 +31,13 @@ CLEANFILES += \
hb_test_tools.py[co] \
$(NULL)
TESTS = $(srcdir)/tests/*.tests
TESTS_ENVIRONMENT = \
srcdir="$(srcdir)" \
builddir="$(builddir)" \
$(srcdir)/run-tests.sh \
$(NULL)
.PHONY: manifests
-include $(top_srcdir)/git.mk

34
test/shaping/run-tests.sh Executable file
View File

@ -0,0 +1,34 @@
#!/bin/bash
test "x$srcdir" = x && srcdir=.
test "x$builddir" = x && builddir=.
test "x$top_builddir" = x && top_builddir=../..
hb_shape=$top_builddir/util/hb-shape
fails=0
if test $# = 0; then
set /dev/stdin
fi
IFS=:
for f in "$@"; do
echo "Running tests in $f"
while read fontfile unicodes glyphs_expected; do
echo "Testing $fontfile:$unicodes"
glyphs=`$srcdir/hb-unicode-encode "$unicodes" | $hb_shape "$srcdir/$fontfile"`
if ! test "x$glyphs" = "x$glyphs_expected"; then
echo "Actual: $glyphs" >&2
echo "Expected: $glyphs_expected" >&2
let fails=$fails+1
fi
done < "$f"
done
if test $fails != 0; then
echo "$fails tests failed."
exit 1
else
echo "All tests passed."
fi

View File

@ -0,0 +1 @@
context-matching.tests

View File

@ -0,0 +1,4 @@
fonts/sha1sum/4cce528e99f600ed9c25a2b69e32eb94a03b4ae8.ttf:U+1A48,U+1A58,U+1A25,U+1A48,U+1A58,U+1A25,U+1A6E,U+1A63:[uni1A48=0+1212|uni1A25=0+1912|uni1A58=0+0|uni1A48=3+1212|uni1A6E=3+1212|uni1A25=3+1912|uni1A58=3+0|uni1A63=3+1212]
fonts/sha1sum/d629e7fedc0b350222d7987345fe61613fa3929a.ttf:U+0915,U+093F,U+0915,U+093F:[ivowelsign03deva=0+530|kadeva=0+1561|ivowelsign03deva=2+530|kadeva=2+1561]
fonts/sha1sum/f499fbc23865022234775c43503bba2e63978fe1.ttf:U+09B0,U+09CD,U+09A5,U+09CD,U+09AF,U+09C0:[gid1=0+1320|gid13=0+523|gid18=0+545]
fonts/sha1sum/ceadd106a8205214fbe7337ef9de32a862b59762.ttf:U+1014,U+1039,U+1011,U+1014,U+1039,U+1011,U+1014,U+1039,U+1011:[gid4=0+1118|gid5=0@97,0+600|gid4=3+1118|gid5=3@97,0+600|gid4=6+1118|gid5=6@97,0+0]