about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2020-08-26 02:39:35 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2020-08-26 02:39:35 +0000
commit240092f6f6fa828619baee475bab885eec762446 (patch)
tree51b5b1af78d6abba2830a3f1b45531bcb47ae8d8 /test
parenta124845acfedf0ade1eae957988a5e8de4795bb4 (diff)
downloadnetpbm-mirror-240092f6f6fa828619baee475bab885eec762446.tar.gz
netpbm-mirror-240092f6f6fa828619baee475bab885eec762446.tar.xz
netpbm-mirror-240092f6f6fa828619baee475bab885eec762446.zip
Add tests for ppmsvgalib,pambrighten, modify ppmbrighten, reorganize slightly
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3926 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test')
-rw-r--r--test/Test-Order1
-rw-r--r--test/all-in-place.ok4
-rwxr-xr-xtest/all-in-place.test6
-rw-r--r--test/legacy-names.ok4
-rwxr-xr-xtest/legacy-names.test8
-rw-r--r--test/pambrighten.ok96
-rwxr-xr-xtest/pambrighten.test99
-rw-r--r--test/ppmbrighten.ok10
-rwxr-xr-xtest/ppmbrighten.test30
9 files changed, 248 insertions, 10 deletions
diff --git a/test/Test-Order b/test/Test-Order
index f907c29b..7bc0d02f 100644
--- a/test/Test-Order
+++ b/test/Test-Order
@@ -83,6 +83,7 @@ pnmremap2.test
 pnmquant.test
 pnmquantall.test
 pnmtile.test
+pambrighten.test
 ppmbrighten.test
 ppmdither.test
 ppmrelief.test
diff --git a/test/all-in-place.ok b/test/all-in-place.ok
index 2df9f392..4d840102 100644
--- a/test/all-in-place.ok
+++ b/test/all-in-place.ok
@@ -238,11 +238,9 @@ pnmtosir: ok
 pnmtotiffcmyk: ok
 pnmtoxwd: ok
 ppm3d: ok
-ppmbrighten: ok
 ppmchange: ok
 ppmcie: ok
 ppmcolormask: ok
-ppmcolors: ok
 ppmdcfont: ok
 ppmddumpfont: ok
 ppmdim: ok
@@ -266,6 +264,7 @@ ppmrough: ok
 ppmshadow: ok
 ppmshift: ok
 ppmspread: ok
+ppmsvgalib: ok
 ppmtoacad: ok
 ppmtoapplevol: ok
 ppmtoarbtxt: ok
@@ -276,6 +275,7 @@ ppmtoicr: ok
 ppmtoilbm: ok
 ppmtoleaf: ok
 ppmtolj: ok
+ppmtompeg: ok
 ppmtomitsu: ok
 ppmtoneo: ok
 ppmtopcx: ok
diff --git a/test/all-in-place.test b/test/all-in-place.test
index 6cf677ef..78a9346a 100755
--- a/test/all-in-place.test
+++ b/test/all-in-place.test
@@ -280,11 +280,9 @@ ordinary_testprogs="\
   pnmtotiffcmyk \
   pnmtoxwd \
   ppm3d \
-  ppmbrighten \
   ppmchange \
   ppmcie \
   ppmcolormask \
-  ppmcolors \
   ppmdcfont \
   ppmddumpfont \
   ppmdim \
@@ -308,6 +306,7 @@ ordinary_testprogs="\
   ppmshadow \
   ppmshift \
   ppmspread \
+  ppmsvgalib \
   ppmtoacad \
   ppmtoapplevol \
   ppmtoarbtxt \
@@ -318,6 +317,7 @@ ordinary_testprogs="\
   ppmtoilbm \
   ppmtoleaf \
   ppmtolj \
+  ppmtompeg \
   ppmtomitsu \
   ppmtoneo \
   ppmtopcx \
@@ -431,3 +431,5 @@ testExitStatus anytopnm 0 $?
 
 manweb --help > /dev/null
     testExitStatus manweb 0 $?
+
+# We do not test vidtoppm.
\ No newline at end of file
diff --git a/test/legacy-names.ok b/test/legacy-names.ok
index 94ef875f..27baf672 100644
--- a/test/legacy-names.ok
+++ b/test/legacy-names.ok
@@ -26,14 +26,16 @@ pnmtofits: ok
 pnmtoplainpnm: ok
 pnmtopnm: ok
 pnmtotiff: ok
+ppmbrighten: ok
+ppmcolors: ok
 ppmnorm: ok
 ppmquant: ok
 ppmquantall: ok
 ppmtogif: ok
 ppmtojpeg: ok
 ppmtomap: ok
-ppmtompeg: ok
 ppmtotga: ok
 ppmtouil: ok
 hpcdtoppm: ok
 pcdovtoppm: ok
+pcdindex: ok
diff --git a/test/legacy-names.test b/test/legacy-names.test
index 5a65615f..e20dde76 100755
--- a/test/legacy-names.test
+++ b/test/legacy-names.test
@@ -83,13 +83,14 @@ ordinary_testprogs="\
   pnmtoplainpnm \
   pnmtopnm \
   pnmtotiff \
+  ppmbrighten \
+  ppmcolors \
   ppmnorm \
   ppmquant \
   ppmquantall \
   ppmtogif \
   ppmtojpeg \
   ppmtomap \
-  ppmtompeg \
   ppmtotga \
   ppmtouil \
 "
@@ -125,10 +126,13 @@ for i in $ordinary_testprogs
 
 
 
-# Test hpcdtoppm and pcdovtoppm.  Simply confirm their existence.
+# Test hpcdtoppm, pcdovtoppm and pcdindex.  Simply confirm their existence.
 
 type -p hpcdtoppm > /dev/null
 testExitStatus hpcdtoppm 0 $?
 
 type -p pcdovtoppm > /dev/null
 testExitStatus pcdovtoppm 0 $?
+
+type -p pcdindex > /dev/null
+testExitStatus pcdindex 0 $?
diff --git a/test/pambrighten.ok b/test/pambrighten.ok
new file mode 100644
index 00000000..6c58b4c9
--- /dev/null
+++ b/test/pambrighten.ok
@@ -0,0 +1,96 @@
+Test 1
+P3
+8 1
+255
+0 0 0 0 0 100 0 100 0 0 100 100 100 0 0 100 0 100 100 100 0 100 100 100 
+
+P3
+8 1
+255
+0 0 0 0 0 110 0 110 0 0 110 110 110 0 0 110 0 110 110 110 0 110 110 110 
+
+P3
+8 1
+255
+0 0 0 0 0 90 0 90 0 0 90 90 90 0 0 90 0 90 90 90 0 90 90 90 
+
+P3
+8 1
+255
+0 0 0 0 0 200 0 200 0 0 200 200 200 0 0 200 0 200 200 200 0 200 200 200 
+
+P3
+8 1
+255
+0 0 0 0 0 255 0 255 0 0 255 255 255 0 0 255 0 255 255 255 0 255 255 255 
+
+P3
+8 1
+255
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
+
+Test 2
+P3
+8 1
+255
+0 0 0 10 10 100 10 100 10 10 100 100 100 10 10 100 10 100 100 100 10 100 100 100 
+
+P3
+8 1
+255
+0 0 0 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 
+
+Test 3: Output invariant
+P3
+8 1
+255
+0 0 0 0 0 100 0 100 0 0 100 100 100 0 0 100 0 100 100 100 0 100 100 100 
+
+P3
+8 1
+255
+0 0 0 0 0 100 0 100 0 0 100 100 100 0 0 100 0 100 100 100 0 100 100 100 
+
+P3
+8 1
+255
+0 0 0 0 0 100 0 100 0 0 100 100 100 0 0 100 0 100 100 100 0 100 100 100 
+
+P3
+8 1
+255
+0 0 0 0 0 100 0 100 0 0 100 100 100 0 0 100 0 100 100 100 0 100 100 100 
+
+P3
+8 1
+255
+0 0 0 0 0 100 0 100 0 0 100 100 100 0 0 100 0 100 100 100 0 100 100 100 
+
+P3
+8 1
+255
+0 0 0 0 0 100 0 100 0 0 100 100 100 0 0 100 0 100 100 100 0 100 100 100 
+
+Test 4: Should print 3990234518 268 six times
+3990234518 268
+3990234518 268
+3990234518 268
+3990234518 268
+3990234518 268
+3990234518 268
+Test Error: Should print 1 six times
+1
+1
+1
+1
+1
+1
+Test Error: Should print 99 followed by 1, four times
+99
+1
+99
+1
+99
+1
+99
+1
diff --git a/test/pambrighten.test b/test/pambrighten.test
new file mode 100755
index 00000000..3e1a3eb1
--- /dev/null
+++ b/test/pambrighten.test
@@ -0,0 +1,99 @@
+#! /bin/bash
+# This script tests: pambrighten
+# Also requires: pgmramp
+
+tmpdir=${tmpdir:-/tmp}
+
+input_ppm=${tmpdir}/input.ppm
+
+cat > ${input_ppm} << EOF
+P3
+8 1
+255
+0 0 0 0 0 100 0 100 0 0 100 100 100 0 0 100 0 100 100 100 0 100 100 100 
+EOF
+
+# Test 1
+
+echo "Test 1"
+pambrighten -v   0 -plain ${input_ppm}
+pambrighten -v +10 -plain ${input_ppm}
+pambrighten -v -10 -plain ${input_ppm}
+pambrighten -v +100 -plain ${input_ppm}
+pambrighten -v +200 -plain ${input_ppm}
+pambrighten -v -100 -plain ${input_ppm}
+
+echo "Test 2"
+pambrighten -s -10 -plain ${input_ppm}
+pambrighten -s -100 -plain ${input_ppm}
+
+echo "Test 3: Output invariant"
+pambrighten         -plain ${input_ppm}
+pambrighten -v   0  -plain ${input_ppm}
+pambrighten -s   0  -plain ${input_ppm}
+pambrighten -s +10  -plain ${input_ppm}
+pambrighten -s +100 -plain ${input_ppm}
+pambrighten -s +200 -plain ${input_ppm}
+
+rm ${input_ppm}
+
+echo "Test 4: Should print 3990234518 268 six times"
+
+input_pgm=${tmpdir}/input.pgm
+
+pgmramp -lr 255 1 | tee ${input_pgm} | cksum
+pambrighten -s -100 ${input_pgm} | cksum
+pambrighten -s -10  ${input_pgm} | cksum
+pambrighten -s +10  ${input_pgm} | cksum
+pambrighten -s +100 ${input_pgm} | cksum
+pambrighten -s +200 ${input_pgm} | cksum
+
+rm ${input_pgm}
+
+
+# Test 2
+# These should all fail.
+
+echo "Invalid command-line argument combinations." 1>&2
+echo "Error messages should appear below the line." 1>&2
+echo "-----------------------------------------------------------" 1>&2
+
+echo "Test Error: Should print 1 six times"
+
+output_ppm=${tmpdir}/output.ppm
+
+pambrighten -v -120 testimg.ppm > ${output_ppm}
+echo $?
+test -s ${output_ppm}
+echo $?
+pambrighten -s -120 testimg.ppm > ${output_ppm}
+echo $?
+test -s ${output_ppm}
+echo $?
+pambrighten 10 testimg.ppm > ${output_ppm}
+echo $?
+test -s ${output_ppm}
+echo $?
+
+
+echo "Test Error: Should print 99 followed by 1, four times"
+
+pambrighten -s 1.20 testimg.ppm > ${output_ppm}
+echo $?
+test -s ${output_ppm}
+echo $?
+pambrighten -v 10.5 testimg.ppm > ${output_ppm}
+echo $?
+test -s ${output_ppm}
+echo $?
+pambrighten -v testimg.ppm > ${output_ppm}
+echo $?
+test -s ${output_ppm}
+echo $?
+pambrighten -s testimg.ppm > ${output_ppm}
+echo $?
+test -s ${output_ppm}
+echo $?
+
+
+rm -f ${output_ppm}
diff --git a/test/ppmbrighten.ok b/test/ppmbrighten.ok
index 376e71d3..3895dbd0 100644
--- a/test/ppmbrighten.ok
+++ b/test/ppmbrighten.ok
@@ -1,3 +1,11 @@
+Test 1: Should print 1969633344 101484
 1969633344 101484
-3688219243 101484
+Test 2: Should print 295150171 101484
 295150171 101484
+Test 3: Should print 1
+1
+Test Error: Should print 1 four times
+1
+1
+1
+1
diff --git a/test/ppmbrighten.test b/test/ppmbrighten.test
index 46c5cab5..40fe08f6 100755
--- a/test/ppmbrighten.test
+++ b/test/ppmbrighten.test
@@ -1,12 +1,38 @@
 #! /bin/bash
 # This script tests: ppmbrighten
-# Also requires:
+# Also requires: pnmnorm pambrighten pamsumm 
 
 # Failure message
 ## Ppmbrighten is sensitive to subtle differences in floating point math.
 ## If this test fails, please run the program and visually examine
 ## the output.
 
+echo "Test 1: Should print 1969633344 101484"
+
 ppmbrighten -v 100 testimg.ppm | cksum
-ppmbrighten -v 100 -normalize testimg.ppm | cksum
+
+echo "Test 2: Should print 295150171 101484"
+
 ppmbrighten -s 100 -v -50 testimg.ppm | cksum
+
+echo "Test 3: Should print 1"
+
+ppmbrighten -v 100 -normalize testimg.ppm | pamsumm --mean | \
+ awk '{print ($NF > 132.0) && ($NF < 132.2)}'
+
+echo "Invalid command-line argument combinations." 1>&2
+echo "Error messages should appear below the line." 1>&2
+echo "-----------------------------------------------------------" 1>&2
+
+echo "Test Error: Should print 1 four times"
+
+output_ppm=${tmpdir}/output.ppm
+
+pambrighten -v -120 testimg.ppm > ${output_ppm}
+echo $?
+test -s ${output_ppm}
+echo $?
+pambrighten -s -120 testimg.ppm > ${output_ppm}
+echo $?
+test -s ${output_ppm}
+echo $?