about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2022-02-27 04:27:49 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2022-02-27 04:27:49 +0000
commit1f2fb04372fb195cddc650c8c049e2be0d4132e9 (patch)
tree43fa3bc7f265f68fa12715e69e39e0eafc1cc875 /test
parent5e1a7a822c4e00da643e12c48bebdb298e7b3093 (diff)
downloadnetpbm-mirror-1f2fb04372fb195cddc650c8c049e2be0d4132e9.tar.gz
netpbm-mirror-1f2fb04372fb195cddc650c8c049e2be0d4132e9.tar.xz
netpbm-mirror-1f2fb04372fb195cddc650c8c049e2be0d4132e9.zip
New tests for pnmpad and pam editors, converters
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4284 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test')
-rw-r--r--test/Test-Order3
-rw-r--r--test/pnmpad-reportonly.ok67
-rwxr-xr-xtest/pnmpad-reportonly.test129
-rw-r--r--test/stdin-pam1.ok42
-rwxr-xr-xtest/stdin-pam1.test72
-rw-r--r--test/stdin-pam2.ok5
-rwxr-xr-xtest/stdin-pam2.test63
7 files changed, 381 insertions, 0 deletions
diff --git a/test/Test-Order b/test/Test-Order
index c2f59a74..5962348f 100644
--- a/test/Test-Order
+++ b/test/Test-Order
@@ -80,6 +80,7 @@ pnminvert.test
 pamchannel.test
 ppmchange.test
 pambackground.test
+pnmpad-reportonly.test
 pnmpaste-pbm.test
 
 ppmshift.test
@@ -140,6 +141,8 @@ stdin-ppm2.test
 stdin-ppm3.test
 stdin-pnm1.test
 stdin-pnm2.test
+stdin-pam1.test
+stdin-pam2.test
 
 pbm-misc-converters.test
 
diff --git a/test/pnmpad-reportonly.ok b/test/pnmpad-reportonly.ok
new file mode 100644
index 00000000..e7d0a0d1
--- /dev/null
+++ b/test/pnmpad-reportonly.ok
@@ -0,0 +1,67 @@
+Test 1.  Should print 0 0 0 0 227 149 six times
+0 0 0 0 227 149
+0 0 0 0 227 149
+0 0 0 0 227 149
+0 0 0 0 227 149
+0 0 0 0 227 149
+0 0 0 0 227 149
+Test 2.  Should print 10 0 0 0 110 17 seven times
+10 0 0 0 110 17
+10 0 0 0 110 17
+10 0 0 0 110 17
+10 0 0 0 110 17
+10 0 0 0 110 17
+10 0 0 0 110 17
+10 0 0 0 110 17
+Test 3.  Should print 0 10 0 0 110 19 eight times
+0 10 0 0 110 19
+0 10 0 0 110 19
+0 10 0 0 110 19
+0 10 0 0 110 19
+0 10 0 0 110 19
+0 10 0 0 110 19
+0 10 0 0 110 19
+0 10 0 0 110 19
+Test 4.  Should print 10 10 0 0 120 19 four times
+10 10 0 0 120 19
+10 10 0 0 120 19
+10 10 0 0 120 19
+10 10 0 0 120 19
+Test 5.  Should print 0 0 10 0 27 110 seven times
+0 0 10 0 27 110
+0 0 10 0 27 110
+0 0 10 0 27 110
+0 0 10 0 27 110
+0 0 10 0 27 110
+0 0 10 0 27 110
+0 0 10 0 27 110
+Test 6.  Should print 0 0 0 10 19 110 eight times
+0 0 0 10 19 110
+0 0 0 10 19 110
+0 0 0 10 19 110
+0 0 0 10 19 110
+0 0 0 10 19 110
+0 0 0 10 19 110
+0 0 0 10 19 110
+0 0 0 10 19 110
+Test 7.  Should print 0 0 12 12 27 124 four times
+0 0 12 12 27 124
+0 0 12 12 27 124
+0 0 12 12 27 124
+0 0 12 12 27 124
+Test 8.  Should print 5 10 0 0 115 17 seven times
+5 10 0 0 115 17
+5 10 0 0 115 17
+5 10 0 0 115 17
+5 10 0 0 115 17
+5 10 0 0 115 17
+5 10 0 0 115 17
+5 10 0 0 115 17
+Test 9.  Should print 0 0 4 8 19 112 seven times
+0 0 4 8 19 112
+0 0 4 8 19 112
+0 0 4 8 19 112
+0 0 4 8 19 112
+0 0 4 8 19 112
+0 0 4 8 19 112
+0 0 4 8 19 112
diff --git a/test/pnmpad-reportonly.test b/test/pnmpad-reportonly.test
new file mode 100755
index 00000000..ccd79e69
--- /dev/null
+++ b/test/pnmpad-reportonly.test
@@ -0,0 +1,129 @@
+#! /bin/sh
+# This script tests: pnmpad
+# Also requires: pbmmake pgmmake ppmmake pamfile
+
+tmpdir=${tmpdir:-/tmp}
+
+test1_pbm=${tmpdir}/test1.pbm
+test2_pbm=${tmpdir}/test2.pbm
+test_pgm=${tmpdir}/test.pgm
+test_ppm=${tmpdir}/test.ppm
+
+testimg_size=$(pamfile -size testimg.ppm) 
+
+echo "Test 1.  Should print 0 0 0 0 ${testimg_size} six times" 
+
+for pad in "" "-left=0" "-right=0" "-top=0" "-bottom=0" \
+           "-left=0 -right=0 -top=0 -bottom=0"
+  do
+  pnmpad -reportonly ${pad} testimg.ppm || echo "failure"
+  done
+
+
+echo "Test 2.  Should print 10 0 0 0 110 17 seven times" 
+ 
+pbmmake -w 100 17 > ${test1_pbm}
+for pad in "-left=10" \
+           "-left=10 -right=0" \
+           "-left=10 -width=90" \
+           "-left=10 -width=105" \
+           "-left=10 -width=110" \
+           "-right=0 -width=110" \
+           "-halign=1.0 -width=110"
+  do
+  pnmpad -reportonly ${pad} ${test1_pbm} || echo "failure"
+  done
+
+
+echo "Test 3.  Should print 0 10 0 0 110 19 eight times" 
+pgmmake 0.5 100 19 > ${test_pgm}
+for pad in "-right=10" \
+           "-right=10 -left=0" \
+           "-right=10 -width=90" \
+           "-right=10 -width=105" \
+           "-right=10 -width=110" \
+           "-left=0 -width=110" \
+           "-halign=0.0 -width=110" \
+           "-right=1 -mwidth=11"
+  do
+  pnmpad -reportonly ${pad} ${test_pgm} || echo "failure"
+  done
+
+
+echo "Test 4.  Should print 10 10 0 0 120 19 four times" 
+for pad in "-left=10 -right=10" \
+           "-right=10 -width=120" \
+           "-halign=0.5 -width=120" \
+           "-left=1 -right=1 -mwidth=30"
+  do
+  pnmpad -reportonly ${pad} ${test_pgm} || echo "failure"
+  done
+
+
+echo "Test 5.  Should print 0 0 10 0 27 110 seven times" 
+ 
+pbmmake -w 27 100 > ${test2_pbm}
+for pad in "-top=10" \
+           "-top=10 -bottom=0" \
+           "-top=10 -height=50" \
+           "-top=10 -height=101" \
+           "-top=10 -height=110" \
+           "-bottom=0 -height=110" \
+           "-valign=1.0 -height=110"
+  do
+  pnmpad -reportonly ${pad} ${test2_pbm} || echo "failure"
+  done
+
+
+echo "Test 6.  Should print 0 0 0 10 19 110 eight times" 
+ppmmake rgb:33/44/55 19 100 > ${test_ppm}
+for pad in "-bottom=10" \
+           "-bottom=10 -top=0" \
+           "-bottom=10 -height=10" \
+           "-bottom=10 -height=107" \
+           "-bottom=10 -height=110" \
+           "-top=0 -height=110" \
+           "-valign=0.0 -height=110" \
+           "-bottom=1 -mheight=10"
+  do
+  pnmpad -reportonly ${pad} ${test_ppm} || echo "failure"
+  done
+
+
+echo "Test 7.  Should print 0 0 12 12 27 124 four times" 
+for pad in "-top=12 -bottom=12" \
+           "-top=12 -height=124" \
+           "-valign=0.5 -height=124" \
+           "-top=11 -bottom=11 -mheight=4"
+  do
+  pnmpad -reportonly ${pad} ${test2_pbm} || echo "failure"
+  done
+
+
+echo "Test 8.  Should print 5 10 0 0 115 17 seven times"
+for pad in "-l 5 -r 10 -w 115" \
+           "-l 5       -w 115" \
+           "     -r 10 -w 115" \
+           "-l 5 -r 10       " \
+           "-halign 0.333 -w 115 " \
+           "-l 2 -r 4 -mw 23" \
+           "-halign 0.333 -mw 23"
+  do
+  pnmpad -reportonly ${pad} ${test1_pbm} || echo "failure"
+  done
+
+
+echo "Test 9.  Should print 0 0 4 8 19 112 seven times"
+for pad in "-t 4 -b 8 -h 112" \
+           "-t 4      -h 112" \
+           "     -b 8 -h 112" \
+           "-t 4 -b 8       " \
+           "-t 4 -b 8 -mh 14" \
+           "-valign 0.333 -mh 14" \
+           "-valign 0.333 -h 112"
+  do
+  pnmpad -reportonly ${pad} ${test_ppm} || echo "failure"
+  done
+
+
+rm ${test1_pbm} ${test2_pbm} ${test_pgm} ${test_ppm}
diff --git a/test/stdin-pam1.ok b/test/stdin-pam1.ok
new file mode 100644
index 00000000..6bf37d90
--- /dev/null
+++ b/test/stdin-pam1.ok
@@ -0,0 +1,42 @@
+pamaddnoise -seed=1: 0 0 0
+pamaltsat -strength=1: 0 0 0
+pambackground: 0 0 0
+pambayer -type=2: 0 0 0
+pambrighten: 0 0 0
+pamcut: 0 0 0
+pamdeinterlace: 0 0 0
+pamdepth 15: 0 0 0
+pamditherbw -threshold: 0 0 0
+pamedge: 0 0 0
+pamexec cat: 0 0 0
+pamfile -size: 0 0 0
+pamfind -target=1: 0 0 0
+pamfix: 0 0 0
+pamflip -lr: 0 0 0
+pamfunc -not: 0 0 0
+pamhomography -from 0,0,0,1,1,0,1,1: 0 0 0
+pamhue -huechange=60: 0 0 0
+pamlevels -f1 rgb:0/0/0 -t1 rgb:0/0/0 -f2 rgb:ff/ff/ff -t2 rgb:ff/ff/ff: 0 0 0
+pammixinterlace: 0 0 0
+pammosaicknit: 0 0 0
+pamoil: 0 0 0
+pamperspective 0 0 0 1 1 0 1 1: 0 0 0
+pamrecolor: 0 0 0
+pamrubber -quad 1 1 2 2: 0 0 0
+pamscale 2: 0 0 0
+pamshadedrelief: 0 0 0
+pamsharpness: 0 0 0
+pamsistoaglyph: 0 0 0
+pamslice -row=1: 0 0 0
+pamsplit: 0 0 0
+pamstack: 0 0 0
+pamstereogram -randomseed=1: 0 0 0
+pamstretch 1: 0 0 0
+pamstretch-gen 1: 0 0 0
+pamsumm -max: 0 0 0
+pamsummcol -mean: 0 0 0
+pamtable: 0 0 0
+pamthreshold: 0 0 0
+pamtilt: 0 0 0
+pamtopnm: 0 0 0
+pamwipeout -tb: 0 0 0
diff --git a/test/stdin-pam1.test b/test/stdin-pam1.test
new file mode 100755
index 00000000..98904721
--- /dev/null
+++ b/test/stdin-pam1.test
@@ -0,0 +1,72 @@
+#! /bin/bash
+# This script tests: pamaddnoise pamaltsat pambackground pambayer
+# This script tests: pambrighten pamcut pamdeinterlace pamdepth pamditherbw
+# This script tests: pamedge pamexec pamfile pamfind pamfix pamflip
+# This script tests: pamfunc pamhomography pamhue pamlevels
+# This script tests: pammixinterlace pammosaicknit pamoil
+# This script tests: pamperspective pamrecolor pamrubber pamscale
+# This script tests: pamshadedrelief pamsharpness pamsistoaglyph
+# This script tests: pamslice pamsplit pamstack pamstereogram pamstretch
+# This script tests: pamstretch-gen pamsumm pamsummcol pamtable pamthreshold
+# This script tests: pamtilt pamtopnm pamwipeout
+# Also requires: pbmmake
+
+tmpdir=${tmpdir:-/tmp}
+out1=${tmpdir}/out1
+out2=${tmpdir}/out2
+small_pbm=${tmpdir}/small.pbm
+
+pbmmake -g 5 5 > ${small_pbm}
+
+for testprog in \
+    "pamaddnoise -seed=1" \
+    "pamaltsat -strength=1" \
+    pambackground \
+    "pambayer -type=2" \
+    pambrighten \
+    pamcut \
+    pamdeinterlace \
+    "pamdepth 15" \
+    "pamditherbw -threshold" \
+    pamedge \
+    "pamexec cat" \
+    "pamfile -size" \
+    "pamfind -target=1" \
+    pamfix \
+    "pamflip -lr" \
+    "pamfunc -not" \
+    "pamhomography -from 0,0,0,1,1,0,1,1" \
+    "pamhue -huechange=60" \
+    "pamlevels -f1 rgb:0/0/0 -t1 rgb:0/0/0 -f2 rgb:ff/ff/ff -t2 rgb:ff/ff/ff" \
+    pammixinterlace \
+    pammosaicknit \
+    pamoil \
+    "pamperspective 0 0 0 1 1 0 1 1" \
+    pamrecolor \
+    "pamrubber -quad 1 1 2 2" \
+    "pamscale 2" \
+    pamshadedrelief \
+    pamsharpness \
+    pamsistoaglyph \
+    "pamslice -row=1" \
+    pamsplit \
+    pamstack \
+    "pamstereogram -randomseed=1" \
+    "pamstretch 1" \
+    "pamstretch-gen 1" \
+    "pamsumm -max" \
+    "pamsummcol -mean" \
+    pamtable \
+    pamthreshold \
+    pamtilt \
+    pamtopnm \
+    "pamwipeout -tb"   
+  do
+  ${testprog} ${small_pbm} > ${out1};      status1=$?
+  ${testprog} < ${small_pbm} > ${out2};    status2=$?
+  cmp -s ${out1} ${out2}
+  echo ${testprog}": "${status1} ${status2} $?
+  rm ${out1} ${out2}
+  done
+
+rm ${small_pbm}
diff --git a/test/stdin-pam2.ok b/test/stdin-pam2.ok
new file mode 100644
index 00000000..69129c0b
--- /dev/null
+++ b/test/stdin-pam2.ok
@@ -0,0 +1,5 @@
+pammasksharpen: 0 0 0
+pammixmulti: 0 0 0
+pamdice: 0 0 0
+pamlookup: 0 0 0
+pamunlookup: 0 0 0
diff --git a/test/stdin-pam2.test b/test/stdin-pam2.test
new file mode 100755
index 00000000..8c18afde
--- /dev/null
+++ b/test/stdin-pam2.test
@@ -0,0 +1,63 @@
+#! /bin/bash
+# This script tests: pammasksharpen pammixmulti pamdice
+# This script tests: pamlookup pamunlookup
+# Also requires: pbmmake
+
+tmpdir=${tmpdir:-/tmp}
+out1=${tmpdir}/out1
+out2=${tmpdir}/out2
+out3=${tmpdir}/out3
+out4=${tmpdir}/out4
+small_pbm=${tmpdir}/small.pbm
+
+pbmmake -g 3 3 > ${small_pbm}
+
+for testprog in \
+    pammasksharpen \
+    pammixmulti
+  do
+  ${testprog} ${small_pbm}   ${small_pbm} > ${out1};   status1=$?
+  ${testprog} ${small_pbm} < ${small_pbm} > ${out2};   status2=$?
+  cmp -s ${out1} ${out2}
+  echo ${testprog}": "${status1} ${status2} $?
+  rm ${out1} ${out2}
+  done
+
+  dicestem=${tmpdir}/dice
+
+  testprog="pamdice -outstem=${dicestem}"
+  ${testprog} ${small_pbm}; status1=$?
+  cat ${dicestem}_*_*.pbm > ${out1}
+  rm ${dicestem}_*_*.pbm
+  ${testprog} < ${small_pbm}; status2=$?
+  cat ${dicestem}_*_*.pbm > ${out2}
+  rm ${dicestem}_*_*.pbm
+  cmp -s ${out1} ${out2}
+  echo pamdice: ${status1} ${status2} $?
+  rm ${out1} ${out2}
+
+lookup_ppm=${tmpdir}/lookup.ppm
+
+cat > ${lookup_ppm} <<EOF
+P3
+2 1
+2
+0 0 0
+0 1 2
+EOF
+
+  testprog="pamlookup -lookupfile=${lookup_ppm}"
+  ${testprog}   ${small_pbm} > ${out1}; status1=$?
+  ${testprog} < ${small_pbm} > ${out2}; status2=$?
+  cmp -s ${out1} ${out2}
+  echo pamlookup": "${status1} ${status2} $?
+  rm ${out2}
+
+  testprog="pamunlookup -lookupfile=${lookup_ppm}"
+  ${testprog}   ${out1} > ${out3}; status1=$?
+  ${testprog} < ${out1} > ${out4}; status2=$?
+  cmp -s ${out3} ${out4}
+  echo pamunlookup": "${status1} ${status2} $?
+  rm ${out1} ${out3} ${out4}
+
+rm ${lookup_ppm} ${small_pbm}