From 841e20d083aec8d814cd8d90aa6ab60127c0d1f2 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 14 Oct 2013 18:47:51 +0200 Subject: [PATCH] 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. --- test/shaping/Makefile.am | 10 +++++- ...ce528e99f600ed9c25a2b69e32eb94a03b4ae8.ttf | Bin 0 -> 1320 bytes ...add106a8205214fbe7337ef9de32a862b59762.ttf | Bin 0 -> 3040 bytes ...29e7fedc0b350222d7987345fe61613fa3929a.ttf | Bin 0 -> 1768 bytes ...99fbc23865022234775c43503bba2e63978fe1.ttf | Bin 0 -> 3564 bytes test/shaping/run-tests.sh | 34 ++++++++++++++++++ test/shaping/tests/MANIFEST | 1 + test/shaping/tests/context-matching.tests | 4 +++ 8 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 test/shaping/fonts/sha1sum/4cce528e99f600ed9c25a2b69e32eb94a03b4ae8.ttf create mode 100644 test/shaping/fonts/sha1sum/ceadd106a8205214fbe7337ef9de32a862b59762.ttf create mode 100644 test/shaping/fonts/sha1sum/d629e7fedc0b350222d7987345fe61613fa3929a.ttf create mode 100644 test/shaping/fonts/sha1sum/f499fbc23865022234775c43503bba2e63978fe1.ttf create mode 100755 test/shaping/run-tests.sh create mode 100644 test/shaping/tests/MANIFEST create mode 100644 test/shaping/tests/context-matching.tests diff --git a/test/shaping/Makefile.am b/test/shaping/Makefile.am index 4fb762ca..23957837 100644 --- a/test/shaping/Makefile.am +++ b/test/shaping/Makefile.am @@ -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 diff --git a/test/shaping/fonts/sha1sum/4cce528e99f600ed9c25a2b69e32eb94a03b4ae8.ttf b/test/shaping/fonts/sha1sum/4cce528e99f600ed9c25a2b69e32eb94a03b4ae8.ttf new file mode 100644 index 0000000000000000000000000000000000000000..dfaead72b4e6e688573a7838915d811986a9abee GIT binary patch literal 1320 zcmY*YU1%It6#nj=JG*hSO|$84kc|zqO$>sKt-INn2Me{drbr~g_!Ii#PPU0F&29pz z5*4Hc5g$v7)rw$R6pH%b<522CK(u|RJ`}0cMha!o$G-Sbvpef|?lhX*%gj07nRCu} z&bfD>0PMgiIG7qgeB^mNi35Ohm)89F)Z{cWNB|~HoE)Ei<UZcrSef&Ww?99Bo&Ni28?DgLdEWVo z_!RMArFwFu_r11HTp{jVSSs{v z{`=kci9aHK6$*7A{+KCY7qBarN)O~Rxl|z)J-Jk_uKx(av(COi#e)Zz^ib=zDYbqJ zt~r;RGtT9WRXwJbn91fb$C+mb@C@UMd{P7QuB*PVp>C?avg&Id3-tY=9)^b*Vff^>p&2==|FuPoLfH^glF^G%yGXKRiRG-9}QqbzQ96-!@nde?X zl7sEW1$6L)GrE^DCT(C42T{ViIBWA;(@(3v|MmLLXa9ycbKSW2;jGA?Phb1u!R>#% z#00zM@Wm#}+`xQ%1$A>(&ZN0!B{j|#@oKmmNL*#ykBJGfY+Ej`(_M82F5nj23k>Ox zq;m`Nnse2iF~{jJTAPbN`yf1a4o`Bt@X~7@Yxml%SUOCr&*D{ekNGWwDY?H|Kjx*y zvDPFE{dw2fmWIhbo;{kK$(FOVb{p7=8h0938s9W7Ha>~6F=lgV^h-AL2*0qphq`9Q z9vp_x$|f*}6P&k)L)?qpC!#CO^54g?%|zQIPeN(sD5G2zi@#NS^XcdE#Ym2fMY8x% zjus+3dW0FI*QCv~haA$S=HuAya;6Tk*yW4hXc{~YyQBC7JK77i;MaV1A^$cw56P_j z*|(SN6%gc5`v70tTcfCJ{D2|es3B^=e#;~LTls`vVr5Bu7Ee(VpXfIi8RZtwO+ literal 0 HcmV?d00001 diff --git a/test/shaping/fonts/sha1sum/ceadd106a8205214fbe7337ef9de32a862b59762.ttf b/test/shaping/fonts/sha1sum/ceadd106a8205214fbe7337ef9de32a862b59762.ttf new file mode 100644 index 0000000000000000000000000000000000000000..b37428ed202679d3414b669a3f68128f39012e18 GIT binary patch literal 3040 zcmai0eN0=|6+iDie?b^AU@*497_gr)AGWcv!8klS#>NRafH4H<3dJPBFfcd}5~FrW z8%>O)`y;C|O-<5C+ob)`b=st@+d56_AN_0Hv=3>O7A=~lPC~6VHIcSVNwCe%c{b%k z>-wJGz2}^J?!D)C&hOo4U;v;LUIq?k!og4<7{Cdj_!?UI@bFOVA9pj~Mg1oLtRfs6 z3w-mP*QEf(zXV{6Lou6U{MQY?2avyn{xj#2@szU3a2xdpsGms0*HWN^Mx0OM%EZ#f z+|Tbn{twFk1d#r1{zCjb*KOQDe>8!69t{AjA2fO2*SE$z$#g>c2(ZupCcb;C@zO$Nj2N52jYuF6~C)3hK|(IAToiexzU| z)nI`hh$04ob2{{FrK*%|Y_PKC#!`-YSBJooU0tElqadKciVmf$^oTAI^ph9AI6xCrFhDNv)Ss3gl(Xp25nos^nXjeWu`SPhDT=q>EQ9UbK&-eBQ-a zd+Welci@_L#QL0BYim?#TqB-_(X%nXxqa&9MDE9Wt3hcQP7lhP+`f#!y~)_3D*?x3 zz+6(_{l%BZE6)vg^n2RWm93t^PUmR1p~aan*B+~CP-~2ax{4CLrR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7kSEEWuUWDKs6-^(cOB}Z?{f3f&bzA18<7$szbzHF2m&vK)e XL7YW-qIHNPv`;=RWDuGUTG9SrzL_vQ literal 0 HcmV?d00001 diff --git a/test/shaping/fonts/sha1sum/d629e7fedc0b350222d7987345fe61613fa3929a.ttf b/test/shaping/fonts/sha1sum/d629e7fedc0b350222d7987345fe61613fa3929a.ttf new file mode 100644 index 0000000000000000000000000000000000000000..e674a78b6ef339bfb062ebee42b10134b133f600 GIT binary patch literal 1768 zcmb_cT})g>6#i!R?%f}j6$mVlG<26G3o!_|yDTZTNGmOt78Y3kH0_oPEG+HvQ=lxB zK0x6?6B8||4Mx+5u`g}tV{MFyZPcWRO43wnVrpzPF-;(98cQ2~7SG(ftCaZYo!mL| zotZi3J7>-e7yv6KphJ6g)&2u`0mlL9A!!S$>-_;_zzpb92wSQH&HLnKvy<=+fPL!^ z6uVbG{UZwK&d_{&XP+`?8aEXXzDL;GqYMwiKn;?>mY&Gz?%!6{257uY`~M7wl&)C) zxp7)=A)PNw3d^vLWB+EA_gZ zxw0YEnJUZ9T$iiVt4?PcTtc6bZnJsZzOqzDsY5Q?2zf>iw!T@nzw*4dvi{YwpR77P_woL#O{Q{_Ql%{zxSO#F$oIuq+~`wm^`2`>hl_ss`_#||Idc*H_` z%9`dPCq8bqnBFrcM}pN#(ScgtG_$#>a!ocAav6FWi*thMxS=F^m^kg`R zuCvr5*j8|l-NG}CAI5&#Xo#JT{Tf@!%l>8Y(zQ>rbJ{LHzQ}UeLpIB5CZwf>pHEJ| z*y@;Bo0Y;dManBJQ?C`ZeQ;-7^P`_5KX&r-tZ{b^&ve3(YvrnIUZR<3bmmwP{A*?-+`m6q=Qu=Ay6-|p9)@lZM|8m5lA1GC?s z)p90dj4F5;=<1OZgF_Mg=0KUnO zt_is?d23;pR?(v#AQx#H#p5whV>qpM#vQl|1>(+!ptjn5UwK zP71Pj>2!_y_w^o{_(GHXEV}t5*-MgTol)Xkn!tp{Hom*oU*|_95Zlyz7z))JqOOrv zslEX_B?8Tv=ZElC+7BBS-9#Or#Tgv@xewq5yRmzzF?z z1fZZF!!)Ww2%{=e&_i+vy=Wv|4^APXV)fnuo89P6IC)0OM3gfflbD{#@(HCYG^$v8 zM+c&z$Z&5@zkn(K!jh8h3eR?hS15!F4kI{4s-3n4Hq|eu$e5Z5nWRNUloe#tt03}V zR-0B2W)z|ZoD8~QRn1yymeuZUw37tc7SYjerDJp$){aPY7+Ivz(a+;ISEe^G1r?N) z8x&&}I~>;&H+U(pVy)OCcyYBC>;w{@;3|3}{erJ(3CqI5b-b;flXx@#zc0Z+M5o)r zw}z@CiF8H(;VQwM(+-jGtu{p6ZI5EB-E{1r=z#Wr?20ILY96%n(h%FiC5^Hs-o{*N P;zlNNqsfGSx}d<{5Lhtk literal 0 HcmV?d00001 diff --git a/test/shaping/fonts/sha1sum/f499fbc23865022234775c43503bba2e63978fe1.ttf b/test/shaping/fonts/sha1sum/f499fbc23865022234775c43503bba2e63978fe1.ttf new file mode 100644 index 0000000000000000000000000000000000000000..3c6059344ad8ac5b06cb9181725b7d5dae73d616 GIT binary patch literal 3564 zcmai14Nz3q6+ZXvd%KIQz_PHLs$*amca0(1fnC-bBT5jWQE-A$qZC+_pVZ|?7m-*@ zA&F_gR1FPnOeAemW3A1YbUOY_Oo(k`Yc-nEbh?R7JCmvD_&3#QEu+Z3*YCW?f;u|g zH}AfC&OP`1eD|F5-jX1qBM)_Sa0t!@Z4JAUQZ3;HMP50P6-YlOlFE8NtdfevpG?&F2@aN^`IMdV24)N0i!dWecXM7p$+orzq z)r|8O)-{)}E?T+u=-UTQ4_uTA0{vZi+f9St@45Nf$!iaMWbfYeRK;U?`Rd?}dv8UU+h#{h{5`pI$sw+%F#ffgF22e6~;?LL7fM?)kvq zGBSB4ZA0h>&?n!_?@|c-kI*1E_pnx zCo40995^OX*%ytbsBftIkNk1ow~y`U&hL_Z#gCrY{|k{O%wnH7lr|70xxVM?3$ufh zCKqjPC@i?IvcA1r{ahX3BOpoL5<5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HHkE~}mbI0^=LjGsr zVqd1y5?pK{iISls1(#uu|C_K*Go%gcY=d((Zi%TxP)1BFV@MchmxjzRIDC?3y%MT37GmLYAZ7~)G8Uk~>&c(8xZHC^N;2F7Lg5-EzUlJse$FS8sHe?*YjAht6 S&N2gILj%{QK(}Bmss97ijpUpF literal 0 HcmV?d00001 diff --git a/test/shaping/run-tests.sh b/test/shaping/run-tests.sh new file mode 100755 index 00000000..1da20649 --- /dev/null +++ b/test/shaping/run-tests.sh @@ -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 diff --git a/test/shaping/tests/MANIFEST b/test/shaping/tests/MANIFEST new file mode 100644 index 00000000..8a6157a5 --- /dev/null +++ b/test/shaping/tests/MANIFEST @@ -0,0 +1 @@ +context-matching.tests diff --git a/test/shaping/tests/context-matching.tests b/test/shaping/tests/context-matching.tests new file mode 100644 index 00000000..0d1d8a0f --- /dev/null +++ b/test/shaping/tests/context-matching.tests @@ -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] -- GitLab