diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2021-10-10 16:11:43 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2021-10-10 16:11:43 +0000 |
commit | 059c2601ade1db66a667bd875c73b4b9f51112ec (patch) | |
tree | c0e1de76874fa83c90bd88f47ba867940b465acc /test/pgmtoppm.test | |
parent | 32205e919627a931b98986c661b4df2741e76754 (diff) | |
download | netpbm-mirror-059c2601ade1db66a667bd875c73b4b9f51112ec.tar.gz netpbm-mirror-059c2601ade1db66a667bd875c73b4b9f51112ec.tar.xz netpbm-mirror-059c2601ade1db66a667bd875c73b4b9f51112ec.zip |
Add gif-transparent1, pbm-ppm-roundtrip, improve pamflip-roundtrip, pgmtoppm
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4153 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test/pgmtoppm.test')
-rwxr-xr-x | test/pgmtoppm.test | 137 |
1 files changed, 127 insertions, 10 deletions
diff --git a/test/pgmtoppm.test b/test/pgmtoppm.test index 70df0d97..e9bd1a59 100755 --- a/test/pgmtoppm.test +++ b/test/pgmtoppm.test @@ -1,22 +1,139 @@ #! /bin/bash # This script tests: pgmtoppm -# Also requires: pamseq pamtopnm pgmramp - +# Also requires: pamtopnm pgmtoppm pnminvert pamseq pgmramp tmpdir=${tmpdir:-/tmp} +echo "Test 1. Should print 1767073524 779 twice, then 1676700883 779" + test_pgm=${tmpdir}/test.pgm -palette=${tmpdir}/palette +palette_pam=${tmpdir}/palette.pam +palette_ppm=${tmpdir}/palette.ppm -pgmramp -maxval=5 -lr 256 1 >${test_pgm} -pamseq 3 5 -tupletype=RGB | pamtopnm \ - >${palette} +pgmramp -maxval=5 -lr 256 1 > ${test_pgm} -# Test 1. pgmtoppm green ${test_pgm} | cksum - +pgmtoppm black-green ${test_pgm} | cksum pgmtoppm yellow-blue ${test_pgm} | cksum -pgmtoppm -map=${palette} ${test_pgm} | cksum -rm ${test_pgm} ${palette} +echo "Test 2. Should print 718580145 779 twice" +pamseq 3 5 -tupletype=RGB | tee ${palette_pam} | pamtopnm > ${palette_ppm} +pgmtoppm -map=${palette_pam} ${test_pgm} | cksum +pgmtoppm -map=${palette_ppm} ${test_pgm} | cksum + +rm ${palette_pam} + +echo "Test 3. Should print 718580145 779 twice" + +pgmtoppm white-black ${test_pgm} | pnminvert | cksum +pnminvert ${test_pgm} | pgmtoppm white-black | cksum + +rm ${test_pgm} + +echo "Test 4. Should print 829921912 685 seven times" + +pgmtoppm white testgrid.pbm | cksum +pgmtoppm black-white testgrid.pbm | cksum +pgmtoppm rgb:ff/ff/ff testgrid.pbm | cksum +pgmtoppm -white=rgb-255:255/255/255 testgrid.pbm | cksum +pgmtoppm rgb:00/00/00-rgb:ff/ff/ff testgrid.pbm | cksum +pgmtoppm rgbi:0/0/0-rgbi:1/1/1 testgrid.pbm | cksum +pgmtoppm -black=rgb-255:0/0/0 -white=rgb-255:255/255/255 testgrid.pbm | cksum + +echo "Test 5. Should print 934505096 685 four times" + +pgmtoppm white-black testgrid.pbm | cksum +pgmtoppm white testgrid.pbm | pnminvert| cksum +pnminvert testgrid.pbm | pgmtoppm black-white | cksum +pnminvert testgrid.pbm | pgmtoppm white | cksum + +echo "Test 6. Should print 3083028153 685 three times" + +pgmtoppm black testgrid.pbm | cksum +pgmtoppm black-black testgrid.pbm | cksum +pgmtoppm rgbi:0/0/0-rgbi:0/0/0 testgrid.pbm | cksum + +echo "Test 7 Invalid" + +tmpdir=${tmpdir:-/tmp} +test_out=${tmpdir}/test_out + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +pgmtoppm white testimg.ppm > \ + ${test_out} || \ + echo -n "Expected failure 1" + test -s ${test_out}; echo " "$? + rm -f {test_out} + +pgmtoppm -map=/dev/null testgrid.pbm > \ + ${test_out} || \ + echo -n "Expected failure 2" + test -s ${test_out}; echo " "$? + rm -f {test_out} + +pgmtoppm black white testgrid.pbm > \ + ${test_out} || \ + echo -n "Expected failure 3" + test -s ${test_out}; echo " "$? + rm -f {test_out} + +pgmtoppm hwite testgrid.pbm > \ + ${test_out} || \ + echo -n "Expected failure 4" + test -s ${test_out}; echo " "$? + rm -f {test_out} + +pgmtoppm off-color testgrid.pbm > \ + ${test_out} || \ + echo -n "Expected failure 5" + test -s ${test_out}; echo " "$? + rm -f {test_out} + +pgmtoppm rgb-255:7/7/7 testgrid.pbm > \ + ${test_out} || \ + echo -n "Expected failure 6" + test -s ${test_out}; echo " "$? + rm -f {test_out} + +pgmtoppm -black=black -white=white white testgrid.pbm > \ + ${test_out} || \ + echo -n "Expected failure 7" + test -s ${test_out}; echo " "$? + rm -f {test_out} + +pgmtoppm -black=rgb:0/0/0 -map=${palette_ppm} testgrid.pbm > \ + ${test_out} || \ + echo -n "Expected failure 8" + test -s ${test_out}; echo " "$? + rm -f {test_out} + +pgmtoppm -white=rgb:ff/ff/ff -map=${palette_ppm} testgrid.pbm > \ + ${test_out} || \ + echo -n "Expected failure 9" + test -s ${test_out}; echo " "$? + rm -f {test_out} + +pgmtoppm rgb:ff/ff/ff -map=${palette_ppm} testgrid.pbm > \ + ${test_out} || \ + echo -n "Expected failure 10" + test -s ${test_out}; echo " "$? + rm -f {test_out} + +pgmtoppm rgb:00/00/00-rgb:ff/ff/ff -map=${palette_ppm} testgrid.pbm > \ + ${test_out} || \ + echo -n "Expected failure 11" + test -s ${test_out}; echo " "$? + rm -f {test_out} + +#pgmtoppm rgb-255:7/7/7 testgrid.pbm > \ +# ${test_out} || \ +# echo -n "Expected failure 12" +# test -s ${test_out}; echo " "$? +# rm -f {test_out} + +rm -f ${palette_ppm} |