diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2023-06-28 17:29:32 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2023-06-28 17:29:32 +0000 |
commit | 23ce26f64c34e30951ad9ade2151552ed77e7357 (patch) | |
tree | d73b31a0c2f7c7be4a69f8a8e84e00dd39c432b5 /test/pamchannel.test | |
parent | 1b6e51a266008348ad93ed8b6ac9ec91b5024fea (diff) | |
download | netpbm-mirror-23ce26f64c34e30951ad9ade2151552ed77e7357.tar.gz netpbm-mirror-23ce26f64c34e30951ad9ade2151552ed77e7357.tar.xz netpbm-mirror-23ce26f64c34e30951ad9ade2151552ed77e7357.zip |
promote Advanced to Stable
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@4558 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test/pamchannel.test')
-rwxr-xr-x | test/pamchannel.test | 48 |
1 files changed, 37 insertions, 11 deletions
diff --git a/test/pamchannel.test b/test/pamchannel.test index 3529f4fe..f2662706 100755 --- a/test/pamchannel.test +++ b/test/pamchannel.test @@ -1,7 +1,6 @@ -#! /bin/bash +#! /bin/sh # This script tests: pamchannel -# Also requires: pamtopnm - +# Also requires: pamtopam pamtopnm # Extract planes one by one. # Convert output to pgm to make it identical to ppmtorgb3 output. @@ -13,20 +12,47 @@ # 3164158573 33838 testimg.blu -# Test 1. red channel -# Should produce 1571496937 33838 - +echo "Test 1:red-channel Should produce 1571496937 33838" pamchannel -infile testimg.ppm 0 | \ pamtopnm --assume | cksum -# Test 2. green channel -# Should produce 394856971 33838 - +echo "Test 2:green-channel Should produce 394856971 33838" pamchannel -infile testimg.ppm -tupletype="GRAYSCALE" 1 | \ pamtopnm | cksum -# Test 3. blue channel -# Should produce 3164158573 33838 +echo "Test 3:blue-channel Should produce 3164158573 33838" pamchannel -infile testimg.ppm 2 | \ pamtopnm --assume | cksum + +echo "Test 4:single-channel Should produce 281226646 481" +pamchannel -infile maze.pbm 0 | \ + pamtopnm --assume | cksum + +# Test invalid: specified channel does not exist + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +tmpdir=${tmpdir:-/tmp} +test_out=${tmpdir}/test_out + +echo "Test Invalid" + +pamchannel -infile testgrid.pbm 1 > ${test_out} || \ + printf "Expected failure 1" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pamchannel -infile testimg.ppm 3 > ${test_out} || \ + printf "Expected failure 2" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + +pamtopam testimg.ppm | pamchannel -infile=- 4 > ${test_out} || \ + printf "Expected failure 3" + test -s ${test_out}; echo " "$? + rm -f ${test_out} + |