about summary refs log tree commit diff
path: root/test/targa-roundtrip.test
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2018-11-06 15:17:22 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2018-11-06 15:17:22 +0000
commitcacbcd0d7ad205cc5ab20203c7a4cc60f042d78f (patch)
treefee086aa0ce2224be1c287659102731925fa846c /test/targa-roundtrip.test
parent36566b8726a953be020d4e843a12d15402fed875 (diff)
downloadnetpbm-mirror-cacbcd0d7ad205cc5ab20203c7a4cc60f042d78f.tar.gz
netpbm-mirror-cacbcd0d7ad205cc5ab20203c7a4cc60f042d78f.tar.xz
netpbm-mirror-cacbcd0d7ad205cc5ab20203c7a4cc60f042d78f.zip
Add test for pamtotga -cmap16, improve palm roundtrip test
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3419 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test/targa-roundtrip.test')
-rwxr-xr-xtest/targa-roundtrip.test40
1 files changed, 32 insertions, 8 deletions
diff --git a/test/targa-roundtrip.test b/test/targa-roundtrip.test
index 91acf109..98d21881 100755
--- a/test/targa-roundtrip.test
+++ b/test/targa-roundtrip.test
@@ -1,14 +1,15 @@
 #! /bin/bash
 # This script tests: pamtotga tgatoppm
-# Also requires: ppmtopgm pgmtopbm pamchannel pnmquant
+# Also requires: ppmtopgm pgmtopbm pamchannel pnmquant pamdepth
 
 tmpdir=${tmpdir:-/tmp}
 
-#Test 1: Should print 2425386270 41, cksum of testgrid.pbm, eight times
+#Test 1: Should print 2425386270 41, cksum of testgrid.pbm, ten times
 
 echo "Test 1"
 
-for mode in "-mono" "-mono -norle" "-cmap" "-cmap -norle" \
+for mode in "-mono" "-mono -norle" \
+            "-cmap" "-cmap -norle" "-cmap16" "-cmap16 -norle" \
             "-rgb"  "-rgb  -norle" "" "-norle"
   do
   pamtotga ${mode} testgrid.pbm | \
@@ -16,14 +17,15 @@ for mode in "-mono" "-mono -norle" "-cmap" "-cmap -norle" \
     pgmtopbm -threshold -val 0.5 | cksum
   done
 
-#Test 2:  Should produce 1571496937 33838, cksum of testimg.red, eight times
+#Test 2:  Should produce 1571496937 33838, cksum of testimg.red, ten times
 
 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" \
+for mode in "-mono" "-mono -norle" \
+            "-cmap" "-cmap -norle" "-cmap16" "-cmap16 -norle" \
             "-rgb"  "-rgb  -norle" "" "-norle"
   do
   pamtotga ${mode} ${test_pam} | tgatoppm | ppmtopgm | cksum
@@ -41,16 +43,38 @@ for mode in "-rgb" "-rgb -norle" "" "-norle"
   pamtotga ${mode} testimg.ppm | tgatoppm | cksum
   done
 
-#Test 4: Should print 0 four times
+#Test 4: Should print 0 six times
 
 echo "Test 4"
 
 test256_ppm=${tmpdir}/test256.ppm
-pnmquant 256 testimg.ppm > ${test256_ppm}
-for mode in "-rgb" "-rgb -norle" "" "-norle"
+pnmquant 256 testimg.ppm > ${test256_ppm} || echo "pnmquant failed"
+# test image may have less than 256 colors
+
+for mode in "-rgb" "-rgb -norle" "-cmap" "-cmap -norle" "" "-norle"
   do
   pamtotga ${mode} ${test256_ppm} | tgatoppm | cmp -s - ${test256_ppm}
   echo $?
 done
 
+
+#Test 5: Should print 0 eight times
+
+echo "Test 5"
+
+test256_31_ppm=${tmpdir}/test256-31.ppm
+pamdepth 31 ${test256_ppm} > ${test256_31_ppm} || echo "pamdepth failed"
 rm ${test256_ppm}
+
+for mode in "-cmap16" "-cmap16 -norle"
+  do pamtotga ${mode} ${test256_31_ppm} | tgatoppm | cmp -s - ${test256_31_ppm}
+  echo $?
+  done
+
+for mode in  "-rgb" "-rgb -norle" "-cmap" "-cmap -norle" "" "-norle"
+  do pamtotga ${mode} ${test256_31_ppm} | tgatoppm | \
+     pamdepth 31 | cmp -s - ${test256_31_ppm}
+  echo $?
+  done
+
+rm ${test256_31_ppm}