From 87769289405a9aed9d4e93b903489b64d77ac411 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sat, 3 Nov 2018 17:22:38 +0000 Subject: Add targa tests git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3414 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- test/targa-roundtrip.ok | 25 ++++++++++++++++++++ test/targa-roundtrip.test | 58 +++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 73 insertions(+), 10 deletions(-) (limited to 'test') 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} -- cgit 1.4.1