diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2016-03-19 17:36:09 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2016-03-19 17:36:09 +0000 |
commit | 31d8f30d9c901a14cb49da404f1148ad5d09351a (patch) | |
tree | 31fc51e087b1030c2722845143dc945a78f2dc3f /test | |
parent | d9bcc1ab220d2091362bcc86c5829ba86652c71b (diff) | |
download | netpbm-mirror-31d8f30d9c901a14cb49da404f1148ad5d09351a.tar.gz netpbm-mirror-31d8f30d9c901a14cb49da404f1148ad5d09351a.tar.xz netpbm-mirror-31d8f30d9c901a14cb49da404f1148ad5d09351a.zip |
Lots of Pbmtext/libpbmfont fixes and enhancements from Akira Urushibata
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2686 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test')
-rw-r--r-- | test/pbmtext.ok | 34 | ||||
-rwxr-xr-x | test/pbmtext.test | 64 |
2 files changed, 73 insertions, 25 deletions
diff --git a/test/pbmtext.ok b/test/pbmtext.ok index 438fe7b8..f19df9aa 100644 --- a/test/pbmtext.ok +++ b/test/pbmtext.ok @@ -1,21 +1,13 @@ -1427751145 328 -1975911793 129 -3145408696 273 -2662867350 328 -3630387453 129 -1251480181 297 -1522829573 299 -1333433014 114 -4128014259 249 -2350105502 270 -2044333794 84 -2845861861 177 -2754777566 416 -3452484090 174 -2294575230 297 -67558248 387 -1647907430 159 -2846042958 249 -307551150 328 -584153820 114 -3355717231 177 +3898818212 967 +3898818212 967 +2506052117 1354 +2506052117 1354 +1028079028 967 +1888680721 445 +1305436978 1018 +1028079028 967 +1028079028 967 +1305436978 1018 +1305436978 1018 +1647614653 2027 +1647614653 2027 diff --git a/test/pbmtext.test b/test/pbmtext.test index dffb2cb4..0a177270 100755 --- a/test/pbmtext.test +++ b/test/pbmtext.test @@ -1,12 +1,68 @@ #! /bin/bash # This script tests: pbmtext -# Also requires: +# Also requires: pamfile +tmpdir=${tmpdir:-/tmp} + +# Test 1: + +pbmtext UNIX Philosophy: Do one thing and do it well. | cksum +echo -n "UNIX Philosophy: Do one thing and do it well." | pbmtext | cksum + +pbmtext -builtin fixed \ + For truth is always strange. Stranger than fiction. Lord Byron | cksum +echo -n "For truth is always strange. Stranger than fiction. Lord Byron" | \ + pbmtext -builtin fixed | cksum + + +text="The quick brown fog jumps over the lazy docs." + +# Test 2: -for i in 0123456789 abcdefghijk lmnopqrst uzwxyz ABCDEFGHIJK LMNOPQRST UVWXYZ -do for flags in "" "-nom" "-builtin fixed" do -echo $i | pbmtext $flags | cksum +echo $text | pbmtext $flags | cksum done + +temp_pbm=${tmpdir}/temp.pbm + + +# Test 3: Check if image is produced unaltered when -width is specified +# Should print 1028079028 967 twice, then 1305436978 1018 twice + +for flags in "" "-builtin fixed" +do +pbmtext ${flags} ${text} | tee ${temp_pbm} | cksum +width=`pamfile ${temp_pbm} | awk '$2=="PBM" && NR==1 { w=$4}; END {print w}' ` +pbmtext ${flags} -width=$width $text | cksum +rm ${temp_pbm} done + + +# Test 3: Should print 1647614653 2027 twice +# Note: backslashes inserted in 3 locations in the rectange to make +# possible input as a here document. + +fontRectangle_txt=${tmpdir}/fontRectangle.txt +font_pbm=${tmpdir}/font.pbm + +cat > ${fontRectangle_txt} << EOF +M ",/^_[\`jpqy| M + +/ !"#$%&'()*+ / +< ,-./01234567 < +> 89:;<=>?@ABC > +@ DEFGHIJKLMNO @ +_ PQRSTUVWXYZ[ _ +{ \\]^_\`abcdefg { +} hijklmnopqrs } +~ tuvwxyz{|}~ ~ + +M ",/^_[\`jpqy| M +EOF + +cat ${fontRectangle_txt} | pbmtext -nom -builtin fixed | tee ${font_pbm} | \ +cksum +cat ${fontRectangle_txt} | pbmtext -nom -font ${font_pbm} | cksum + +rm ${fontRectangle_txt} ${font_pbm} |