diff options
-rwxr-xr-x | test/Execute-Tests | 95 | ||||
-rw-r--r-- | test/Test-Order | 1 | ||||
-rw-r--r-- | test/pamcut.ok | 4 | ||||
-rwxr-xr-x | test/pamcut.test | 56 | ||||
-rwxr-xr-x | test/pnmpad-color.test | 206 | ||||
-rwxr-xr-x | test/pnmpad-format.test | 128 | ||||
-rwxr-xr-x | test/ppmchange.test | 21 |
7 files changed, 254 insertions, 257 deletions
diff --git a/test/Execute-Tests b/test/Execute-Tests index c86121dc..e3b691d9 100755 --- a/test/Execute-Tests +++ b/test/Execute-Tests @@ -53,32 +53,30 @@ esac export srcdir=$(dirname $0) # Set tmpdir, which is used in some of the test scripts. By default -# this is created by mktemp. The user can override and specify tmpdir, -# but in this case it must be an existing directory and must not be -# either $srcdir or current work. +# this is created by mktemp. To override edit the following lines. + +# When tmpdir is specified it must be an existing directory and must +# not be either $srcdir or current work. tmpdir should not contain +# whitespace, non-printable characters, etc. + +tmpdir_created=$(mktemp -d "${TMPDIR:-/tmp}/netpbm.XXXXXXXX") || exit 1; +export tmpdir=${tmpdir_created} -if [ -z $tmpdir ] - then - tmpdir_created=$(mktemp -d "${TMPDIR:-/tmp}/netpbm.XXXXXXXX") || exit 1; - export tmpdir=${tmpdir_created} - else - tmpdir_created=""; - if [ ! -d ${tmpdir} ] - then echo "Specified temporary directory $tmpdir does not exist." - exit 1; - elif [ ${tmpdir} -ef ${srcdir} ] - then echo "Temporary directory must not be $srcdir." - exit 1; - elif [ ${tmpdir} -ef $PWD ] - then echo "Temporary directory must not be current directory." - exit 1; - fi -fi -# If necessary set the RGBDEF environment variable. -#export RGBDEF=/etc/rgb.txt -#export RGBDEF=/usr/local/netpbm/lib/rgb.txt -#export RGBDEF=/usr/share/emacs/*/etc/rgb.txt +# tmpdir_created="" +# export tmpdir=/tmp/netpbm-test-tempdir + +# if [ ! -d "${tmpdir}" ] +# then echo "Specified temporary directory $tmpdir does not exist." +# exit 1; +# elif [ "${tmpdir}" -ef "${srcdir}" ] +# then echo "Temporary directory must not be $srcdir." +# exit 1; +# elif [ "${tmpdir}" -ef "$PWD" ] +# then echo "Temporary directory must not be current directory." +# exit 1; +# fi +#fi # Declare arrays used to count and report test results. @@ -100,17 +98,29 @@ status[4]="NOT TESTABLE" # Copy test image files to the current work directory if [ ! -f ./testgrid.pbm ] - then cp -v ${srcdir}/testgrid.pbm ./testgrid.pbm + then cp -v "${srcdir}"/testgrid.pbm ./testgrid.pbm fi if [ ! -f ./maze.pbm ] - then cp -v ${srcdir}/maze.pbm ./maze.pbm + then cp -v "${srcdir}"/maze.pbm ./maze.pbm fi if [ ! -f ./testimg.ppm ] - then cp -v ${srcdir}/testimg.ppm ./testimg.ppm + then cp -v "${srcdir}"/testimg.ppm ./testimg.ppm +fi + +if [ ! -f ./rgbt.txt ] + then cp -v "${srcdir}"/rgbt.txt ./rgbt.txt + # Color name dictionary file rgbt.txt is a short digest. + # If desired use the proper file: + # cp -v /etc/rgb.txt ./rgbt.txt + # cp -v $RGBDEF ./rgbt.txt fi +if [ ! -f ./test-invalid.inc ] + then cp -v "${srcdir}"/test-invalid.inc ./test-invalid.inc +fi + # The block-bin directory # # This directory contains dummy executables with the names of the @@ -130,14 +140,14 @@ if [ ! -z $PBM_TEST_PATH ] then rm -rf $blockbin fi mkdir $blockbin - cp ${srcdir}/BLOCK $blockbin/BLOCK + cp "${srcdir}"/BLOCK $blockbin/BLOCK chmod +x $blockbin/BLOCK # Populate the block-bin directory using all-in-place.ok and # legacy-names.ok which together make a complete list of programs. sed 's/: ok$//' \ - ${srcdir}/all-in-place.ok ${srcdir}/legacy-names.ok | \ + "${srcdir}"/all-in-place.ok "${srcdir}"/legacy-names.ok | \ tr ' ' '\n' | while read prog do ln -s $blockbin/BLOCK $blockbin/$prog @@ -216,17 +226,17 @@ if [ ! -z $target ] echo $target | sed 's/,/\n/g' | \ sed -e 's/^/# This script tests: .*\\</' -e 's/$/\\>/' \ -e '/^$/q' | \ - grep -f - ${srcdir}/*.test -l | \ + grep -f - "${srcdir}"/*.test -l | \ while read i ; do echo ${i##*/} ; done | \ - grep -f - ${srcdir}/Test-Order > ./Test-Order ; + grep -f - "${srcdir}"/Test-Order > ./Test-Order ; if [ ! -s ./Test-Order ] then echo; echo "Error: No testable program names in target: "$target; echo; exit 1 fi else - cp ${srcdir}/Test-Order ./Test-Order ; - #cp --no-clobber ${srcdir}/Test-Order ./Test-Order ; + cp "${srcdir}"/Test-Order ./Test-Order ; + #cp --no-clobber "${srcdir}"/Test-Order ./Test-Order ; fi echo @@ -250,25 +260,25 @@ fi # either of these conditions are not met, do not execute the test and # report "Not Testable". -if [ ! -s ${srcdir}/${tname%.test}.ok ] +if [ ! -s "${srcdir}"/${tname%.test}.ok ] then echo "${tname%.test}.ok does not exist" let result=4; else - ${srcdir}/Available-Testprog \ + "${srcdir}"/Available-Testprog \ `sed -n -e '/^# This script tests: /s/# This script tests: //p' \ -e '/^# Also requires: /s/^# Also requires: //p' \ - -e '/^$/q' ${srcdir}/$tname | tr '\n' ' '` + -e '/^$/q' "${srcdir}"/$tname | tr '\n' ' '` case $? in 0) - PATH=${testpath} $vg_command ${srcdir}/$tname > ${tname%.test}.out; + PATH=${testpath} $vg_command "${srcdir}"/$tname > ${tname%.test}.out; let retval=$? case $retval in - 0) cmp -s ${tname%.test}.out ${srcdir}/${tname%.test}.ok ; + 0) cmp -s ${tname%.test}.out "${srcdir}"/${tname%.test}.ok ; if [ $? -eq 0 ] then let result=0; rm ${tname%.test}.out ; else let result=1; - grep "^##" ${srcdir}/$tname # Print failure message. + grep "^##" "${srcdir}"/$tname # Print failure message. fi ;; 80) let result=4 ;; *) let result=1 ;; @@ -290,7 +300,7 @@ done # Erase temporary bin directory and its contents. -rm -rf ${srcdir}/bin +rm -rf "${srcdir}"/bin # Erase temporary directory and its contents, if it was created. @@ -303,8 +313,9 @@ fi # Erase test image files in the current (work) directory. # (Do not erase them if we are working from the source directory.) -if [ ! $PWD -ef ${srcdir} ] - then rm ./testimg.ppm ./testgrid.pbm ./maze.pbm +if [ ! $PWD -ef "${srcdir}" ] + then rm ./testimg.ppm ./testgrid.pbm ./maze.pbm \ + ./rgbt.txt ./test-invalid.inc fi diff --git a/test/Test-Order b/test/Test-Order index 6c21c759..3b3fc4af 100644 --- a/test/Test-Order +++ b/test/Test-Order @@ -178,6 +178,7 @@ ppmtoapplevol.test ppmtomitsu.test 411toppm.test eyuvtoppm.test +infotopam.test rawtoppm.test gif-transparent1.test diff --git a/test/pamcut.ok b/test/pamcut.ok index 18ed88e8..cc1563b7 100644 --- a/test/pamcut.ok +++ b/test/pamcut.ok @@ -100,7 +100,3 @@ Expected failure 10 (no output) Expected failure 11 (no output) Expected failure 12 (no output) Expected failure 13 (no output) -Expected failure 14 (no output) -Expected failure 15 (no output) -Expected failure 16 (no output) -Expected failure 17 (no output) diff --git a/test/pamcut.test b/test/pamcut.test index 7d60e1cd..74fe0091 100755 --- a/test/pamcut.test +++ b/test/pamcut.test @@ -66,7 +66,7 @@ pamcut -croptop 0 -cropleft 0 -cropbottom 0 -cropright 0 \ -reportonly maze.pbm pamcut -top 0 -left 0 \ -bottom $((${height} -1)) -right $((${width} -1)) \ - -reportonly maze.pbm + -reportonly maze.pbm pamcut -top 0 -left 0 -bottom -1 -right -1 -reportonly maze.pbm pamcut -top 0 -left 0 -width ${width} -height ${height} \ -reportonly maze.pbm @@ -75,10 +75,10 @@ pamcut -reportonly maze.pbm echo "Test 5b. Should print 281226646 481 twice" pamcut -croptop 0 -cropleft 0 -cropbottom 0 -cropright 0 maze.pbm | \ - cksum + cksum pamcut maze.pbm | cksum -test50_pbm=${tmpdir}/test50.pbm +test50_pbm="${tmpdir}"/test50.pbm echo "Test 6a. Should print 5 34 5 34 50 50 30 30" @@ -92,7 +92,7 @@ rm ${test50_pbm} echo "Test 7. Should print 284857390 12 sixteen times" -test1_pbm=${tmpdir}/test1.pbm +test1_pbm="${tmpdir}"/test1.pbm pbmmake -b 1 1 > ${test1_pbm} @@ -121,12 +121,12 @@ pamcut -pad -cropright=17 -width=5 -height=5 ${test1_pbm} | cksum echo "Test 8. Should print 3125257619 29 four times" -test3_pbm=${tmpdir}/test3.pbm +test3_pbm="${tmpdir}"/test3.pbm pbmmake -g 3 3 > ${test3_pbm} -pamcut -pad -cropleft=10 -croptop=10 -width=10 -height=10 ${test3_pbm} | cksum -pamcut -pad -cropright=10 -croptop=10 -width=10 -height=10 ${test3_pbm} |\ +pamcut -pad -cropleft=10 -croptop=10 -width=10 -height=10 ${test3_pbm} | cksum +pamcut -pad -cropright=10 -croptop=10 -width=10 -height=10 ${test3_pbm} |\ pamflip -lr | cksum pamcut -pad -cropleft=10 -cropbottom=10 -width=10 -height=10 ${test3_pbm} |\ pamflip -tb | cksum @@ -137,7 +137,7 @@ rm ${test3_pbm} echo "Test 9. Should print 3338453023 36 sixteen times" -testb_pgm=${tmpdir}/testb.pgm +testb_pgm="${tmpdir}"/testb.pgm pgmmake 0.0 1 1 > ${testb_pgm} @@ -167,7 +167,7 @@ rm ${testb_pgm} echo "Test 10. Should print 3957742883 302 four times" -testg_pgm=${tmpdir}/testg.pgm +testg_pgm="${tmpdir}"/testg.pgm pgmmake 0.5 2 2 > ${testg_pgm} @@ -185,7 +185,7 @@ rm ${testg_pgm} echo "Test 11. Should print 1576602925 8 four times" -test5_pbm=${tmpdir}/test5.pbm +test5_pbm="${tmpdir}"/test5.pbm pbmmake -g 5 5 > ${test5_pbm} @@ -198,29 +198,29 @@ rm ${test1_pbm} ${test5_pbm} echo "Test Invalid" -. ${srcdir}/test-invalid.inc +. ./test-invalid.inc # overspecification -invCmd "pamcut -left=1 -right=1 -width=14 testgrid.pbm" -invCmd "pamcut -top=1 -bottom=1 -height=16 testgrid.pbm" -invCmd "pamcut -right=1 -cropright=1 testgrid.pbm" -invCmd "pamcut -top=1 -croptop=1 testgrid.pbm" -invCmd "pamcut -bottom=1 -cropbottom=1 testgrid.pbm" -invCmd "pamcut -left=1 -cropleft=1 testgrid.pbm" +invCmd 'pamcut -left=1 -right=1 -width=14 testgrid.pbm" +invCmd 'pamcut -top=1 -bottom=1 -height=16 testgrid.pbm" +invCmd 'pamcut -right=1 -cropright=1 testgrid.pbm" +invCmd 'pamcut -top=1 -croptop=1 testgrid.pbm" +invCmd 'pamcut -bottom=1 -cropbottom=1 testgrid.pbm" +invCmd 'pamcut -left=1 -cropleft=1 testgrid.pbm" # excessive amounts -invCmd "pamcut -cropleft=14 testgrid.pbm" -invCmd "pamcut -cropleft=7 -cropright=8 testgrid.pbm" -invCmd "pamcut -left=7 -right=6 testgrid.pbm" -invCmd "pamcut -croptop=16 testgrid.pbm" -invCmd "pamcut -croptop=8 -cropbottom=8 testgrid.pbm" -invCmd "pamcut -top=10 -bottom=9 testgrid.pbm" +invCmd 'pamcut -cropleft=14 testgrid.pbm' +invCmd 'pamcut -cropleft=7 -cropright=8 testgrid.pbm' +invCmd 'pamcut -left=7 -right=6 testgrid.pbm' +invCmd 'pamcut -croptop=16 testgrid.pbm' +invCmd 'pamcut -croptop=8 -cropbottom=8 testgrid.pbm' +invCmd 'pamcut -top=10 -bottom=9 testgrid.pbm' # pad absent -invCmd "pamcut -cropleft=1 -width=14 testgrid.pbm" -invCmd "pamcut -croptop=1 -height=16 testgrid.pbm" +invCmd 'pamcut -cropleft=1 -width=14 testgrid.pbm' +invCmd 'pamcut -croptop=1 -height=16 testgrid.pbm' # legacy style: insufficient number of positional parameters -invCmd "pamcut 5 testimg.ppm" -invCmd "pamcut 5 4 testimg.ppm" -invCmd "pamcut 5 5 30 testimg.ppm" +invCmd 'pamcut 5 testimg.ppm' +invCmd 'pamcut 5 4 testimg.ppm' +invCmd 'pamcut 5 5 30 testimg.ppm' diff --git a/test/pnmpad-color.test b/test/pnmpad-color.test index 05e8acca..7ef03e07 100755 --- a/test/pnmpad-color.test +++ b/test/pnmpad-color.test @@ -4,33 +4,31 @@ tmpdir=${tmpdir:-/tmp} -white_pbm=${tmpdir}/white.pbm -black_pbm=${tmpdir}/black.pbm -test127_pgm=${tmpdir}/testimg1.pgm -test255_pgm=${tmpdir}/testimg2.pgm -test511_pgm=${tmpdir}/testimg3.pgm -test127_ppm=${tmpdir}/testimg1.ppm -test255_ppm=${tmpdir}/testimg2.ppm -test511_ppm=${tmpdir}/testimg3.ppm -target_pnm=${tmpdir}/target.pnm - -BLACK="rgbi:0.0/0.0/0.0" -WHITE="rgbi:1.0/1.0/1.0" +white_pbm="${tmpdir}"/white.pbm +black_pbm="${tmpdir}"/black.pbm +test127_pgm="${tmpdir}"/testimg1.pgm +test255_pgm="${tmpdir}"/testimg2.pgm +test511_pgm="${tmpdir}"/testimg3.pgm +test127_ppm="${tmpdir}"/testimg1.ppm +test255_ppm="${tmpdir}"/testimg2.ppm +test511_ppm="${tmpdir}"/testimg3.ppm +target_pnm="${tmpdir}"/target.pnm + +RGBDEF=./rgbt.txt + LIGHTGRAY="rgbi:0.6/0.6/0.6" LIGHTGRAYv=0.6 DARKGRAY="rgbi:0.01/0.01/0.01" DARKGRAYv=0.01 -PURPLE="rgb:A0/20/F0" -YELLOW="rgb:F0/F0/00" pbmmake -w 1 1 > ${white_pbm} pbmmake -b 1 1 > ${black_pbm} pgmmake 0.25 1 1 -maxval 127 > ${test127_pgm} pgmmake 0.25 1 1 -maxval 255 > ${test255_pgm} pgmmake 0.25 1 1 -maxval 511 > ${test511_pgm} -ppmmake ${YELLOW} 1 1 -maxval 127 > ${test127_ppm} -ppmmake ${YELLOW} 1 1 -maxval 255 > ${test255_ppm} -ppmmake ${YELLOW} 1 1 -maxval 511 > ${test511_ppm} +ppmmake yellow 1 1 -maxval 127 > ${test127_ppm} +ppmmake yellow 1 1 -maxval 255 > ${test255_ppm} +ppmmake yellow 1 1 -maxval 511 > ${test511_ppm} ptop="-top 1" @@ -48,9 +46,9 @@ pbmmake -w 1 1 > ${target_pnm} pnmpad ${ptop} -white ${infile} | cmptarget pnmpad ${ptop} -extend-edge ${infile} | cmptarget pnmpad ${ptop} -detect-background ${infile} | cmptarget -pnmpad ${ptop} -color ${WHITE} ${infile} | cmptarget -pnmpad ${ptop} -color ${WHITE} -promote none ${infile} | cmptarget -pnmpad ${ptop} -color ${WHITE} -promote format ${infile} | cmptarget +pnmpad ${ptop} -color white ${infile} | cmptarget +pnmpad ${ptop} -color white -promote none ${infile} | cmptarget +pnmpad ${ptop} -color white -promote format ${infile} | cmptarget pnmpad ${ptop} -color ${LIGHTGRAY} -promote none ${infile} | cmptarget echo "Should print match seven times" @@ -58,11 +56,11 @@ echo "Should print match seven times" pbmmake -b 1 1 > ${target_pnm} pnmpad ${ptop} ${infile} | cmptarget pnmpad ${ptop} -black ${infile} | cmptarget -pnmpad ${ptop} -color ${BLACK} ${infile} | cmptarget -pnmpad ${ptop} -color ${BLACK} -promote none ${infile} | cmptarget -pnmpad ${ptop} -color ${BLACK} -promote format ${infile} | cmptarget +pnmpad ${ptop} -color black ${infile} | cmptarget +pnmpad ${ptop} -color black -promote none ${infile} | cmptarget +pnmpad ${ptop} -color black -promote format ${infile} | cmptarget pnmpad ${ptop} -color ${DARKGRAY} -promote none ${infile} | cmptarget -pnmpad ${ptop} -color ${PURPLE} -promote none ${infile} | cmptarget +pnmpad ${ptop} -color purple -promote none ${infile} | cmptarget echo "Should print match once" @@ -88,14 +86,14 @@ pnmpad ${ptop} -color ${DARKGRAY} -promote all ${infile} | cmptarget echo "Should print match once" -ppmmake -maxval 1 ${PURPLE} 1 1 > ${target_pnm} -pnmpad ${ptop} -color ${PURPLE} -promote format ${infile} | cmptarget +ppmmake -maxval 1 purple 1 1 > ${target_pnm} +pnmpad ${ptop} -color purple -promote format ${infile} | cmptarget echo "Should print match twice" -ppmmake -maxval 255 ${PURPLE} 1 1 > ${target_pnm} -pnmpad ${ptop} -color ${PURPLE} ${infile} | cmptarget -pnmpad ${ptop} -color ${PURPLE} -promote all ${infile} | cmptarget +ppmmake -maxval 255 purple 1 1 > ${target_pnm} +pnmpad ${ptop} -color purple ${infile} | cmptarget +pnmpad ${ptop} -color purple -promote all ${infile} | cmptarget echo echo "Test 2. PBM black infile" @@ -107,11 +105,11 @@ echo "Should print match nine times" pbmmake -b 1 1 > ${target_pnm} pnmpad ${ptop} ${infile} | cmptarget pnmpad ${ptop} -black ${infile} | cmptarget -pnmpad ${ptop} -color ${BLACK} ${infile} | cmptarget -pnmpad ${ptop} -color ${BLACK} -promote none ${infile} | cmptarget -pnmpad ${ptop} -color ${BLACK} -promote format ${infile} | cmptarget +pnmpad ${ptop} -color black ${infile} | cmptarget +pnmpad ${ptop} -color black -promote none ${infile} | cmptarget +pnmpad ${ptop} -color black -promote format ${infile} | cmptarget pnmpad ${ptop} -color ${DARKGRAY} -promote none ${infile} | cmptarget -pnmpad ${ptop} -color ${PURPLE} -promote none ${infile} | cmptarget +pnmpad ${ptop} -color purple -promote none ${infile} | cmptarget pnmpad ${ptop} -extend-edge ${infile} | cmptarget pnmpad ${ptop} -detect-background ${infile} | cmptarget @@ -119,9 +117,9 @@ echo "Should print match five times" pbmmake -w 1 1 > ${target_pnm} pnmpad ${ptop} -white ${infile} | cmptarget -pnmpad ${ptop} -color ${WHITE} ${infile} | cmptarget -pnmpad ${ptop} -color ${WHITE} -promote none ${infile} | cmptarget -pnmpad ${ptop} -color ${WHITE} -promote format ${infile} | cmptarget +pnmpad ${ptop} -color white ${infile} | cmptarget +pnmpad ${ptop} -color white -promote none ${infile} | cmptarget +pnmpad ${ptop} -color white -promote format ${infile} | cmptarget pnmpad ${ptop} -color ${LIGHTGRAY} -promote none ${infile} | cmptarget echo @@ -134,17 +132,17 @@ echo "Should print match five times" pgmmake -maxval 127 0.0 1 1 > ${target_pnm} pnmpad ${ptop} ${infile} | cmptarget pnmpad ${ptop} -black ${infile} | cmptarget -pnmpad ${ptop} -color ${BLACK} ${infile} | cmptarget -pnmpad ${ptop} -color ${BLACK} -promote none ${infile} | cmptarget -pnmpad ${ptop} -color ${BLACK} -promote format ${infile} | cmptarget +pnmpad ${ptop} -color black ${infile} | cmptarget +pnmpad ${ptop} -color black -promote none ${infile} | cmptarget +pnmpad ${ptop} -color black -promote format ${infile} | cmptarget echo "Should print match four times" pgmmake -maxval 127 1.0 1 1 > ${target_pnm} pnmpad ${ptop} -white ${infile} | cmptarget -pnmpad ${ptop} -color ${WHITE} ${infile} | cmptarget -pnmpad ${ptop} -color ${WHITE} -promote none ${infile} | cmptarget -pnmpad ${ptop} -color ${WHITE} -promote format ${infile} | cmptarget +pnmpad ${ptop} -color white ${infile} | cmptarget +pnmpad ${ptop} -color white -promote none ${infile} | cmptarget +pnmpad ${ptop} -color white -promote format ${infile} | cmptarget echo "Should print match twice" @@ -166,8 +164,8 @@ pnmpad ${ptop} -color ${DARKGRAY} -promote format ${infile} | cmptarget echo "Should print match once" -ppmmake -maxval 127 ${PURPLE} 1 1 | ppmtopgm > ${target_pnm} -pnmpad ${ptop} -color ${PURPLE} -promote none ${infile} | cmptarget +ppmmake -maxval 127 purple 1 1 | ppmtopgm > ${target_pnm} +pnmpad ${ptop} -color purple -promote none ${infile} | cmptarget echo "Should print match twice" @@ -183,14 +181,14 @@ pnmpad ${ptop} -color ${DARKGRAY} -promote all ${infile} | cmptarget echo "Should print match once" -ppmmake -maxval 127 ${PURPLE} 1 1 > ${target_pnm} -pnmpad ${ptop} -color ${PURPLE} -promote format ${infile} | cmptarget +ppmmake -maxval 127 purple 1 1 > ${target_pnm} +pnmpad ${ptop} -color purple -promote format ${infile} | cmptarget echo "Should print match twice" -ppmmake -maxval 255 ${PURPLE} 1 1 > ${target_pnm} -pnmpad ${ptop} -color ${PURPLE} ${infile} | cmptarget -pnmpad ${ptop} -color ${PURPLE} -promote all ${infile} | cmptarget +ppmmake -maxval 255 purple 1 1 > ${target_pnm} +pnmpad ${ptop} -color purple ${infile} | cmptarget +pnmpad ${ptop} -color purple -promote all ${infile} | cmptarget echo @@ -203,17 +201,17 @@ echo "Should print match five times" pgmmake -maxval 255 0.0 1 1 > ${target_pnm} pnmpad ${ptop} ${infile} | cmptarget pnmpad ${ptop} -black ${infile} | cmptarget -pnmpad ${ptop} -color ${BLACK} ${infile} | cmptarget -pnmpad ${ptop} -color ${BLACK} -promote none ${infile} | cmptarget -pnmpad ${ptop} -color ${BLACK} -promote format ${infile} | cmptarget +pnmpad ${ptop} -color black ${infile} | cmptarget +pnmpad ${ptop} -color black -promote none ${infile} | cmptarget +pnmpad ${ptop} -color black -promote format ${infile} | cmptarget echo "Should print match four times" pgmmake -maxval 255 1.0 1 1 > ${target_pnm} pnmpad ${ptop} -white ${infile} | cmptarget -pnmpad ${ptop} -color ${WHITE} ${infile} | cmptarget -pnmpad ${ptop} -color ${WHITE} -promote none ${infile} | cmptarget -pnmpad ${ptop} -color ${WHITE} -promote format ${infile} | cmptarget +pnmpad ${ptop} -color white ${infile} | cmptarget +pnmpad ${ptop} -color white -promote none ${infile} | cmptarget +pnmpad ${ptop} -color white -promote format ${infile} | cmptarget echo "Should print match twice" @@ -235,8 +233,8 @@ pnmpad ${ptop} -color ${DARKGRAY} -promote format ${infile} | cmptarget echo "Should print match once" -ppmmake -maxval 255 ${PURPLE} 1 1 | ppmtopgm > ${target_pnm} -pnmpad ${ptop} -color ${PURPLE} -promote none ${infile} | cmptarget +ppmmake -maxval 255 purple 1 1 | ppmtopgm > ${target_pnm} +pnmpad ${ptop} -color purple -promote none ${infile} | cmptarget echo "Should print match four times" @@ -256,10 +254,10 @@ pnmpad ${ptop} -color ${DARKGRAY} -promote all ${infile} | cmptarget echo "Should print match three times" -ppmmake -maxval 255 ${PURPLE} 1 1 > ${target_pnm} -pnmpad ${ptop} -color ${PURPLE} ${infile} | cmptarget -pnmpad ${ptop} -color ${PURPLE} -promote format ${infile} | cmptarget -pnmpad ${ptop} -color ${PURPLE} -promote all ${infile} | cmptarget +ppmmake -maxval 255 purple 1 1 > ${target_pnm} +pnmpad ${ptop} -color purple ${infile} | cmptarget +pnmpad ${ptop} -color purple -promote format ${infile} | cmptarget +pnmpad ${ptop} -color purple -promote all ${infile} | cmptarget echo echo "Test 5. PGM maxval 511 infile" @@ -271,17 +269,17 @@ echo "Should print match five times" pgmmake -maxval 511 0.0 1 1 > ${target_pnm} pnmpad ${ptop} ${infile} | cmptarget pnmpad ${ptop} -black ${infile} | cmptarget -pnmpad ${ptop} -color ${BLACK} ${infile} | cmptarget -pnmpad ${ptop} -color ${BLACK} -promote none ${infile} | cmptarget -pnmpad ${ptop} -color ${BLACK} -promote format ${infile} | cmptarget +pnmpad ${ptop} -color black ${infile} | cmptarget +pnmpad ${ptop} -color black -promote none ${infile} | cmptarget +pnmpad ${ptop} -color black -promote format ${infile} | cmptarget echo "Should print match four times" pgmmake -maxval 511 1.0 1 1 > ${target_pnm} pnmpad ${ptop} -white ${infile} | cmptarget -pnmpad ${ptop} -color ${WHITE} ${infile} | cmptarget -pnmpad ${ptop} -color ${WHITE} -promote none ${infile} | cmptarget -pnmpad ${ptop} -color ${WHITE} -promote format ${infile} | cmptarget +pnmpad ${ptop} -color white ${infile} | cmptarget +pnmpad ${ptop} -color white -promote none ${infile} | cmptarget +pnmpad ${ptop} -color white -promote format ${infile} | cmptarget echo "Should print match twice" @@ -303,8 +301,8 @@ pnmpad ${ptop} -color ${DARKGRAY} -promote format ${infile} | cmptarget echo "Should print match once" -ppmmake -maxval 511 ${PURPLE} 1 1 | ppmtopgm > ${target_pnm} -pnmpad ${ptop} -color ${PURPLE} -promote none ${infile} | cmptarget +ppmmake -maxval 511 purple 1 1 | ppmtopgm > ${target_pnm} +pnmpad ${ptop} -color purple -promote none ${infile} | cmptarget echo "Should print match twice" @@ -320,10 +318,10 @@ pnmpad ${ptop} -color ${DARKGRAY} -promote all ${infile} | cmptarget echo "Should print match three times" -ppmmake -maxval 511 ${PURPLE} 1 1 > ${target_pnm} -pnmpad ${ptop} -color ${PURPLE} ${infile} | cmptarget -pnmpad ${ptop} -color ${PURPLE} -promote format ${infile} | cmptarget -pnmpad ${ptop} -color ${PURPLE} -promote all ${infile} | cmptarget +ppmmake -maxval 511 purple 1 1 > ${target_pnm} +pnmpad ${ptop} -color purple ${infile} | cmptarget +pnmpad ${ptop} -color purple -promote format ${infile} | cmptarget +pnmpad ${ptop} -color purple -promote all ${infile} | cmptarget echo @@ -333,26 +331,26 @@ infile=${test127_ppm} echo "Should print match five times" -ppmmake -maxval 127 ${BLACK} 1 1 > ${target_pnm} +ppmmake -maxval 127 black 1 1 > ${target_pnm} pnmpad ${ptop} ${infile} | cmptarget pnmpad ${ptop} -black ${infile} | cmptarget -pnmpad ${ptop} -color ${BLACK} ${infile} | cmptarget -pnmpad ${ptop} -color ${BLACK} -promote none ${infile} | cmptarget -pnmpad ${ptop} -color ${BLACK} -promote format ${infile} | cmptarget +pnmpad ${ptop} -color black ${infile} | cmptarget +pnmpad ${ptop} -color black -promote none ${infile} | cmptarget +pnmpad ${ptop} -color black -promote format ${infile} | cmptarget echo "Should print match four times" -ppmmake -maxval 127 ${WHITE} 1 1 > ${target_pnm} +ppmmake -maxval 127 white 1 1 > ${target_pnm} pnmpad ${ptop} -white ${infile} | cmptarget -pnmpad ${ptop} -color ${WHITE} ${infile} | cmptarget -pnmpad ${ptop} -color ${WHITE} -promote none ${infile} | cmptarget -pnmpad ${ptop} -color ${WHITE} -promote format ${infile} | cmptarget +pnmpad ${ptop} -color white ${infile} | cmptarget +pnmpad ${ptop} -color white -promote none ${infile} | cmptarget +pnmpad ${ptop} -color white -promote format ${infile} | cmptarget echo "Should print match twice" -ppmmake -maxval 127 ${PURPLE} 1 1 > ${target_pnm} -ppmmake -maxval 127 ${PURPLE} 1 2 | pnmpad ${ptop} -extend-edge | cmptarget -ppmmake -maxval 127 ${PURPLE} 1 2 | pnmpad ${ptop} -detect-background | cmptarget +ppmmake -maxval 127 purple 1 1 > ${target_pnm} +ppmmake -maxval 127 purple 1 2 | pnmpad ${ptop} -extend-edge | cmptarget +ppmmake -maxval 127 purple 1 2 | pnmpad ${ptop} -detect-background | cmptarget echo "Should print match twice" @@ -368,8 +366,8 @@ pnmpad ${ptop} -color ${DARKGRAY} -promote format ${infile} | cmptarget echo "Should print match once" -ppmmake -maxval 127 ${PURPLE} 1 1 > ${target_pnm} -pnmpad ${ptop} -color ${PURPLE} -promote none ${infile} | cmptarget +ppmmake -maxval 127 purple 1 1 > ${target_pnm} +pnmpad ${ptop} -color purple -promote none ${infile} | cmptarget echo "Should print match twice" @@ -385,9 +383,9 @@ pnmpad ${ptop} -color ${DARKGRAY} -promote all ${infile} | cmptarget echo "Should print match twice" -ppmmake -maxval 255 ${PURPLE} 1 1 > ${target_pnm} -pnmpad ${ptop} -color ${PURPLE} ${infile} | cmptarget -pnmpad ${ptop} -color ${PURPLE} -promote all ${infile} | cmptarget +ppmmake -maxval 255 purple 1 1 > ${target_pnm} +pnmpad ${ptop} -color purple ${infile} | cmptarget +pnmpad ${ptop} -color purple -promote all ${infile} | cmptarget echo echo "Test 7. PPM maxval 511 infile" @@ -396,30 +394,30 @@ infile=${test511_ppm} echo "Should print match five times" -ppmmake -maxval 511 ${BLACK} 1 1 > ${target_pnm} +ppmmake -maxval 511 black 1 1 > ${target_pnm} pnmpad ${ptop} ${infile} | cmptarget pnmpad ${ptop} -black ${infile} | cmptarget -pnmpad ${ptop} -color ${BLACK} ${infile} | cmptarget -pnmpad ${ptop} -color ${BLACK} -promote none ${infile} | cmptarget -pnmpad ${ptop} -color ${BLACK} -promote format ${infile} | cmptarget +pnmpad ${ptop} -color black ${infile} | cmptarget +pnmpad ${ptop} -color black -promote none ${infile} | cmptarget +pnmpad ${ptop} -color black -promote format ${infile} | cmptarget echo "Should print match four times" -ppmmake -maxval 511 ${WHITE} 1 1 > ${target_pnm} +ppmmake -maxval 511 white 1 1 > ${target_pnm} pnmpad ${ptop} -white ${infile} | cmptarget -pnmpad ${ptop} -color ${WHITE} ${infile} | cmptarget -pnmpad ${ptop} -color ${WHITE} -promote none ${infile} | cmptarget -pnmpad ${ptop} -color ${WHITE} -promote format ${infile} | cmptarget +pnmpad ${ptop} -color white ${infile} | cmptarget +pnmpad ${ptop} -color white -promote none ${infile} | cmptarget +pnmpad ${ptop} -color white -promote format ${infile} | cmptarget echo "Should print match six times" -ppmmake -maxval 511 ${PURPLE} 1 1 > ${target_pnm} -ppmmake -maxval 511 ${PURPLE} 1 5 | pnmpad ${ptop} -extend-edge | cmptarget -ppmmake -maxval 511 ${PURPLE} 1 5 | pnmpad ${ptop} -detect-background | cmptarget -pnmpad ${ptop} -color ${PURPLE} ${infile} | cmptarget -pnmpad ${ptop} -color ${PURPLE} -promote none ${infile} | cmptarget -pnmpad ${ptop} -color ${PURPLE} -promote format ${infile} | cmptarget -pnmpad ${ptop} -color ${PURPLE} -promote all ${infile} | cmptarget +ppmmake -maxval 511 purple 1 1 > ${target_pnm} +ppmmake -maxval 511 purple 1 5 | pnmpad ${ptop} -extend-edge | cmptarget +ppmmake -maxval 511 purple 1 5 | pnmpad ${ptop} -detect-background | cmptarget +pnmpad ${ptop} -color purple ${infile} | cmptarget +pnmpad ${ptop} -color purple -promote none ${infile} | cmptarget +pnmpad ${ptop} -color purple -promote format ${infile} | cmptarget +pnmpad ${ptop} -color purple -promote all ${infile} | cmptarget echo "Should print match twice" diff --git a/test/pnmpad-format.test b/test/pnmpad-format.test index 73ea6d2b..8d29952a 100755 --- a/test/pnmpad-format.test +++ b/test/pnmpad-format.test @@ -4,30 +4,28 @@ tmpdir=${tmpdir:-/tmp} -white_pbm=${tmpdir}/white.pbm -#black_pbm=${tmpdir}/black.pbm -test127_pgm=${tmpdir}/testimg1.pgm -test255_pgm=${tmpdir}/testimg2.pgm -test511_pgm=${tmpdir}/testimg3.pgm -test127_ppm=${tmpdir}/testimg1.ppm -test255_ppm=${tmpdir}/testimg2.ppm -test511_ppm=${tmpdir}/testimg3.ppm - -BLACK="rgbi:0.0/0.0/0.0" -WHITE="rgbi:1.0/1.0/1.0" +white_pbm="${tmpdir}"/white.pbm +#black_pbm="${tmpdir}"/black.pbm +test127_pgm="${tmpdir}"/testimg1.pgm +test255_pgm="${tmpdir}"/testimg2.pgm +test511_pgm="${tmpdir}"/testimg3.pgm +test127_ppm="${tmpdir}"/testimg1.ppm +test255_ppm="${tmpdir}"/testimg2.ppm +test511_ppm="${tmpdir}"/testimg3.ppm + +RGBDEF=./rgbt.txt + LIGHTGRAY="rgbi:0.6/0.6/0.6" LIGHTGRAYv=0.6 DARKGRAY="rgbi:0.01/0.01/0.01" DARKGRAYv=0.01 -PURPLE="rgb:A0/20/F0" -YELLOW="rgb:FF/FF/00" pbmmake -w 3 1 > ${white_pbm} #pbmmake -b 3 1 > ${black_pbm} pgmmake 0.2 3 1 -maxval 127 > ${test127_pgm} pgmmake 0.2 3 1 -maxval 255 > ${test255_pgm} -ppmmake ${YELLOW} 3 1 -maxval 127 > ${test127_ppm} -ppmmake ${YELLOW} 3 1 -maxval 511 > ${test511_ppm} +ppmmake yellow 3 1 -maxval 127 > ${test127_ppm} +ppmmake yellow 3 1 -maxval 511 > ${test511_ppm} # define function ckfmt() { pamfile || echo "failure"; } @@ -46,17 +44,17 @@ pnmpad ${size} -white ${infile} | ckfmt pnmpad ${size} -extend-edge ${infile} | ckfmt pnmpad ${size} -detect-background ${infile} | ckfmt -pnmpad ${size} -color ${BLACK} ${infile} | ckfmt -pnmpad ${size} -color ${BLACK} -promote none ${infile} | ckfmt -pnmpad ${size} -color ${BLACK} -promote format ${infile} | ckfmt +pnmpad ${size} -color black ${infile} | ckfmt +pnmpad ${size} -color black -promote none ${infile} | ckfmt +pnmpad ${size} -color black -promote format ${infile} | ckfmt -pnmpad ${size} -color ${WHITE} ${infile} | ckfmt -pnmpad ${size} -color ${WHITE} -promote none ${infile} | ckfmt -pnmpad ${size} -color ${WHITE} -promote format ${infile} | ckfmt +pnmpad ${size} -color white ${infile} | ckfmt +pnmpad ${size} -color white -promote none ${infile} | ckfmt +pnmpad ${size} -color white -promote format ${infile} | ckfmt pnmpad ${size} -color ${LIGHTGRAY} -promote none ${infile} | ckfmt pnmpad ${size} -color ${DARKGRAY} -promote none ${infile} | ckfmt -pnmpad ${size} -color ${PURPLE} -promote none ${infile} | ckfmt +pnmpad ${size} -color purple -promote none ${infile} | ckfmt echo "Should print: PGM raw, 8 by 1 maxval 1 twice" @@ -70,12 +68,12 @@ pnmpad ${size} -color ${DARKGRAY} ${infile} | ckfmt echo "Should print: PPM raw, 8 by 1 maxval 1 once" -pnmpad ${size} -color ${PURPLE} -promote format ${infile} | ckfmt +pnmpad ${size} -color purple -promote format ${infile} | ckfmt echo "Should print: PPM raw, 8 by 1 maxval 255 twice" -pnmpad ${size} -color ${PURPLE} ${infile} | ckfmt -pnmpad ${size} -color ${PURPLE} -promote all ${infile} | ckfmt +pnmpad ${size} -color purple ${infile} | ckfmt +pnmpad ${size} -color purple -promote all ${infile} | ckfmt rm ${infile} @@ -92,13 +90,13 @@ pnmpad ${size} -white ${infile} | ckfmt pnmpad ${size} -extend-edge ${infile} | ckfmt pnmpad ${size} -detect-background ${infile} | ckfmt -pnmpad ${size} -color ${BLACK} ${infile} | ckfmt -pnmpad ${size} -color ${BLACK} -promote none ${infile} | ckfmt -pnmpad ${size} -color ${BLACK} -promote format ${infile} | ckfmt +pnmpad ${size} -color black ${infile} | ckfmt +pnmpad ${size} -color black -promote none ${infile} | ckfmt +pnmpad ${size} -color black -promote format ${infile} | ckfmt -pnmpad ${size} -color ${WHITE} ${infile} | ckfmt -pnmpad ${size} -color ${WHITE} -promote none ${infile} | ckfmt -pnmpad ${size} -color ${WHITE} -promote format ${infile} | ckfmt +pnmpad ${size} -color white ${infile} | ckfmt +pnmpad ${size} -color white -promote none ${infile} | ckfmt +pnmpad ${size} -color white -promote format ${infile} | ckfmt pnmpad ${size} -color ${LIGHTGRAY} -promote none ${infile} | ckfmt pnmpad ${size} -color ${LIGHTGRAY} -promote format ${infile} | ckfmt @@ -106,7 +104,7 @@ pnmpad ${size} -color ${LIGHTGRAY} -promote format ${infile} | ckfmt pnmpad ${size} -color ${DARKGRAY} -promote none ${infile} | ckfmt pnmpad ${size} -color ${DARKGRAY} -promote format ${infile} | ckfmt -pnmpad ${size} -color ${PURPLE} -promote none ${infile} | ckfmt +pnmpad ${size} -color purple -promote none ${infile} | ckfmt echo "Should print: PGM raw, 8 by 1 maxval 255 four times" @@ -117,12 +115,12 @@ pnmpad ${size} -color ${DARKGRAY} -promote all ${infile} | ckfmt echo "Should print: PPM raw, 8 by 1 maxval 127 once" -pnmpad ${size} -color ${PURPLE} -promote format ${infile} | ckfmt +pnmpad ${size} -color purple -promote format ${infile} | ckfmt echo "Should print: PPM raw, 8 by 1 maxval 255 twice" -pnmpad ${size} -color ${PURPLE} ${infile} | ckfmt -pnmpad ${size} -color ${PURPLE} -promote all ${infile} | ckfmt +pnmpad ${size} -color purple ${infile} | ckfmt +pnmpad ${size} -color purple -promote all ${infile} | ckfmt rm ${infile} @@ -139,10 +137,10 @@ pnmpad ${size} -white ${infile} | ckfmt pnmpad ${size} -extend-edge ${infile} | ckfmt pnmpad ${size} -detect-background ${infile} | ckfmt -pnmpad ${size} -color ${BLACK} ${infile} | ckfmt -pnmpad ${size} -color ${BLACK} -promote none ${infile} | ckfmt -pnmpad ${size} -color ${BLACK} -promote format ${infile} | ckfmt -pnmpad ${size} -color ${BLACK} -promote all ${infile} | ckfmt +pnmpad ${size} -color black ${infile} | ckfmt +pnmpad ${size} -color black -promote none ${infile} | ckfmt +pnmpad ${size} -color black -promote format ${infile} | ckfmt +pnmpad ${size} -color black -promote all ${infile} | ckfmt pnmpad ${size} -color ${LIGHTGRAY} ${infile} | ckfmt pnmpad ${size} -color ${LIGHTGRAY} -promote none ${infile} | ckfmt @@ -155,14 +153,14 @@ pnmpad ${size} -color ${DARKGRAY} -promote none ${infile} | ckfmt pnmpad ${size} -color ${DARKGRAY} -promote format ${infile} | ckfmt pnmpad ${size} -color ${DARKGRAY} -promote all ${infile} | ckfmt -pnmpad ${size} -color ${PURPLE} -promote none ${infile} | ckfmt +pnmpad ${size} -color purple -promote none ${infile} | ckfmt echo "Should print: PPM raw, 8 by 1 maxval 255 three times" -pnmpad ${size} -color ${PURPLE} ${infile} | ckfmt +pnmpad ${size} -color purple ${infile} | ckfmt -pnmpad ${size} -color ${PURPLE} -promote format ${infile} | ckfmt -pnmpad ${size} -color ${PURPLE} -promote all ${infile} | ckfmt +pnmpad ${size} -color purple -promote format ${infile} | ckfmt +pnmpad ${size} -color purple -promote all ${infile} | ckfmt rm ${infile} @@ -179,28 +177,28 @@ pnmpad ${size} -white ${infile} | ckfmt pnmpad ${size} -extend-edge ${infile} | ckfmt pnmpad ${size} -detect-background ${infile} | ckfmt -pnmpad ${size} -color ${BLACK} ${infile} | ckfmt -pnmpad ${size} -color ${BLACK} -promote none ${infile} | ckfmt -pnmpad ${size} -color ${BLACK} -promote format ${infile} | ckfmt -pnmpad ${size} -color ${WHITE} ${infile} | ckfmt -pnmpad ${size} -color ${WHITE} -promote none ${infile} | ckfmt -pnmpad ${size} -color ${WHITE} -promote format ${infile} | ckfmt +pnmpad ${size} -color black ${infile} | ckfmt +pnmpad ${size} -color black -promote none ${infile} | ckfmt +pnmpad ${size} -color black -promote format ${infile} | ckfmt +pnmpad ${size} -color white ${infile} | ckfmt +pnmpad ${size} -color white -promote none ${infile} | ckfmt +pnmpad ${size} -color white -promote format ${infile} | ckfmt pnmpad ${size} -color ${LIGHTGRAY} -promote none ${infile} | ckfmt pnmpad ${size} -color ${LIGHTGRAY} -promote format ${infile} | ckfmt pnmpad ${size} -color ${DARKGRAY} -promote none ${infile} | ckfmt pnmpad ${size} -color ${DARKGRAY} -promote format ${infile} | ckfmt -pnmpad ${size} -color ${PURPLE} -promote none ${infile} | ckfmt -pnmpad ${size} -color ${PURPLE} -promote format ${infile} | ckfmt +pnmpad ${size} -color purple -promote none ${infile} | ckfmt +pnmpad ${size} -color purple -promote format ${infile} | ckfmt echo "Should print: PPM raw, 8 by 1 maxval 255 five times" pnmpad ${size} -color ${LIGHTGRAY} ${infile} | ckfmt pnmpad ${size} -color ${DARKGRAY} ${infile} | ckfmt -pnmpad ${size} -color ${PURPLE} ${infile} | ckfmt +pnmpad ${size} -color purple ${infile} | ckfmt pnmpad ${size} -color ${LIGHTGRAY} -promote all ${infile} | ckfmt -pnmpad ${size} -color ${PURPLE} -promote all ${infile} | ckfmt +pnmpad ${size} -color purple -promote all ${infile} | ckfmt rm ${infile} @@ -217,15 +215,15 @@ pnmpad ${size} -white ${infile} | ckfmt pnmpad ${size} -extend-edge ${infile} | ckfmt pnmpad ${size} -detect-background ${infile} | ckfmt -pnmpad ${size} -color ${BLACK} ${infile} | ckfmt -pnmpad ${size} -color ${BLACK} -promote none ${infile} | ckfmt -pnmpad ${size} -color ${BLACK} -promote format ${infile} | ckfmt -pnmpad ${size} -color ${BLACK} -promote all ${infile} | ckfmt +pnmpad ${size} -color black ${infile} | ckfmt +pnmpad ${size} -color black -promote none ${infile} | ckfmt +pnmpad ${size} -color black -promote format ${infile} | ckfmt +pnmpad ${size} -color black -promote all ${infile} | ckfmt -pnmpad ${size} -color ${WHITE} ${infile} | ckfmt -pnmpad ${size} -color ${WHITE} -promote none ${infile} | ckfmt -pnmpad ${size} -color ${WHITE} -promote format ${infile} | ckfmt -pnmpad ${size} -color ${WHITE} -promote all ${infile} | ckfmt +pnmpad ${size} -color white ${infile} | ckfmt +pnmpad ${size} -color white -promote none ${infile} | ckfmt +pnmpad ${size} -color white -promote format ${infile} | ckfmt +pnmpad ${size} -color white -promote all ${infile} | ckfmt pnmpad ${size} -color ${LIGHTGRAY} ${infile} | ckfmt pnmpad ${size} -color ${LIGHTGRAY} -promote none ${infile} | ckfmt @@ -237,9 +235,9 @@ pnmpad ${size} -color ${DARKGRAY} -promote none ${infile} | ckfmt pnmpad ${size} -color ${DARKGRAY} -promote format ${infile} | ckfmt pnmpad ${size} -color ${DARKGRAY} -promote all ${infile} | ckfmt -pnmpad ${size} -color ${PURPLE} ${infile} | ckfmt -pnmpad ${size} -color ${PURPLE} -promote none ${infile} | ckfmt -pnmpad ${size} -color ${PURPLE} -promote format ${infile} | ckfmt -pnmpad ${size} -color ${PURPLE} -promote all ${infile} | ckfmt +pnmpad ${size} -color purple ${infile} | ckfmt +pnmpad ${size} -color purple -promote none ${infile} | ckfmt +pnmpad ${size} -color purple -promote format ${infile} | ckfmt +pnmpad ${size} -color purple -promote all ${infile} | ckfmt rm ${infile} diff --git a/test/ppmchange.test b/test/ppmchange.test index a579631b..039a4a81 100755 --- a/test/ppmchange.test +++ b/test/ppmchange.test @@ -2,45 +2,38 @@ # This script tests: ppmchange # Also requires: ppmrainbow pgmramp ppmhist - # Failure message ## If this test fails and ppmchange-roundtrip.test succeeds, ## the probable cause is a problem with one of the options of ## ppmchange: -closeness or -remainder. tmpdir=${tmpdir:-/tmp} -rainbow_ppm=${tmpdir}/rainbow.ppm -changed_ppm=${tmpdir}/changed.ppm +rainbow_ppm="${tmpdir}"/rainbow.ppm +changed_ppm="${tmpdir}"/changed.ppm -# Explicit values for intermediate colors: rgb.txt may not be the one -# Netpbm provides; they may be defined in unusual ways. +RGBDEF=./rgbt.txt -brown=rgb:67/43/00 -cyan=rgb:00/ff/ff -yellow=rgb:ff/ff/00 gray=rgb:7f/7f/7f - # Test 1. Should print 22488533 203 -pgmramp -lr 8 8 | ppmchange black black white white $gray $gray \ +pgmramp -lr 8 8 | ppmchange black black white white ${gray} ${gray} \ -close=10 -remainder=blue | cksum # Test 2. Should print 1008787190 613 -ppmrainbow -tmpdir=$tmpdir -width=200 -height=1 red green blue | \ +ppmrainbow -tmpdir="${tmpdir}" -width=200 -height=1 red green blue | \ tee ${rainbow_ppm} | \ - ppmchange red $brown green $brown blue $brown | cksum + ppmchange red brown green brown blue brown | cksum # Validate ${rainbow_ppm} # Should print 1983174784 613 cat ${rainbow_ppm} | cksum - # Test 3. Should print 2146447222 613 -ppmchange red $brown green $cyan blue $yellow \ +ppmchange red brown green cyan blue yellow \ -closeness=25 ${rainbow_ppm} | cksum |