about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2016-03-27 02:13:26 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2016-03-27 02:13:26 +0000
commit512acb84fa5966ea6081d13435c9e85b96f59a42 (patch)
tree5a4282c41fb76c04c26ee7c164f363fcd3b493a6 /test
parent438d4e0aff3c4829bdd93c473117d8c680480f67 (diff)
downloadnetpbm-mirror-512acb84fa5966ea6081d13435c9e85b96f59a42.tar.gz
netpbm-mirror-512acb84fa5966ea6081d13435c9e85b96f59a42.tar.xz
netpbm-mirror-512acb84fa5966ea6081d13435c9e85b96f59a42.zip
Promote Development (10.74) to Advanced
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@2695 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test')
-rw-r--r--test/pbmtext.ok34
-rwxr-xr-xtest/pbmtext.test64
-rw-r--r--test/pnmpsnr.ok6
-rwxr-xr-xtest/pnmpsnr.test8
4 files changed, 81 insertions, 31 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}
diff --git a/test/pnmpsnr.ok b/test/pnmpsnr.ok
index b303cc9d..4c7eccde 100644
--- a/test/pnmpsnr.ok
+++ b/test/pnmpsnr.ok
@@ -1,2 +1,4 @@
-0.00 dB
-no difference
+0.00
+inf
+1000.00
+300.00 300.00 300.00
diff --git a/test/pnmpsnr.test b/test/pnmpsnr.test
index 3e7408ec..c7591983 100755
--- a/test/pnmpsnr.test
+++ b/test/pnmpsnr.test
@@ -12,9 +12,9 @@ b_pbm=${tmpdir}/b.pbm
 pbmmake -w 10 10 > ${w_pbm}
 pbmmake -b 10 10 > ${b_pbm}
 
-pnmpsnr  ${w_pbm}  ${b_pbm} 2>&1 | \
- awk '$2=="lumina" {print $(NF-1),$NF}'
-pnmpsnr  ${w_pbm}  ${w_pbm} 2>&1 | \
- awk '$2=="lumina" {print $(NF-1),$NF}'
+pnmpsnr  ${w_pbm}  ${b_pbm} -machine
+pnmpsnr  ${w_pbm}  ${w_pbm} -machine
+pnmpsnr  ${w_pbm}  ${w_pbm} -machine -max=1000
+pnmpsnr  testimg.ppm  testimg.ppm -machine -max=300
 
 rm ${b_pbm} ${w_pbm}