From cacbcd0d7ad205cc5ab20203c7a4cc60f042d78f Mon Sep 17 00:00:00 2001 From: giraffedata Date: Tue, 6 Nov 2018 15:17:22 +0000 Subject: 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 --- test/palm-roundtrip.ok | 2 ++ test/palm-roundtrip.test | 6 +++++- test/targa-roundtrip.ok | 15 +++++++++++++++ test/targa-roundtrip.test | 40 ++++++++++++++++++++++++++++++++-------- 4 files changed, 54 insertions(+), 9 deletions(-) (limited to 'test') diff --git a/test/palm-roundtrip.ok b/test/palm-roundtrip.ok index 5bd3cb0a..56325809 100644 --- a/test/palm-roundtrip.ok +++ b/test/palm-roundtrip.ok @@ -1,8 +1,10 @@ +Test 1 584219238 236 584219238 236 584219238 236 584219238 236 584219238 236 +Test 2 0 0 0 diff --git a/test/palm-roundtrip.test b/test/palm-roundtrip.test index 9c053ba9..8af57b4a 100755 --- a/test/palm-roundtrip.test +++ b/test/palm-roundtrip.test @@ -8,6 +8,8 @@ test256color_ppm=${tmpdir}/test256color.ppm # Test 1. Should print 584219238 236 5 times +echo "Test 1" + pamdepth 15 testgrid.pbm | tee ${test4bit_pgm} | cksum for flags in "" \ @@ -21,7 +23,9 @@ rm ${test4bit_pgm} # Test 2. Should print 0 4 times -pnmquant 256 testimg.ppm > ${test256color_ppm} +echo "Test 2" + +pnmquant 256 testimg.ppm > ${test256color_ppm} || echo "pnmquant failed" for flags in "" \ "-scanline_compression" \ diff --git a/test/targa-roundtrip.ok b/test/targa-roundtrip.ok index a1e85373..bf6ef088 100644 --- a/test/targa-roundtrip.ok +++ b/test/targa-roundtrip.ok @@ -7,6 +7,8 @@ Test 1 2425386270 41 2425386270 41 2425386270 41 +2425386270 41 +2425386270 41 Test 2 1571496937 33838 1571496937 33838 @@ -16,6 +18,8 @@ Test 2 1571496937 33838 1571496937 33838 1571496937 33838 +1571496937 33838 +1571496937 33838 Test 3 1926073387 101484 1926073387 101484 @@ -26,3 +30,14 @@ Test 4 0 0 0 +0 +0 +Test 5 +0 +0 +0 +0 +0 +0 +0 +0 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} -- cgit 1.4.1