about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/targa-roundtrip.ok25
-rwxr-xr-xtest/targa-roundtrip.test58
2 files changed, 73 insertions, 10 deletions
diff --git a/test/targa-roundtrip.ok b/test/targa-roundtrip.ok
index 9a428195..a1e85373 100644
--- a/test/targa-roundtrip.ok
+++ b/test/targa-roundtrip.ok
@@ -1,3 +1,28 @@
+Test 1
 2425386270 41
+2425386270 41
+2425386270 41
+2425386270 41
+2425386270 41
+2425386270 41
+2425386270 41
+2425386270 41
+Test 2
+1571496937 33838
+1571496937 33838
 1571496937 33838
+1571496937 33838
+1571496937 33838
+1571496937 33838
+1571496937 33838
+1571496937 33838
+Test 3
+1926073387 101484
+1926073387 101484
+1926073387 101484
 1926073387 101484
+Test 4
+0
+0
+0
+0
diff --git a/test/targa-roundtrip.test b/test/targa-roundtrip.test
index f646b8c1..91acf109 100755
--- a/test/targa-roundtrip.test
+++ b/test/targa-roundtrip.test
@@ -1,18 +1,56 @@
 #! /bin/bash
 # This script tests: pamtotga tgatoppm
-# Also requires: ppmtopgm pgmtopbm pamchannel
+# Also requires: ppmtopgm pgmtopbm pamchannel pnmquant
 
+tmpdir=${tmpdir:-/tmp}
 
-#Test 1: Should print 2425386270 41, cksum of testgrid.pbm
+#Test 1: Should print 2425386270 41, cksum of testgrid.pbm, eight times
 
-pamtotga -mono testgrid.pbm | \
-  tgatoppm | ppmtopgm | \
-  pgmtopbm -threshold -val 0.5 | cksum
+echo "Test 1"
 
-#Test 2:  Should produce 1571496937 33838, cksum of testimg.red
-pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 | \
-  pamtotga -cmap | tgatoppm | ppmtopgm | cksum
+for mode in "-mono" "-mono -norle" "-cmap" "-cmap -norle" \
+            "-rgb"  "-rgb  -norle" "" "-norle"
+  do
+  pamtotga ${mode} testgrid.pbm | \
+    tgatoppm | ppmtopgm | \
+    pgmtopbm -threshold -val 0.5 | cksum
+  done
 
-#Test 3: Should print 1926073387 101484, cksum of testimg.ppm
+#Test 2:  Should produce 1571496937 33838, cksum of testimg.red, eight times
 
-pamtotga -rgb testimg.ppm | tgatoppm | cksum
+echo "Test 2"
+
+test_pam=${tmpdir}/testimg.pgm
+pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 > ${test_pam}
+
+for mode in "-mono" "-mono -norle" "-cmap" "-cmap -norle" \
+            "-rgb"  "-rgb  -norle" "" "-norle"
+  do
+  pamtotga ${mode} ${test_pam} | tgatoppm | ppmtopgm | cksum
+  done
+
+rm ${test_pam}
+
+
+#Test 3: Should print 1926073387 101484, cksum of testimg.ppm, four times
+
+echo "Test 3"
+
+for mode in "-rgb" "-rgb -norle" "" "-norle"
+  do
+  pamtotga ${mode} testimg.ppm | tgatoppm | cksum
+  done
+
+#Test 4: Should print 0 four times
+
+echo "Test 4"
+
+test256_ppm=${tmpdir}/test256.ppm
+pnmquant 256 testimg.ppm > ${test256_ppm}
+for mode in "-rgb" "-rgb -norle" "" "-norle"
+  do
+  pamtotga ${mode} ${test256_ppm} | tgatoppm | cmp -s - ${test256_ppm}
+  echo $?
+done
+
+rm ${test256_ppm}