diff options
Diffstat (limited to 'test')
118 files changed, 3220 insertions, 391 deletions
diff --git a/test/Available-Testprog b/test/Available-Testprog new file mode 100755 index 00000000..8176b57a --- /dev/null +++ b/test/Available-Testprog @@ -0,0 +1,75 @@ +#! /bin/bash + +# If make target is "check-install" assume that all programs are available +if [ "${CHECK_TYPE}" = "install" ]; then + exit 0 +fi + +# Special case: no arguments were passed to this program +# For all-in-place.test and legacy-names.test + +if [ $# = 0 ]; then + exit 0 +fi + +# Normal operation: Walk through the argument list and exit if an +# unavailable program is encountered. + +# See http://netpbm.sourceforge.net/prereq.html and the makefiles in +# each directory (for example converter/other/Makefile) for library +# requirements and relevant variables. + +for i in $@ + do + case $i in + fiascotopnm|\ + pnmtofiasco) + [ "${BUILD_FIASCO}" = "N" ] && exit 1 ;; + + jpeg2ktopam|\ + pamtojpeg2k) + [ "${JASPERLIB}" = "NONE" ] && exit 1 ;; + + jbigtopnm|\ + pnmtojbig) + [ "${JBIGLIB}" = "NONE" ] && exit 1 ;; + + jpegtopnm|\ + pnmtojpeg|\ + ppmtojpeg) + [ "${JPEGLIB}" = "NONE" ] && exit 1 ;; + + pamtotiff|\ + pnmtotiff|\ + pnmtotiffcmyk|\ + tifftopnm) + [ "${TIFFLIB}" = "NONE" -o \ + "${JPEGLIB}" = "NONE" -o \ + "${ZLIB}" = "NONE" ] && exit 1 ;; + + pnmtorle|\ + rletopnm) + [ "${URTLIB}" = "NONE" ] && exit 1 ;; + + pamx) + [ "${X11LIB}" = "NONE" ] && exit 1 ;; + + svgtopam) + [ "${XML2_LIBS}" = "NONE" ] && exit 1 ;; + + thinkjettopbm) + [ -z "${LEX}" ] && exit 1 ;; + + zlib) + [ "${ZLIB}" = "NONE" ] && exit 1 ;; + + esac +done + +# All checks passed. Exit with success status. +exit 0 + + +# TODO: We don't have a good method for testing whether PNGLIB is +# available for linking. +# Affected programs: pamtopng, pngtopam, pngtopnm, pnmtopng diff --git a/test/Execute-Tests b/test/Execute-Tests index 78091e6b..7a65d51f 100755 --- a/test/Execute-Tests +++ b/test/Execute-Tests @@ -180,7 +180,8 @@ elif [ $VALGRIND_TESTS = "on" ] vg_command_base="valgrind --trace-children=yes"; for i in awk cat cksum cmp cp cut date dirname egrep fgrep file grep gs \ - head mkdir mktemp perl rm sed seq sh tee testrandom tr uniq + head iconv mkdir mktemp perl rm sed seq sh tee testrandom tr uniq \ + Available-Testprog # Tell valgrind not to probe execution of the above programs. @@ -236,19 +237,38 @@ if [ $VALGRIND_TESTS = "on" ] fi # Execute a single test and test its result. - -PATH=${testpath} $vg_command ${srcdir}/$tname > ${tname%.test}.out; -let result=$? -case $result in -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. - fi ;; -80) let result=4 ;; -*) let result=1 ;; -esac +# But first check if the .ok file exists. (Some .ok files are +# dynamically created.) Then see if target programs and requirements +# are in place. If either of these conditions are not met, do +# not execute the test and report "Not Testable". + +if [ ! -s ${srcdir}/${tname%.test}.ok ] +then + let result=4; +else + ${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' ' '` + case $? in + 0) + PATH=${testpath} $vg_command ${srcdir}/$tname > ${tname%.test}.out; + let retval=$? + case $retval in + 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. + fi ;; + 80) let result=4 ;; + *) let result=1 ;; + esac ;; + + 1) let result=4 ;; + *) let result=1 ;; + esac +fi # Report whether a single test succeeded or failed. # Increment counters. diff --git a/test/Makefile b/test/Makefile index 9b7ab047..c640dfff 100644 --- a/test/Makefile +++ b/test/Makefile @@ -10,7 +10,9 @@ MERGE_OBJECTS = PROGS = testrandom -all: $(PROGS) +OKSTOGENERATE = $(patsubst %.rand-ok, %.ok, $(wildcard *.rand-ok)) + +all: $(PROGS) $(OKSTOGENERATE) testrandom.o: testrandom.c $(CC_FOR_BUILD) -c -o $@ $(CFLAGS_FOR_BUILD) $< @@ -18,6 +20,10 @@ testrandom.o: testrandom.c testrandom: testrandom.o $(LD_FOR_BUILD) -o $@ $(LDFLAGS_FOR_BUILD) $< +RAND_VARIETY ?= $(shell ./testrandom -x) + +$(OKSTOGENERATE): %.ok: %.rand-ok testrandom + sed -n "/^$(RAND_VARIETY)|/s/^$(RAND_VARIETY)|//p" $< > $@ OMIT_TEST_RULE = 1 include $(SRCDIR)/common.mk @@ -25,4 +31,4 @@ include $(SRCDIR)/common.mk distclean clean: cleanlocal .PHONY: cleanlocal cleanlocal: - rm -f $(PROGS) + rm -f $(PROGS) $(patsubst %.rand-ok,%.ok,$(wildcard *.rand-ok)) diff --git a/test/Test-Order b/test/Test-Order index 92efca05..49eaeff2 100644 --- a/test/Test-Order +++ b/test/Test-Order @@ -1,4 +1,4 @@ -# General test +# General tests all-in-place.test legacy-names.test @@ -12,23 +12,29 @@ pamseq.test pbmpage.test pbmtext.test +pbmtext-bdf.test +pbmtext-iso88591.test +pbmtext-utf8.test pbmupc.test pgmramp.test -ppmgauss.test +pamgauss.test ppmcie.test ppmwheel.test pamcrater.test +ppmpat.test # Generators with random components pgmnoise.test -ppmpat.test +ppmpat-random.test ppmforge.test ppmrough.test # Analyzer tests pamfile.test +pamfind.test +pamtable.test pgmhist.test ppmhist.test pamsumm.test @@ -53,15 +59,16 @@ pamcut.test pnmcat.test pamflip1.test pamflip2.test -pamenlarge.test pnminvert.test pamchannel.test ppmchange.test pambackground.test +pnmpaste-pbm.test pbmpscale.test pnmremap1.test pnmremap2.test +pnmquantall.test pnmtile.test ppmbrighten.test ppmdither.test @@ -71,7 +78,19 @@ ppmdim.test pnmshear.test pgmbentley.test +pamenlarge.test +pamenlarge-pbm.test + +pamscale-reportonly.test +pamscale-filters1.test +pamscale-filters2.test +pamscale-filters3.test +pamenlarge-pamscale-point.test + +pamstretch.test + ppmmix.test +pammixmulti-identity.test # Symmetry test @@ -79,6 +98,7 @@ symmetry.test # Format converter tests +pamtopdbimg.test pbmtog3.test 411toppm.test eyuvtoppm.test @@ -103,6 +123,8 @@ ppmchange-roundtrip.test pamdice-roundtrip.test pamslice-roundtrip.test lookup-roundtrip.test +enlarge-reduce-roundtrip.test +cut-cat-roundtrip.test # Round-trip tests : lossless converters @@ -111,6 +133,7 @@ atari-roundtrip.test atk-roundtrip.test avs-roundtrip.test bmp-roundtrip.test +bmp-quant-roundtrip.test cis-roundtrip.test cmuw-roundtrip.test facesaver-roundtrip.test @@ -122,18 +145,23 @@ gif-quant-roundtrip.test hdiff-roundtrip.test ilbm-roundtrip.test jbig-roundtrip.test +jpeg2k-roundtrip.test leaf-roundtrip.test macp-roundtrip.test mda-roundtrip.test mgr-roundtrip.test mrf-roundtrip.test +palm-roundtrip.test +palm-roundtrip2.test pcx-roundtrip.test +pdb-roundtrip.test pfm-roundtrip.test pi3-roundtrip.test pict-roundtrip.test png-roundtrip.test png-roundtrip2.test ps-roundtrip.test +ps-flate-roundtrip.test ps-alt-roundtrip.test sgi-roundtrip.test sbig-roundtrip.test @@ -142,6 +170,7 @@ sunicon-roundtrip.test sunrast-roundtrip.test targa-roundtrip.test tiff-roundtrip.test +tiff-flate-lzw-roundtrip.test utahrle-roundtrip.test wbmp-roundtrip.test winicon-roundtrip.test @@ -150,6 +179,9 @@ xpm-roundtrip.test xv-roundtrip.test xwd-roundtrip.test -# Round-trip tests : lossy converter +# Round-trip tests : lossy converters +fiasco-roundtrip.test +jpeg-roundtrip.test +tiffcmyk-roundtrip.test yuv-roundtrip.test diff --git a/test/all-in-place.ok b/test/all-in-place.ok index 6ba75993..2df9f392 100644 --- a/test/all-in-place.ok +++ b/test/all-in-place.ok @@ -11,6 +11,7 @@ cmuwmtopbm: ok ddbugtopbm: ok escp2topbm: ok eyuvtoppm: ok +fiascotopnm: ok fitstopnm: ok fstopgm: ok g3topbm: ok @@ -35,9 +36,11 @@ mtvtoppm: ok neotoppm: ok palmtopnm: ok pamaddnoise: ok +pamaltsat: ok pamarith: ok pambackground: ok pambayer: ok +pambrighten: ok pamchannel: ok pamcomp: ok pamcrater: ok @@ -51,14 +54,19 @@ pamendian: ok pamenlarge: ok pamexec: ok pamfile: ok +pamfind: ok pamfix: ok pamflip: ok pamfunc: ok pamgauss: ok +pamgetcolor: ok pamgradient: ok +pamhue: ok +pamlevels: ok pamlookup: ok pammasksharpen: ok pammixinterlace: ok +pammixmulti: ok pammosaicknit: ok pamoil: ok pampaintspill: ok @@ -78,8 +86,10 @@ pamsplit: ok pamstack: ok pamstereogram: ok pamstretch: ok +pamstretch-gen: ok pamsumm: ok pamsummcol: ok +pamtable: ok pamthreshold: ok pamtilt: ok pamtoavs: ok @@ -103,6 +113,7 @@ pamtotiff: ok pamtouil: ok pamtowinicon: ok pamtoxvmini: ok +pamtris: ok pamundice: ok pamunlookup: ok pamvalidate: ok @@ -195,6 +206,7 @@ pnmhisteq: ok pnmhistmap: ok pnmindex: ok pnminvert: ok +pnmmargin: ok pnmmercator: ok pnmmontage: ok pnmnlfilt: ok @@ -202,6 +214,8 @@ pnmnorm: ok pnmpad: ok pnmpaste: ok pnmpsnr: ok +pnmquant: ok +pnmquantall: ok pnmremap: ok pnmrotate: ok pnmscalefixed: ok @@ -236,6 +250,7 @@ ppmdist: ok ppmdither: ok ppmdmkfont: ok ppmdraw: ok +ppmfade: ok ppmflash: ok ppmforge: ok ppmglobe: ok @@ -245,8 +260,10 @@ ppmmake: ok ppmmix: ok ppmntsc: ok ppmpat: ok +ppmrainbow: ok ppmrelief: ok ppmrough: ok +ppmshadow: ok ppmshift: ok ppmspread: ok ppmtoacad: ok @@ -315,15 +332,5 @@ yuvsplittoppm: ok yuvtoppm: ok yuy2topam: ok zeisstopnm: ok -fiascotopnm: ok -manweb: ok -pnmmargin: ok anytopnm: ok -ppmtomap: ok -ppmshadow: ok -pnmquant: ok -pnmquantall: ok -ppmrainbow: ok -ppmfade: ok -pamstretch-gen: ok -pcdovtoppm: ok +manweb: ok diff --git a/test/all-in-place.test b/test/all-in-place.test index 4c8af56b..6cf677ef 100755 --- a/test/all-in-place.test +++ b/test/all-in-place.test @@ -4,9 +4,12 @@ # We test by actually running all the executables. # Failure message -# See Netpbm Library Prerequisites -# http://netpbm.sourceforge.net/prereq.html -# if make succeeds but this test fails. +## See Netpbm Library Prerequisites +## http://netpbm.sourceforge.net/prereq.html +## if make succeeds but this test fails +## +## If you run the "make test-install" on an older version, some executables +## may be reported as missing because of missing features. function testExitStatus () { @@ -50,6 +53,7 @@ ordinary_testprogs="\ ddbugtopbm \ escp2topbm \ eyuvtoppm \ + fiascotopnm \ fitstopnm \ fstopgm \ g3topbm \ @@ -74,9 +78,11 @@ ordinary_testprogs="\ neotoppm \ palmtopnm \ pamaddnoise \ + pamaltsat \ pamarith \ pambackground \ pambayer \ + pambrighten \ pamchannel \ pamcomp \ pamcrater \ @@ -90,14 +96,19 @@ ordinary_testprogs="\ pamenlarge \ pamexec \ pamfile \ + pamfind \ pamfix \ pamflip \ pamfunc \ pamgauss \ + pamgetcolor \ pamgradient \ + pamhue \ + pamlevels \ pamlookup \ pammasksharpen \ pammixinterlace \ + pammixmulti \ pammosaicknit \ pamoil \ pampaintspill \ @@ -117,8 +128,10 @@ ordinary_testprogs="\ pamstack \ pamstereogram \ pamstretch \ + pamstretch-gen \ pamsumm \ pamsummcol \ + pamtable \ pamthreshold \ pamtilt \ pamtoavs \ @@ -142,6 +155,7 @@ ordinary_testprogs="\ pamtouil \ pamtowinicon \ pamtoxvmini \ + pamtris \ pamundice \ pamunlookup \ pamvalidate \ @@ -234,6 +248,7 @@ ordinary_testprogs="\ pnmhistmap \ pnmindex \ pnminvert \ + pnmmargin \ pnmmercator \ pnmmontage \ pnmnlfilt \ @@ -241,6 +256,8 @@ ordinary_testprogs="\ pnmpad \ pnmpaste \ pnmpsnr \ + pnmquant \ + pnmquantall \ pnmremap \ pnmrotate \ pnmscalefixed \ @@ -275,6 +292,7 @@ ordinary_testprogs="\ ppmdither \ ppmdmkfont \ ppmdraw \ + ppmfade \ ppmflash \ ppmforge \ ppmglobe \ @@ -284,8 +302,10 @@ ordinary_testprogs="\ ppmmix \ ppmntsc \ ppmpat \ + ppmrainbow \ ppmrelief \ ppmrough \ + ppmshadow \ ppmshift \ ppmspread \ ppmtoacad \ @@ -356,74 +376,58 @@ ordinary_testprogs="\ zeisstopnm \ " -for i in $ordinary_testprogs - do - $i --version 2>&1 | \ - egrep -v \ - "(Using libnetpbm|Compiled|(BSD|SYSV|MSDOS|AMIGA) defined|RGB_?ENV=)" \ - 1>&2; - testExitStatus $i 0 ${PIPESTATUS[0]} - done - - -# Test fiascotopnm, which has a unique -v flag. -fiascotopnm -v 2> /dev/null - testExitStatus fiascotopnm 2 $? - - -# Test manweb and pnmmargin, which have --help. -manweb --help > /dev/null - testExitStatus manweb 0 $? - -pnmmargin --help 2> /dev/null - testExitStatus pnmmargin 1 $? +# The string "fiascotopnm" has to be filtered out by fgrep for fiascotopnm +# has a slightly different version report format. -# Test anytopnm, pnmnoraw, pnmquant, pnmquantall -# ppmrainbow, ppmshadow, ppmtomap -# with trivial input. +# Switch to control output from "program --version" +# +grepSwitch=1 # Initial value + # Always 1 for check-install, + # otherwise changes to 0 once a command succeeds. +grepOption[0]="-v" # Suppress output +grepOption[1]="" # Output --version message -$i ${tmpdir}/test.pbm > /dev/null 2> /dev/null; -tmpdir=${tmpdir:-/tmp} -test_pbm=${tmpdir}/test.pbm +for i in $ordinary_testprogs + do + # Stub out programs that aren't built. + Available-Testprog "$i" + if [ $? = 1 ]; then + echo "$i: program was not built" 1>&2 + echo "$i: ok" + continue + fi -cat > ${test_pbm} <<EOF -P1 -1 1 -1 -EOF -for i in anytopnm ppmtomap ppmshadow - do - $i ${tmpdir}/test.pbm > /dev/null 2> /dev/null; - testExitStatus $i 0 $? - done + $i --version < /dev/null 2>&1 | \ + # Older versions of pamstretch-gen and ppmshadow (encountered when + # one does "make check-install") get stuck when there is no input. + # Supply /dev/null as input to placate these programs. + + egrep -v -e "fiascotopnm" -e \ + ": ((BSD|SYSV|MSDOS|AMIGA) defined|RGB_?ENV=)" | \ + egrep ${grepOption[$grepSwitch]} -e \ + ": (Using lib(net)?pbm|(Built (by|at)|Compiled ))" 1>&2; + # See showVersion() in lib/libpm.c for the above regular expressions. + + exitStatus=${PIPESTATUS[0]} + testExitStatus $i 0 ${exitStatus} -for i in pnmquant pnmquantall - do - $i 2 ${tmpdir}/test.pbm > /dev/null 2> /dev/null; - testExitStatus $i 0 $? + if [ ${CHECK_TYPE} != "install" ] + then grepSwitch=$((${grepSwitch} * ${exitStatus}==0 ? 0 : 1)) ; + fi done -rm ${test_pbm} - ppmrainbow rgb:00/00/00 rgb:ff/ff/ff \ - -tmpdir=${tmpdir} -width=2 -height=2 > /dev/null - testExitStatus ppmrainbow 0 $? +# Anytopnm now supports --version but it delegates the report to pamtopnm. +# It fails if pamtopnm is absent. +# We consider anytopnm too important to test in an indirect manner. -# Test ppmfade with corrupt input. -# Prevent the creation of output files by setting base to /dev/null. -# Exit status should be 50. - ppmfade -f /dev/zero -base /dev/null > /dev/null 2> /dev/null - testExitStatus ppmfade 50 $? +anytopnm testgrid.pbm > /dev/null 2> /dev/null; +testExitStatus anytopnm 0 $? -# Test pamstretch-gen and pcdovtoppm with no input. -# These two programs write a usage message on standout in this case. -# Exit status should be 1. +# Test manweb which has --help. -for i in pamstretch-gen pcdovtoppm - do - $i > /dev/null - testExitStatus $i 1 $? - done +manweb --help > /dev/null + testExitStatus manweb 0 $? diff --git a/test/bmp-quant-roundtrip.ok b/test/bmp-quant-roundtrip.ok new file mode 100644 index 00000000..5262df53 --- /dev/null +++ b/test/bmp-quant-roundtrip.ok @@ -0,0 +1,6 @@ +colors=256, bpp=8 +0 0 0 : 0 +0 0 0 : 0 +colors=16, bpp=4 +0 0 0 : 0 +0 0 0 : 0 diff --git a/test/bmp-quant-roundtrip.test b/test/bmp-quant-roundtrip.test new file mode 100755 index 00000000..2c223b7c --- /dev/null +++ b/test/bmp-quant-roundtrip.test @@ -0,0 +1,36 @@ +#! /bin/bash +# This script tests: bmptopnm ppmtobmp pnmquant +# Also requires: ppmhist + +tmpdir=${tmpdir:-/tmp} +quant_ppm=${tmpdir}/quant.ppm + +colors=256 # any value between 2 - 256 works +bpp=8 +echo colors=${colors}, bpp=${bpp} + +pnmquant ${colors} testimg.ppm > ${quant_ppm} + +for mode in "-windows" "-os2" + do + ppmtobmp $mode -bpp=${bpp} ${quant_ppm} | bmptopnm | \ + cmp -s - ${quant_ppm} > /dev/null + echo ${PIPESTATUS[@]} ":" $? + done + +rm ${quant_ppm} + +colors=16 # any value between 2 - 16 works +bpp=4 +echo colors=${colors}, bpp=${bpp} + +pnmquant ${colors} testimg.ppm > ${quant_ppm} + +for mode in "-windows" "-os2" + do + ppmtobmp -bpp=${bpp} ${quant_ppm} | bmptopnm | \ + cmp -s - ${quant_ppm} > /dev/null + echo ${PIPESTATUS[@]} ":" $? + done + +rm ${quant_ppm} diff --git a/test/bmp-roundtrip.ok b/test/bmp-roundtrip.ok index 67f7a1fe..4f4f8367 100644 --- a/test/bmp-roundtrip.ok +++ b/test/bmp-roundtrip.ok @@ -1,2 +1,20 @@ -1926073387 101484 +PBM +2425386270 41 +2425386270 41 +2425386270 41 2425386270 41 +PPM +1926073387 101484 +1926073387 101484 +1926073387 101484 +1926073387 101484 +PGM +1571496937 33838 +1571496937 33838 +1571496937 33838 +1571496937 33838 +1571496937 33838 +1571496937 33838 +1571496937 33838 +1571496937 33838 +1571496937 33838 diff --git a/test/bmp-roundtrip.test b/test/bmp-roundtrip.test index be9a4548..c9ef363a 100755 --- a/test/bmp-roundtrip.test +++ b/test/bmp-roundtrip.test @@ -1,7 +1,42 @@ #! /bin/bash # This script tests: bmptopnm ppmtobmp -# Also requires: +# Also requires: pamchannel pamtopnm pamseq +tmpdir=${tmpdir:-/tmp} -ppmtobmp testimg.ppm | bmptopnm | cksum -ppmtobmp testgrid.pbm | bmptopnm | cksum +# Test 1. Should print 2425386270 41 four times + +echo PBM + +for mode in "" "-bpp=1" "-windows" "-os2" + do + ppmtobmp ${mode} testgrid.pbm | bmptopnm | cksum + done + +# Test 2. Should print 1926073387 101484 four times + +echo PPM + +for mode in "" "-bpp=24" "-windows" "-os2" + do + ppmtobmp ${mode} testimg.ppm | bmptopnm | cksum + done + +# Test 3. Should print 1571496937 33838 nine times + +echo PGM + +red_pgm=${tmpdir}/red.pgm +mapfile_pgm=${tmpdir}/mapfile.pgm +pamseq -tupletype="GRAYSCALE" 1 255 > ${mapfile_pgm} + +pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 | \ + pamtopnm | tee ${red_pgm} | cksum + +for mode in "" "-bpp=8" "-windows" "-os2" + do + ppmtobmp ${mode} ${red_pgm} | bmptopnm | cksum + ppmtobmp ${mode} -mapfile=${mapfile_pgm} ${red_pgm} | bmptopnm | cksum + done + +rm ${mapfile_pgm} ${red_pgm} \ No newline at end of file diff --git a/test/cut-cat-roundtrip.ok b/test/cut-cat-roundtrip.ok new file mode 100644 index 00000000..bc9b8cb4 --- /dev/null +++ b/test/cut-cat-roundtrip.ok @@ -0,0 +1,92 @@ +Test 1. +1926073387 101484 +1926073387 101484 +1926073387 101484 +1926073387 101484 +1926073387 101484 +1926073387 101484 +Test 2. +3891261972 202953 +3891261972 202953 +3891261972 202953 +3891261972 202953 +3891261972 202953 +3891261972 202953 +Test 3. +1926073387 101484 +1926073387 101484 +1926073387 101484 +1926073387 101484 +1926073387 101484 +Test 4. +26789469 202953 +26789469 202953 +26789469 202953 +26789469 202953 +26789469 202953 +Test 5. +2425386270 41 +2425386270 41 +2425386270 41 +2425386270 41 +2425386270 41 +2425386270 41 +2425386270 41 +2425386270 41 +2425386270 41 +2425386270 41 +2425386270 41 +2425386270 41 +2425386270 41 +2425386270 41 +Test 6. +1887700557 73 +1887700557 73 +1887700557 73 +1887700557 73 +1887700557 73 +1887700557 73 +1887700557 73 +1887700557 73 +1887700557 73 +1887700557 73 +1887700557 73 +1887700557 73 +1887700557 73 +1887700557 73 +1887700557 73 +Test 7. +2425386270 41 +2425386270 41 +2425386270 41 +2425386270 41 +2425386270 41 +2425386270 41 +2425386270 41 +2425386270 41 +2425386270 41 +2425386270 41 +2425386270 41 +2425386270 41 +2425386270 41 +2425386270 41 +2425386270 41 +2425386270 41 +Test 8. +3221289196 73 +3221289196 73 +3221289196 73 +3221289196 73 +3221289196 73 +3221289196 73 +3221289196 73 +3221289196 73 +3221289196 73 +3221289196 73 +3221289196 73 +3221289196 73 +3221289196 73 +3221289196 73 +3221289196 73 +3221289196 73 +3221289196 73 diff --git a/test/cut-cat-roundtrip.test b/test/cut-cat-roundtrip.test new file mode 100755 index 00000000..95ee5279 --- /dev/null +++ b/test/cut-cat-roundtrip.test @@ -0,0 +1,128 @@ +#! /bin/bash +# This script tests: pamcut +# Also requires: pnmcat pnmpad + +tmpdir=${tmpdir:-/tmp} +quant_ppm=${tmpdir}/quant.ppm + +right_pbm=${tmpdir}/right.pbm +left_pbm=${tmpdir}/left.pbm +right_ppm=${tmpdir}/right.ppm +left_ppm=${tmpdir}/left.ppm +bottom_pbm=${tmpdir}/bottom.pbm +top_pbm=${tmpdir}/top.pbm +bottom_ppm=${tmpdir}/bottom.ppm +top_ppm=${tmpdir}/top.ppm + + +# Test 1. Should print 1926073387 101484 six times +echo Test 1. + +cat testimg.ppm | cksum +for i in 0 1 128 224 225 + do + pamcut -left=$((i+1)) testimg.ppm > ${right_ppm} + pamcut -right=$i testimg.ppm > ${left_ppm} + pnmcat -lr ${left_ppm} ${right_ppm} | \ + pamcut -left=0 -width=227| cksum + rm ${left_ppm} ${right_ppm} + done + + +# Test 2. Should print 3891261972 202953 six times +# Not roundtrip. Padding added to right. +echo Test 2. + +pnmpad -right=227 -black testimg.ppm | cksum +for i in 0 1 128 224 225 + do + pamcut -left=$((i+1)) -width=227 -pad testimg.ppm > ${right_ppm} + pamcut -right=$i -width=227 -pad testimg.ppm > ${left_ppm} + pnmcat -lr ${left_ppm} ${right_ppm} ${left_ppm} | \ + pamcut -left=$((227-i-1)) -width=$((227*2)) | cksum + rm ${left_ppm} ${right_ppm} + done + + +# Test 3. Should print 1926073387 101484 five times +echo Test 3. + +cat testimg.ppm | cksum +for i in 0 1 70 147 + do + pamcut -top=$((i+1)) testimg.ppm > ${bottom_ppm} + pamcut -bottom=$i testimg.ppm > ${top_ppm} + pnmcat -tb ${top_ppm} ${bottom_ppm} | \ + pamcut -top=0 -height=149 | cksum + rm ${top_ppm} ${bottom_ppm} + done + +# Test 4. Should print 26789469 202953 five times +# Not roundtrip. Padding added to bottom. +echo Test 4. + +pnmpad -bottom=149 -black testimg.ppm | cksum +for i in 0 1 70 147 + do + pamcut -top=$((i+1)) -height=149 -pad testimg.ppm > ${bottom_ppm} + pamcut -bottom=$i -height=149 -pad testimg.ppm > ${top_ppm} + pnmcat -tb ${top_ppm} ${bottom_ppm} ${top_ppm} | \ + pamcut -top=$((149-i-1)) -height=$((149*2)) | cksum + rm ${top_ppm} ${bottom_ppm} + done + +# Test 5. Should print 2425386270 41 fourteen times +echo Test 5. + +cat testgrid.pbm | cksum +for i in `seq 0 12` + do + pamcut -left=$((i+1)) testgrid.pbm > ${right_pbm} + pamcut -right=$i testgrid.pbm > ${left_pbm} + pnmcat -lr ${left_pbm} ${right_pbm} | \ + pamcut -left=0 -width=14 | cksum + rm ${left_pbm} ${right_pbm} + done + + +# Test 6. Should print 1887700557 73 fifteen times +# Not roundtrip. Padding added to right. +echo Test 6. + +pnmpad -right=14 -black testgrid.pbm | cksum +for i in `seq 0 13` + do + pamcut -left=$((i+1)) -width=14 -pad testgrid.pbm > ${right_pbm} + pamcut -right=$i -width=14 -pad testgrid.pbm > ${left_pbm} + pnmcat -lr ${left_pbm} ${right_pbm} ${left_pbm} | \ + pamcut -left=$((14-i-1)) -width=28 | cksum + rm ${left_pbm} ${right_pbm} + done + +# Test 7. Should print 2425386270 41 sixteen times +echo Test 7. + +cat testgrid.pbm | cksum +for i in `seq 0 14` + do + pamcut -top=$((i+1)) testgrid.pbm > ${bottom_pbm} + pamcut -bottom=$i testgrid.pbm > ${top_pbm} + pnmcat -tb ${top_pbm} ${bottom_pbm} | \ + pamcut -top=0 -height=16 | cksum + rm ${top_pbm} ${bottom_pbm} + done + +# Test 8. Should print 3221289196 73 seventeen times +# Not roundtrip. Padding added to bottom. +echo Test 8. + +pnmpad -bottom=16 -black testgrid.pbm | cksum +for i in `seq 0 15` + do + pamcut -top=$((i+1)) -height=16 -pad testgrid.pbm > ${bottom_pbm} + pamcut -bottom=$i -height=16 -pad testgrid.pbm > ${top_pbm} + pnmcat -tb ${top_pbm} ${bottom_pbm} ${top_pbm} | \ + pamcut -top=$((16-i-1)) -height=32 | cksum + rm ${top_pbm} ${bottom_pbm} + done + diff --git a/test/enlarge-reduce-roundtrip.ok b/test/enlarge-reduce-roundtrip.ok new file mode 100644 index 00000000..8ee8118a --- /dev/null +++ b/test/enlarge-reduce-roundtrip.ok @@ -0,0 +1,17 @@ +2364818683 590 +2364818683 590 +2364818683 590 +2364818683 590 +2364818683 590 +2364818683 590 +2364818683 590 +2364818683 590 +2364818683 590 +2364818683 590 +2364818683 590 +2364818683 590 +2364818683 590 +2364818683 590 +2364818683 590 +2364818683 590 +2364818683 590 diff --git a/test/enlarge-reduce-roundtrip.test b/test/enlarge-reduce-roundtrip.test new file mode 100755 index 00000000..54b52c60 --- /dev/null +++ b/test/enlarge-reduce-roundtrip.test @@ -0,0 +1,34 @@ +#! /bin/bash +# This script tests: pamenlarge pbmpscale pbmreduce +# Also requires: pbmtext + +tmpdir=${tmpdir:-/tmp} +xanadu_pbm=${tmpdir}/xanadu.pbm + +echo "In Xanadu did Kubla khan" | pbmtext > ${xanadu_pbm} + +# Should print 2364818683 590 + +cat ${xanadu_pbm} | cksum + +# Should print 2364818683 590 eight times + +for scale in 2 4 6 7 + do + for flag in "-fs -randomseed=0" "-threshold -v 0.4" + do + pamenlarge ${scale} ${xanadu_pbm} | pbmreduce ${flag} ${scale} | cksum + done + done + +# Should print 2364818683 590 eight times + +for scale in 5 7 9 11 + do + for flag in "-fs -randomseed=0" "-threshold" + do + pbmpscale ${scale} ${xanadu_pbm} | pbmreduce ${flag} ${scale} | cksum + done + done + +rm ${xanadu_pbm} diff --git a/test/fiasco-roundtrip.ok b/test/fiasco-roundtrip.ok new file mode 100644 index 00000000..544093d3 --- /dev/null +++ b/test/fiasco-roundtrip.ok @@ -0,0 +1 @@ + 3 1000.00 1000.00 1000.00 \ No newline at end of file diff --git a/test/fiasco-roundtrip.test b/test/fiasco-roundtrip.test new file mode 100755 index 00000000..8325a37d --- /dev/null +++ b/test/fiasco-roundtrip.test @@ -0,0 +1,23 @@ +#! /bin/bash +# This script tests: pnmtofiasco fiascotopnm +# Also requires: pnmpad pnmpsnr + +# Pnmtofiasco: number of rows, cols in input file must be even +# Pnmpsnr output: 15.11 22.71 30.09 +# TODO: As in jpeg-rountrip.test the threshold has been determined +# without much thought. + +# Should print 3 1000.00 1000.00 1000.00 + +tmpdir=${tmpdir:-/tmp} +padded_ppm=${tmpdir}/padded.ppm + +pnmpad --black --bottom 1 --left 1 testimg.ppm > ${padded_ppm} && +pnmtofiasco --progress-meter 0 ${padded_ppm} | fiascotopnm | \ + pnmpsnr -machine - ${padded_ppm} | \ + awk '{printf("%3d %.2f %.2f %.2f", NF, + $1>14.0 ? 1000.00 : $1, + $2>21.0 ? 1000.00 : $2, + $3>29.0 ? 1000.00 : $3) }' + +rm ${padded_ppm} \ No newline at end of file diff --git a/test/g3-roundtrip.ok b/test/g3-roundtrip.ok index bb0b1cf6..603c9457 100644 --- a/test/g3-roundtrip.ok +++ b/test/g3-roundtrip.ok @@ -1,3 +1,13 @@ -0 -0 -0 +0 0 0 : 0 +0 0 0 : 0 +0 0 0 0 : 0 +0 0 0 : 0 +0 0 0 : 0 +0 0 0 0 : 0 +0 0 0 0 : 0 +0 0 0 : 0 +0 0 0 : 0 +0 0 0 : 0 +1777627284 265 +2985378006 3135 +3651878552 3135 diff --git a/test/g3-roundtrip.test b/test/g3-roundtrip.test index 47e20e1d..6e31c587 100755 --- a/test/g3-roundtrip.test +++ b/test/g3-roundtrip.test @@ -2,15 +2,60 @@ # This script tests: g3topbm pbmtog3 # Also requires: pnmcrop +tmpdir=${tmpdir:-/tmp} +complete256_pbm=${tmpdir}/complete256.pbm +widew_pbm=${tmpdir}/widew.pbm +wideb_pbm=${tmpdir}/wideb.pbm pbmtog3 -nofixedwidth testgrid.pbm | \ g3topbm -width=14 | cmp -s - testgrid.pbm -echo $? +echo ${PIPESTATUS[@]} ":" $? pbmtog3 -nofixedwidth -reversebits testgrid.pbm | \ g3topbm -width=14 -reversebits | cmp -s - testgrid.pbm -echo $? +echo ${PIPESTATUS[@]} ":" $? pbmtog3 testgrid.pbm | \ g3topbm | pnmcrop -white -right -bottom | \ - cmp -s - testgrid.pbm ; echo $? + cmp -s - testgrid.pbm ; echo ${PIPESTATUS[@]} ":" $? + +# works with gawk and mawk +# produce all possible 8-bit patterns + +LC_ALL=C awk 'BEGIN { print "P4"; # header + print "8 256"; + for (i=0;i<256;++i) # raster + printf("%c",i) }' > ${complete256_pbm} + +pbmtog3 -nofixedwidth ${complete256_pbm} | g3topbm -width=8 | \ + cmp -s - ${complete256_pbm} ; echo ${PIPESTATUS[@]} ":" $? + +pbmtog3 -reverse -nofixedwidth ${complete256_pbm} | \ +g3topbm -reversebits -width=8 | \ + cmp -s - ${complete256_pbm} ; echo ${PIPESTATUS[@]} ":" $? + +pbmtog3 -align8 ${complete256_pbm} | \ +g3topbm -width=1728 | pnmcrop -white -right | \ + cmp -s - ${complete256_pbm} ; echo ${PIPESTATUS[@]} ":" $? + +pbmtog3 -align16 ${complete256_pbm} | \ +g3topbm -width=1728 | pnmcrop -white -right | \ + cmp -s - ${complete256_pbm} ; echo ${PIPESTATUS[@]} ":" $? + +pbmmake -w 5000 5 > ${widew_pbm} +pbmtog3 -nofixedwidth ${widew_pbm} | g3topbm | \ + cmp -s - ${widew_pbm} ; echo ${PIPESTATUS[@]} ":" $? + +pbmtog3 -nofixedwidth ${widew_pbm} | \ +g3topbm -width=5000 | \ + cmp -s - ${widew_pbm} ; echo ${PIPESTATUS[@]} ":" $? + +pbmmake -b 5000 5 > ${wideb_pbm} +pbmtog3 -nofixedwidth ${wideb_pbm} | g3topbm | \ + cmp -s - ${wideb_pbm} ; echo ${PIPESTATUS[@]} ":" $? + +cat ${complete256_pbm} | cksum +cat ${wideb_pbm} | cksum +cat ${widew_pbm} | cksum + +rm ${complete256_pbm} ${wideb_pbm} ${widew_pbm} diff --git a/test/gif-quant-roundtrip.ok b/test/gif-quant-roundtrip.ok index 573541ac..b813e8db 100644 --- a/test/gif-quant-roundtrip.ok +++ b/test/gif-quant-roundtrip.ok @@ -1 +1 @@ -0 +0 0 0 : 0 diff --git a/test/gif-quant-roundtrip.test b/test/gif-quant-roundtrip.test index 8b911740..910fa369 100755 --- a/test/gif-quant-roundtrip.test +++ b/test/gif-quant-roundtrip.test @@ -13,6 +13,6 @@ quant_ppm=${tmpdir}/quant.ppm pnmquant ${colors} testimg.ppm > ${quant_ppm} && pamtogif ${quant_ppm} | giftopnm | \ cmp -s - ${quant_ppm} > /dev/null -echo $? +echo ${PIPESTATUS[@]} ":" $? rm ${quant_ppm} diff --git a/test/gif-roundtrip.ok b/test/gif-roundtrip.ok index 552bf90c..607ebd5c 100644 --- a/test/gif-roundtrip.ok +++ b/test/gif-roundtrip.ok @@ -3,9 +3,20 @@ 1571496937 33838 1571496937 33838 1571496937 33838 +1571496937 33838 2425386270 41 2425386270 41 2425386270 41 2425386270 41 2425386270 41 -P1 4 1 0101 \ No newline at end of file +P1 4 1 0101 +4030 : 0 0 0 0 : 0 , 4030 : 0 0 0 0 : 0 +4031 : 0 0 0 0 : 0 , 4031 : 0 0 0 0 : 0 +4097 : 0 0 0 0 : 0 , 4097 : 0 0 0 0 : 0 +238 : 0 0 0 0 : 0 , 238 : 0 0 0 0 : 0 +239 : 0 0 0 0 : 0 , 239 : 0 0 0 0 : 0 +240 : 0 0 0 0 : 0 , 240 : 0 0 0 0 : 0 +241 : 0 0 0 0 : 0 , 241 : 0 0 0 0 : 0 +255 : 0 0 0 0 : 0 , 255 : 0 0 0 0 : 0 +256 : 0 0 0 0 : 0 , 256 : 0 0 0 0 : 0 +257 : 0 0 0 0 : 0 , 257 : 0 0 0 0 : 0 diff --git a/test/gif-roundtrip.test b/test/gif-roundtrip.test index a6d0ec4c..1e6c7760 100755 --- a/test/gif-roundtrip.test +++ b/test/gif-roundtrip.test @@ -1,7 +1,6 @@ #! /bin/bash # This script tests: giftopnm pamtogif -# Also requires: ppmtorgb3 rgb3toppm pbmmake pnminvert - +# Also requires: ppmtorgb3 rgb3toppm pbmmake pnminvert pamcut pamdepth tmpdir=${tmpdir:-/tmp} @@ -33,12 +32,13 @@ rm ${test_ppm} ${test_grn} ${test_blu} ${out_red} ${out_grn} # Test 2. Should produce 1571496937 33838 # which is the result of cksum testimg.red -# four times +# five times test_gif=${tmpdir}/testimg.gif pamtogif ${test_red} | giftopnm | cksum pamtogif -interlace ${test_red} | giftopnm | cksum +pamtogif -noclear ${test_red} | giftopnm | cksum pamtogif -sort ${test_red} | tee ${test_gif} | \ giftopnm | cksum echo "junk" >> ${test_gif} && \ @@ -48,6 +48,7 @@ rm ${test_gif} ${test_red} # Test 3. Should produce 2425386270 41 five times. +# testgrid.pbm is too small for -noclear to take effect pamtogif testgrid.pbm | giftopnm | cksum pamtogif -nolzw testgrid.pbm | giftopnm | cksum @@ -56,11 +57,107 @@ pamtogif -alpha=testgrid.pbm testgrid.pbm | giftopnm | cksum pamtogif -transparent=white testgrid.pbm | giftopnm -alpha=- | \ pnminvert | cksum + # Test 4. # In this gif file the code length changes after the last image data. # Image data: 3 bits, end code 4 bits. # Should produce P1 4 1 0 1 0 1 pbmmake -g 4 1 | \ - pamtogif | giftopnm -plain | \ + pamtogif -verbose | giftopnm -plain | \ tr '\n' ' ' +echo "" + + +# Test 5. +# Test whether saturated code tables are handled correctly. +# Test input images which most use up the string code table or +# come close to doing so. + +# Should produce: +# 4030 0 , 4030 0 +# 4031 0 , 4031 0 +# 4097 0 , 4097 0 +# 238 0 , 238 0 +# 239 0 , 239 0 +# 240 0 , 240 0 +# 241 0 , 241 0 +# 255 0 , 255 0 +# 256 0 , 256 0 +# 257 0 , 257 0 + +test4097_pgm=${tmpdir}/testimg4097.pgm +test_pgm=${tmpdir}/testimg.pgm + +# The following awk script produces a PGM file with no repeated sequences. +# Here is a smaller example with the same property: +# P2 +# 8 8 +# 7 +# 0 0 1 1 0 2 2 0 +# 3 3 0 4 4 0 5 5 +# 0 6 6 0 7 7 1 2 +# 1 3 1 4 1 5 1 6 +# 1 7 2 3 2 4 2 5 +# 2 6 2 7 3 4 3 5 +# 3 6 3 7 4 5 4 6 +# 4 7 5 6 5 7 6 7 + +maxval=63 +awk -v maxval=${maxval} 'BEGIN \ +{ print "P2" + print "1 "(maxval+1) * (maxval+1) +1 + print maxval + print 0 + for (j=i+1; j<=maxval; ++j) + {print 0; print j; print j } + for (i=1; i<=maxval; ++i) + for (j=i+1; j<=maxval; ++j) + {print i; print j } + print 0 +}' > ${test4097_pgm} + +for size in 4030 4031 4097 + do + pamcut -height ${size} ${test4097_pgm} > ${test_pgm} && + pamtogif -verbose ${test_pgm} | giftopnm | pamdepth ${maxval} | \ + cmp - ${test_pgm} + # pamdepth ${maxval} is necessary because + # giftopnm output is maxval 255 + echo -n ${size} ":" ${PIPESTATUS[@]} ":" $? ", " + pamtogif -nolzw ${test_pgm} | giftopnm | pamdepth ${maxval} | \ + cmp - ${test_pgm} + echo ${size} ":" ${PIPESTATUS[@]} ":" $? + rm ${test_pgm} + done + +rm ${test4097_pgm} +test257_pgm=${tmpdir}/testimg257.pgm + +maxval=15 +awk -v maxval=${maxval} 'BEGIN \ +{ print "P2" + print "1 "(maxval+1) * (maxval+1) +1 + print maxval + print 0 + for (j=i+1; j<=maxval; ++j) + {print 0; print j; print j } + for (i=1; i<=maxval; ++i) + for (j=i+1; j<=maxval; ++j) + {print i; print j } + print 0 +}' > ${test257_pgm} + +for size in 238 239 240 241 255 256 257 + do + pamcut -height=${size} ${test257_pgm} > ${test_pgm} && + pamtogif -verbose ${test_pgm} | giftopnm | pamdepth ${maxval} | \ + cmp - ${test_pgm} + echo -n ${size} ":" ${PIPESTATUS[@]} ":" $? ", " + pamtogif -nolzw -verbose ${test_pgm} | giftopnm | pamdepth ${maxval} | \ + cmp - ${test_pgm} + echo ${size} ":" ${PIPESTATUS[@]} ":" $? + rm ${test_pgm} + done + +rm ${test257_pgm} diff --git a/test/jbig-roundtrip.test b/test/jbig-roundtrip.test index 5e96a001..570d7336 100755 --- a/test/jbig-roundtrip.test +++ b/test/jbig-roundtrip.test @@ -2,7 +2,6 @@ # This script tests: pnmtojbig jbigtopnm # Also requires: pamchannel pamtopnm - # Test 1. Should print 2425386270 41 pnmtojbig testgrid.pbm | jbigtopnm | cksum diff --git a/test/jpeg-roundtrip.ok b/test/jpeg-roundtrip.ok new file mode 100644 index 00000000..5551f78e --- /dev/null +++ b/test/jpeg-roundtrip.ok @@ -0,0 +1,3 @@ +match +match +match diff --git a/test/jpeg-roundtrip.test b/test/jpeg-roundtrip.test new file mode 100755 index 00000000..7cc0fc20 --- /dev/null +++ b/test/jpeg-roundtrip.test @@ -0,0 +1,19 @@ +#! /bin/bash +# This script tests: pnmtojpeg jpegtopnm +# Also requires: pnmpsnr + +# TODO: threshold has been determined without much thought. +# Observed pnmpsnr output: 56.20 58.26 49.38 +# On another system: 54.73 49.41 44.52 +# A small margin has been added to the above numbers. + +# Should print "match" three times + +pnmtojpeg testimg.ppm | jpegtopnm | \ + pnmpsnr -target1=54 -target2=49 -target3=44 - testimg.ppm + +pnmtojpeg testimg.ppm -opt | jpegtopnm | \ + pnmpsnr -target1=54 -target2=49 -target3=44 - testimg.ppm + +pnmtojpeg testimg.ppm -progressive | jpegtopnm | \ + pnmpsnr -target1=54 -target2=49 -target3=44 - testimg.ppm diff --git a/test/jpeg2k-roundtrip.ok b/test/jpeg2k-roundtrip.ok new file mode 100644 index 00000000..82eac5a8 --- /dev/null +++ b/test/jpeg2k-roundtrip.ok @@ -0,0 +1 @@ +1926073387 101484 diff --git a/test/jpeg2k-roundtrip.test b/test/jpeg2k-roundtrip.test new file mode 100755 index 00000000..0995849d --- /dev/null +++ b/test/jpeg2k-roundtrip.test @@ -0,0 +1,7 @@ +#! /bin/bash +# This script tests: pamtojpeg2k jpeg2ktopam +# Also requires: + +# Should produce 1926073387 101484 + +pamtojpeg2k testimg.ppm | jpeg2ktopam | cksum \ No newline at end of file diff --git a/test/legacy-names.ok b/test/legacy-names.ok index 9676639b..94ef875f 100644 --- a/test/legacy-names.ok +++ b/test/legacy-names.ok @@ -4,6 +4,8 @@ icontopbm: ok pamfixtrunc: ok pamrgbatopng: ok pbmtoicon: ok +pbmtox10bm: ok +pgmcrater: ok pgmedge: ok pgmnorm: ok pgmoil: ok @@ -17,21 +19,21 @@ pnmenlarge: ok pnmfile: ok pnmflip: ok pnminterp: ok +pnmnoraw: ok pnmscale: ok pnmsplit: ok pnmtofits: ok +pnmtoplainpnm: ok pnmtopnm: ok pnmtotiff: ok ppmnorm: ok +ppmquant: ok +ppmquantall: ok ppmtogif: ok ppmtojpeg: ok +ppmtomap: ok ppmtompeg: ok ppmtotga: ok ppmtouil: ok -pgmcrater: ok -pbmtox10bm: ok -pnmnoraw: ok -pnmtoplainpnm: ok -ppmquant: ok -ppmquantall: ok hpcdtoppm: ok +pcdovtoppm: ok diff --git a/test/legacy-names.test b/test/legacy-names.test index df40e62d..5a65615f 100755 --- a/test/legacy-names.test +++ b/test/legacy-names.test @@ -10,6 +10,12 @@ ## ## Important: This test checks obsoleted names. ## Programs here do not appear in other tests. +## +## Programs here are wrapper scripts provided for backward compatibility. +## The newer replacement program may be the cause of any failure reported. +## +## If you run the "make test-install" on an older version, some executables +## may be reported as missing because of missing features. # Skip this test if CHECK_TYPE = tree @@ -55,6 +61,8 @@ ordinary_testprogs="\ pamfixtrunc \ pamrgbatopng \ pbmtoicon \ + pbmtox10bm \ + pgmcrater \ pgmedge \ pgmnorm \ pgmoil \ @@ -68,65 +76,59 @@ ordinary_testprogs="\ pnmfile \ pnmflip \ pnminterp \ + pnmnoraw \ pnmscale \ pnmsplit \ pnmtofits \ + pnmtoplainpnm \ pnmtopnm \ pnmtotiff \ ppmnorm \ + ppmquant \ + ppmquantall \ ppmtogif \ ppmtojpeg \ + ppmtomap \ ppmtompeg \ ppmtotga \ ppmtouil \ " -for i in $ordinary_testprogs - do - $i --version 2>&1 | \ - egrep -v \ - "(Using libnetpbm|Compiled|(BSD|SYSV|MSDOS|AMIGA) defined|RGB_?ENV=)" \ - 1>&2; - testExitStatus $i 0 ${PIPESTATUS[0]} - done - - -# Test pgmcrater - -pgmcrater -number 1 -xsize 15 -ysize 15 -randomseed 1 > /dev/null -testExitStatus pgmcrater 0 $? - +# Switch to control output from "program --version" +# See comments in all-in-place.test -# Test pbmtox10bm, pnmnoraw, pnmtoplainpnm, ppmquantall, ppmrainbow -# with trivial input. - -$i ${tmpdir}/test.pbm > /dev/null 2> /dev/null; -tmpdir=${tmpdir:-/tmp} -test_pbm=${tmpdir}/test.pbm - -cat > ${test_pbm} <<EOF -P1 -1 1 -1 -EOF - -for i in pbmtox10bm pnmnoraw pnmtoplainpnm - do - $i ${tmpdir}/test.pbm > /dev/null 2> /dev/null; - testExitStatus $i 0 $? - done +if [ ${CHECK_TYPE} = "install" ] + then grepOption[1]="" ; # Output --version message + else grepOption[0]="-v" ; # Suppress output +fi -for i in ppmquant ppmquantall +for i in $ordinary_testprogs do - $i 2 ${tmpdir}/test.pbm > /dev/null 2> /dev/null; - testExitStatus $i 0 $? + # Stub out programs that aren't built. + Available-Testprog "$i" + if [ $? = 1 ]; then + echo "$i: program was not built" 1>&2 + echo "$i: ok" + continue + fi + + $i --version < /dev/null 2>&1 | \ + egrep -v -e "fiascotopnm" -e \ + ": ((BSD|SYSV|MSDOS|AMIGA) defined|RGB_?ENV=)" | \ + egrep ${grepOption[$grepSwitch]} -e \ + ": (Using lib(net)?pbm|(Built (by|at)|Compiled ))" 1>&2; + # See showVersion() in lib/libpm.c for the above regular expressions. + + exitStatus=${PIPESTATUS[0]} + testExitStatus $i 0 ${exitStatus} done -rm ${test_pbm} - -# Test hpcdtoppm. Simply confirm its existence. +# Test hpcdtoppm and pcdovtoppm. Simply confirm their existence. type -p hpcdtoppm > /dev/null testExitStatus hpcdtoppm 0 $? + +type -p pcdovtoppm > /dev/null +testExitStatus pcdovtoppm 0 $? diff --git a/test/palm-roundtrip.ok b/test/palm-roundtrip.ok new file mode 100644 index 00000000..b9ea3056 --- /dev/null +++ b/test/palm-roundtrip.ok @@ -0,0 +1,11 @@ +Test 1 +584219238 236 +584219238 236 +584219238 236 +584219238 236 +584219238 236 +Test 2 +0 0 0 : 0 +0 0 0 : 0 +0 0 0 : 0 +0 0 0 : 0 diff --git a/test/palm-roundtrip.test b/test/palm-roundtrip.test new file mode 100755 index 00000000..b00454ca --- /dev/null +++ b/test/palm-roundtrip.test @@ -0,0 +1,39 @@ +#! /bin/bash +# This script tests: pnmtopalm palmtopnm +# Also requires: pamdepth pnmquant + +tmpdir=${tmpdir:-/tmp} +test4bit_pgm=${tmpdir}/test4bit.pgm +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 "" \ + "-scanline_compression" \ + "-rle_compression" \ + "-packbits_compression" + do pnmtopalm $flags ${test4bit_pgm} | palmtopnm | cksum; done + +rm ${test4bit_pgm} + + +# Test 2. Should print 0 4 times + +echo "Test 2" + +pnmquant 256 testimg.ppm > ${test256color_ppm} || echo "pnmquant failed" + +for flags in "" \ + "-scanline_compression" \ + "-rle_compression" \ + "-packbits_compression" + do pnmtopalm -colormap $flags ${test256color_ppm} | palmtopnm | \ + cmp -s - ${test256color_ppm} > /dev/null + echo ${PIPESTATUS[@]} ":" $? + done + +rm ${test256color_ppm} diff --git a/test/palm-roundtrip2.ok b/test/palm-roundtrip2.ok new file mode 100644 index 00000000..0060d7b6 --- /dev/null +++ b/test/palm-roundtrip2.ok @@ -0,0 +1,5 @@ +438301914 101484 +438301914 101484 +438301914 101484 +438301914 101484 +438301914 101484 diff --git a/test/palm-roundtrip2.test b/test/palm-roundtrip2.test new file mode 100755 index 00000000..4c94df8c --- /dev/null +++ b/test/palm-roundtrip2.test @@ -0,0 +1,31 @@ +#! /bin/bash +# This script tests: pnmtopalm palmtopnm +# Also requires: pnmremap + +tmpdir=${tmpdir:-/tmp} +test256color_ppm=${tmpdir}/test256color.ppm + +if [ ${CHECK_TYPE} = install ] + then mapfile=$(netpbm-config --datadir)/palmcolor8.map + else mapfile=${PALMMAPDIR}/palmcolor8.map +fi + +if [ ! -f ${mapfile} ] + then + echo "Cannot find palmcolor8.map. Skipping." 1>&2 + exit 80; +fi + + +# Test. Should print 438301914 101484 +# 5 times + +pnmremap -mapfile=${mapfile} testimg.ppm | tee ${test256color_ppm} | cksum + +for flags in "" \ + "-scanline_compression" \ + "-rle_compression" \ + "-packbits_compression" + do pnmtopalm -colormap $flags ${test256color_ppm} | palmtopnm | cksum; done + +rm ${test256color_ppm} diff --git a/test/pamcut.ok b/test/pamcut.ok index 61ef99bc..b08bc531 100644 --- a/test/pamcut.ok +++ b/test/pamcut.ok @@ -1,4 +1,19 @@ +Test 1. 2958909756 124815 +Test 2. 1550940962 10933 +Test 3. 708474423 14 +708474423 14 +Test 4. +659346598 80124 +659346598 80124 +659346598 80124 +659346598 80124 +Test 5. +2425386270 41 +2425386270 41 +2425386270 41 +2425386270 41 +Test 6. 3412257956 129 diff --git a/test/pamcut.test b/test/pamcut.test index fd9185a3..9971b1a5 100755 --- a/test/pamcut.test +++ b/test/pamcut.test @@ -2,17 +2,46 @@ # This script tests: pamcut pbmmake # Also requires: - # Test 1. Should print 2958909756 124815 +echo Test 1. + pamcut -top 0 -left 0 -width 260 -height 160 \ -pad testimg.ppm | cksum # Test 2. Should print 1550940962 10933 +echo Test 2. + pamcut -top 200 -left 120 -width 40 -height 40 \ -pad testimg.ppm | cksum -# Test 3. Should print 708474423 14 +# Test 3. Should print 708474423 14 twice +echo Test 3. + pamcut -top 5 -left 5 -bottom 5 -right 5 testimg.ppm | cksum +pamcut -width 1 -height 1 -bottom 5 -right 5 testimg.ppm | cksum + + +# Test 4. Should print 659346598 80124 four times +echo Test 4. + +pamcut -croptop 10 -cropleft 10 -cropbottom 10 -cropright 10 testimg.ppm | \ + cksum +pamcut -top 10 -left 10 -bottom 138 -right 216 testimg.ppm | cksum +pamcut -top 10 -left 10 -bottom -11 -right -11 testimg.ppm | cksum +pamcut -top 10 -left 10 -width 207 -height 129 testimg.ppm | cksum + + +# Test 5. Should print 2425386270 41 four times +echo Test 5. + +pamcut -croptop 0 -cropleft 0 -cropbottom 0 -cropright 0 testgrid.pbm | \ + cksum +pamcut -top 0 -left 0 -bottom 15 -right 13 testgrid.pbm | cksum +pamcut -top 0 -left 0 -bottom -1 -right -1 testgrid.pbm | cksum +pamcut -top 0 -left 0 -width 14 -height 16 testgrid.pbm | cksum + + +# Test 6. Should print 3412257956 129 +echo Test 6. -# Test 4. Should print 3412257956 129 pbmmake -g 50 50 | pamcut 5 5 30 30 | cksum diff --git a/test/pamenlarge-pamscale-point.ok b/test/pamenlarge-pamscale-point.ok new file mode 100644 index 00000000..dea0a3a9 --- /dev/null +++ b/test/pamenlarge-pamscale-point.ok @@ -0,0 +1,9 @@ +1 0 0 : 0 +2 -filter=point 0 0 : 0 +3 -linear 0 0 : 0 +4 -nomix 0 0 : 0 +5 0 0 : 0 +7 0 0 : 0 +6 -nomix 0 0 : 0 +15 -nomix -linear 0 0 : 0 +24 -nomix 0 0 : 0 diff --git a/test/pamenlarge-pamscale-point.test b/test/pamenlarge-pamscale-point.test new file mode 100755 index 00000000..08b34bb7 --- /dev/null +++ b/test/pamenlarge-pamscale-point.test @@ -0,0 +1,36 @@ +#! /bin/bash +# This script tests: pamenlarge pamscale +# Also requires: + +tmpdir=${tmpdir:-/tmp} +enlarge_ppm=${tmpdir}/enlarge.ppm + +# When scale factor is an integer and the pamscale filter is point (default) +# pamenlarge and pamscale should produce identical output + +for option in 1 "2 -filter=point" "3 -linear" "4 -nomix" 5 + do + scale=${option% *} + pamenlarge $scale testimg.ppm > ${enlarge_ppm} + pamscale $option testimg.ppm | cmp -s - ${enlarge_ppm} + echo $option ${PIPESTATUS[@]} ":" $? + rm ${enlarge_ppm} + done + + +pamenlarge -xscale=7 -yscale=7 testimg.ppm > ${enlarge_ppm} +pamscale -xscale=7 -yscale=7 testimg.ppm | cmp -s - ${enlarge_ppm} +echo 7 ${PIPESTATUS[@]} ":" $? +rm ${enlarge_ppm} + + +enlarge_pbm=${tmpdir}/enlarge.pbm + +for option in "6 -nomix" "15 -nomix -linear" "24 -nomix" + do + scale=${option%% *} + pamenlarge $scale testgrid.pbm > ${enlarge_pbm} + pamscale $option testgrid.pbm | cmp -s - ${enlarge_pbm} + echo $option ${PIPESTATUS[@]} ":" $? + rm ${enlarge_pbm} + done diff --git a/test/pamenlarge-pbm.ok b/test/pamenlarge-pbm.ok new file mode 100644 index 00000000..dcc2da97 --- /dev/null +++ b/test/pamenlarge-pbm.ok @@ -0,0 +1,86 @@ +test 1 +1777627284 265 +2806322261 522 +1951888658 778 +3502911227 1034 +3041987260 1290 +2012524746 1546 +4279863183 1802 +3672763467 2058 +3994368242 2314 +4119105059 2570 +1760702195 2826 +2751077869 3082 +262508159 3339 +743430575 3595 +94950162 3851 +2113456870 4107 +1143977004 4363 +2167141643 4619 +1816864555 4875 +2848735506 5131 +600474914 5387 +3831078134 5643 +1848221383 5899 +test 2 +2525154083 7435 +2525154083 7435 +2525154083 7435 +1983944984 14347 +1983944984 14347 +1983944984 14347 +2319780757 20747 +2319780757 20747 +2319780757 20747 +141252239 26635 +141252239 26635 +141252239 26635 +2074950535 32012 +2074950535 32012 +2074950535 32012 +2906360922 36876 +2906360922 36876 +2906360922 36876 +1320535490 41228 +1320535490 41228 +1320535490 41228 +1972046289 45068 +1972046289 45068 +1972046289 45068 +2203980644 48396 +2203980644 48396 +2203980644 48396 +2060433297 51212 +2060433297 51212 +2060433297 51212 +912377848 53516 +912377848 53516 +912377848 53516 +3346570289 55308 +3346570289 55308 +3346570289 55308 +1851051473 56588 +1851051473 56588 +1851051473 56588 +1940412039 57356 +1940412039 57356 +1940412039 57356 +2001859943 57612 +2001859943 57612 +test 3 +1 2764166846 191 +2 971905193 244 +3 6339889 299 +4 3973389476 342 +5 530215023 403 +6 2124428491 451 +7 2999665126 507 +8 4073302787 539 +9 3877636246 612 +10 1762263341 663 +11 3034611851 717 +12 3339857159 760 +13 119666911 821 +14 4197425209 869 +15 1169924963 924 +16 1845126791 954 diff --git a/test/pamenlarge-pbm.test b/test/pamenlarge-pbm.test new file mode 100755 index 00000000..10c00ba0 --- /dev/null +++ b/test/pamenlarge-pbm.test @@ -0,0 +1,61 @@ +#! /bin/bash +# This script tests: pamenlarge +# Also requires: pbmmake pnmpad + +tmpdir=${tmpdir:-/tmp} +complete256_pbm=${tmpdir}/complete256.pbm + +# works with gawk and mawk +# produce all possible 8-bit patterns + +LC_ALL=C awk 'BEGIN { print "P4"; # header + print "8 256"; + for (i=0;i<256;++i) # raster + printf("%c",i) }' > ${complete256_pbm} + +# xscale factor should be tested to at least 21 (=13+8) + +# Test 1. +echo "test 1" + +for xs in `seq 23` + do + pamenlarge -xscale=$xs ${complete256_pbm} | cksum + done + +# Test 2. +echo "test 2" + +for xs1 in `seq 15` + do + xs2=$((30-$xs1)) + pamenlarge -xscale=$xs1 ${complete256_pbm} | pamenlarge -xscale=$xs2 | cksum + if [ $xs1 != $xs2 ]; then + pamenlarge -xscale=$xs2 ${complete256_pbm} | pamenlarge -xscale=$xs1 | cksum + fi + pamenlarge -xscale=$(($xs1 * $xs2)) ${complete256_pbm} | cksum + done + +rm ${complete256_pbm} + +# Test 3. +echo "test 3" + +test3_pbm=${tmpdir}/test3.pbm + +for width in `seq 16` + do + pbmmake -g ${width} 1 | pnmpad -top=1 -white | \ + pnmpad -bottom=1 -black > ${test3_pbm}.${width} + done + + for xscale in `seq 16` + do echo -n ${xscale} " " + for width in `seq 16` + do pamenlarge -xscale=${xscale} ${test3_pbm}.${width} ; done | cksum + # + # unlike most other tests we take the cksum of a composite PBM file + # + done + +rm ${test3_pbm}.[1-9] ${test3_pbm}.1[1-6] \ No newline at end of file diff --git a/test/pamfile.ok b/test/pamfile.ok index 57cc8cfd..c0d80c28 100644 --- a/test/pamfile.ok +++ b/test/pamfile.ok @@ -3,3 +3,10 @@ testgrid.pbm: PBM raw, 14 by 16 stdin: PGM raw, 227 by 149 maxval 255 stdin: PAM, 227 by 149 by 1 maxval 255 Tuple type: GRAYSCALE +stdin: 3 images +stdin: Image 0: PBM raw, 14 by 16 +stdin: Image 1: PBM raw, 14 by 16 +stdin: Image 2: PBM raw, 14 by 16 +227 149 +testimg.ppm: PPM RAW 227 149 3 255 RGB +stdin: PBM RAW 14 16 1 1 BLACKANDWHITE diff --git a/test/pamfile.test b/test/pamfile.test index ac927172..545a2289 100755 --- a/test/pamfile.test +++ b/test/pamfile.test @@ -7,3 +7,10 @@ pamfile testimg.ppm pamfile testgrid.pbm pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 | pamtopnm | pamfile pamchannel -tupletype="GRAYSCALE" -infile=testimg.ppm 0 | pamfile + +cat testgrid.pbm testgrid.pbm testgrid.pbm | pamfile -count +cat testgrid.pbm testgrid.pbm testgrid.pbm | pamfile -allimages + +pamfile -size testimg.ppm +pamfile -machine testimg.ppm +cat testgrid.pbm testimg.ppm testgrid.pbm | pamfile -machine diff --git a/test/pamfind.ok b/test/pamfind.ok new file mode 100644 index 00000000..dc0f95ed --- /dev/null +++ b/test/pamfind.ok @@ -0,0 +1,83 @@ +Test 1 +Locations containing tuple (43/43/43)/255: +(6, 0) +(6, 1) +(7, 0) +(7, 1) +(19, 184) +Locations containing tuple (210/57/41)/255: +(44, 109) +(96, 74) +(96, 75) +(100, 75) +(100, 76) +(100, 77) +(100, 78) +(101, 73) +(101, 74) +(101, 75) +(101, 76) +(101, 77) +(101, 78) +(102, 72) +Test 2 +Locations containing tuple (1)/1: +(0, 1) +(0, 3) +(0, 5) +(0, 7) +(0, 9) +(0, 11) +(0, 13) +(2, 1) +(2, 3) +(2, 5) +(2, 7) +(2, 9) +(2, 11) +(2, 13) +(4, 1) +(4, 3) +(4, 5) +(4, 7) +(4, 9) +(4, 11) +(4, 13) +(6, 1) +(6, 3) +(6, 5) +(6, 7) +(6, 9) +(6, 11) +(6, 13) +(8, 1) +(8, 3) +(8, 5) +(8, 7) +(8, 9) +(8, 11) +(8, 13) +(10, 1) +(10, 3) +(10, 5) +(10, 7) +(10, 9) +(10, 11) +(10, 13) +(12, 1) +(12, 3) +(12, 5) +(12, 7) +(12, 9) +(12, 11) +(12, 13) +(14, 1) +(14, 3) +(14, 5) +(14, 7) +(14, 9) +(14, 11) +(14, 13) +Test 3 +okay +okay diff --git a/test/pamfind.test b/test/pamfind.test new file mode 100755 index 00000000..39cb1437 --- /dev/null +++ b/test/pamfind.test @@ -0,0 +1,32 @@ +#! /bin/bash +# This script tests: pamfind +# Also requires: + +tmpdir=${tmpdir:-/tmp} +sorted0_res=${tmpdir}/pamfind_sorted0.res +sorted1_res=${tmpdir}/pamfind_sorted1.res + +# Test 1 +echo Test 1 +pamfind -color=grey17 testimg.ppm +pamfind -target=210,57,41 testimg.ppm + +# Test 2 +echo Test 2 +pamfind -target=1 testgrid.pbm + +# Test 3 +# The two outputs should be disjoint +echo Test 3 +pamfind -target=0 testgrid.pbm | sort > ${sorted0_res} +pamfind -target=1 testgrid.pbm | sort > ${sorted1_res} +comm -3 ${sorted0_res} ${sorted1_res} | + awk 'END {if (NR==226) print "okay"; + else printf("failure (line count=%d)\n", NR)}' +comm -12 ${sorted0_res} ${sorted1_res} | + awk '{print}; END { if(NR == 0) print "okay"; + else printf("failure (line count=%d)\n", NR)}' + +rm ${sorted0_res} ${sorted1_res} + + diff --git a/test/ppmgauss.ok b/test/pamgauss.ok index cf708d64..153d4f6e 100644 --- a/test/ppmgauss.ok +++ b/test/pamgauss.ok @@ -7,15 +7,15 @@ 171732531 55 448293386 55 3030522957 55 -757204806 62 -757204806 62 -2890088558 62 -4276668903 62 -1462902064 62 -4161772187 62 -2741154810 62 -417660035 62 -1026188683 62 +1912396937 62 +1912396937 62 +1912396937 62 +1912396937 62 +924437833 62 +2403224870 62 +1828243243 62 +3189486374 62 +3077695768 62 1236982144 71 1236982144 71 2668915323 71 @@ -25,15 +25,15 @@ 1741784255 71 2975827721 71 185899480 71 -1890880170 82 -1890880170 82 -2007282168 82 -2290578407 82 -3295586348 82 -3202728672 82 -3794283497 82 -1136760947 82 -2659761303 82 +685596179 82 +685596179 82 +685596179 82 +685596179 82 +3959781759 82 +3753883586 82 +3706474367 82 +2091709635 82 +651233877 82 3268058875 95 3268058875 95 4112134785 95 @@ -43,15 +43,15 @@ 3042873446 95 299128630 95 1852505233 95 -3614879265 110 -3614879265 110 -3727088180 110 -3861671574 110 -952180714 110 -1393452065 110 -1551903756 110 -2198775655 110 -3231547603 110 +2257309933 110 +2257309933 110 +2257309933 110 +2257309933 110 +3861656488 110 +130820705 110 +1706835660 110 +4285051006 110 +285426992 110 3184597171 127 3184597171 127 406519147 127 @@ -61,15 +61,15 @@ 1852779549 127 1734420920 127 2400421918 127 -3252995941 148 -3252995941 148 -2022176119 148 -473753498 148 -3178129210 148 -2278608777 148 -3169785704 148 -85136480 148 -2396646133 148 +3247957822 148 +3247957822 148 +3247957822 148 +3247957822 148 +3407897457 148 +1176192530 148 +3551192353 148 +557209968 148 +2437783856 148 1871459418 169 1871459418 169 639002491 169 diff --git a/test/ppmgauss.test b/test/pamgauss.test index 213810c7..b48517c4 100755 --- a/test/ppmgauss.test +++ b/test/pamgauss.test @@ -7,6 +7,6 @@ for i in `seq 3 11` do for s in `seq 1 9` do -pamgauss $i $i -sigma=.$s | cksum +pamgauss $i $i -oversample=1 -sigma=.$s | cksum done done diff --git a/test/pammixmulti-identity.ok b/test/pammixmulti-identity.ok new file mode 100644 index 00000000..9e712f7f --- /dev/null +++ b/test/pammixmulti-identity.ok @@ -0,0 +1,22 @@ +Test 1. +1926073387 101484 +1926073387 101484 +1926073387 101484 +1926073387 101484 +1926073387 101484 +1926073387 101484 +Test 2. +1926073387 101484 +1926073387 101484 +1926073387 101484 +Test 3. +1926073387 101484 +1926073387 101484 +1926073387 101484 +Test 4. +127 +127 +127 +127 +127 +127 diff --git a/test/pammixmulti-identity.test b/test/pammixmulti-identity.test new file mode 100755 index 00000000..d205c359 --- /dev/null +++ b/test/pammixmulti-identity.test @@ -0,0 +1,77 @@ +#! /bin/bash +# This script tests: pammixmulti +# Also requires: pgmnoise pnminvert pamsumm + +tmpdir=${tmpdir:-/tmp} + +# Test 1. Should print 1926073387 101484 six times +echo Test 1. + +pammixmulti testimg.ppm | cksum +pammixmulti testimg.ppm testimg.ppm | cksum +pammixmulti testimg.ppm testimg.ppm testimg.ppm | cksum +pammixmulti -blend=average testimg.ppm testimg.ppm | cksum +pammixmulti -blend=average testimg.ppm testimg.ppm testimg.ppm | cksum +pammixmulti -blend=random -randomseed=1 \ + testimg.ppm testimg.ppm testimg.ppm | cksum + + +# Test 2. Should print 1926073387 101484 three times +echo Test 2. + +mask_pgm=${tmpdir}/mask.pgm +pgmnoise -maxval=2 -randomseed=1 227 149 > ${mask_pgm} + +for sd in 0.5 1.2 3.0 + do + pammixmulti -blend=mask -maskfile=${mask_pgm} -stdev=${sd} \ + testimg.ppm testimg.ppm testimg.ppm | cksum + done +rm ${mask_pgm} + +# Test 3. Should print +echo Test 3. + +noise_pgm=${tmpdir}/noise.pgm +pgmnoise --randomseed=1 227 149 > ${noise_pgm} + +pammixmulti -blend=mask -maskfile=${noise_pgm} \ + testimg.ppm testimg.ppm | cksum +pammixmulti -blend=mask -maskfile=${noise_pgm} \ + testimg.ppm testimg.ppm testimg.ppm | cksum +pammixmulti -blend=mask -maskfile=${noise_pgm} \ + testimg.ppm testimg.ppm testimg.ppm testimg.ppm | cksum +rm ${noise_pgm} + + +# Test 4. + +# Mix image with its own inverse. +# Output should be a monotone gray sheet. +# Should print 127 six times +echo Test 4. + +invert_ppm=${tmpdir}/invert.ppm +monotone_ppm=${tmpdir}/monotone.ppm + +pnminvert testimg.ppm > ${invert_ppm} + +pammixmulti -blend=average testimg.ppm ${invert_ppm} | tee ${monotone_ppm} | \ + pamsumm -brief -max && + pamsumm -brief -min ${monotone_ppm} +rm ${monotone_ppm} + +pammixmulti -blend=average \ + testimg.ppm ${invert_ppm} testimg.ppm ${invert_ppm} | \ + tee ${monotone_ppm} | \ + pamsumm -brief -max && + pamsumm -brief -min ${monotone_ppm} +rm ${monotone_ppm} + +pammixmulti -blend=average \ + testimg.ppm testimg.ppm ${invert_ppm} ${invert_ppm} | \ + tee ${monotone_ppm} | \ + pamsumm -brief -max && + pamsumm -brief -min ${monotone_ppm} + +rm ${monotone_ppm} ${invert_ppm} diff --git a/test/pamscale-filters1.ok b/test/pamscale-filters1.ok new file mode 100644 index 00000000..083505ee --- /dev/null +++ b/test/pamscale-filters1.ok @@ -0,0 +1,15 @@ +4 box: +match +match +9 triangle: +match +match +4 quadratic: +match +match +10 cubic: +match +match +4 catrom: +match +match diff --git a/test/pamscale-filters1.test b/test/pamscale-filters1.test new file mode 100755 index 00000000..63e0d012 --- /dev/null +++ b/test/pamscale-filters1.test @@ -0,0 +1,64 @@ +#! /bin/bash +# This script tests: pamscale pamenlarge +# Also requires: pamvalidate pnmpsnr + +tmpdir=${tmpdir:-/tmp} +enlarge_ppm=${tmpdir}/enlarge.ppm + +width_height=`pamfile -size testimg.ppm | \ + awk '{print "-width="$1, "-height="$2}'` + +# The target values here were determined by running the test on a +# 32-bit GNU/Linux system and subtracting 2.5 (dB) from observed +# values. + +pamenlarge 4 testimg.ppm | pamvalidate > ${enlarge_ppm} +echo 4 box: +pamscale 4 -filter=box testimg.ppm | \ + pnmpsnr -target1=35.67 -target2=49.25 -target3=43.28 - ${enlarge_ppm} || \ + echo failure ${PIPESTATUS[@]} ":" $? + +pamscale ${width_height} -filter=point ${enlarge_ppm} | \ + pnmpsnr -target1=1000 -target2=1000 -target3=1000 testimg.ppm - || \ + echo failure ${PIPESTATUS[@]} ":" $? +rm ${enlarge_ppm} + +pamenlarge 9 testimg.ppm | pamvalidate > ${enlarge_ppm} +echo 9 triangle: +pamscale 9 -filter=triangle testimg.ppm | \ + pnmpsnr -target1=35.27 -target2=49.06 -target3=43.11 - ${enlarge_ppm} || \ + echo failure ${PIPESTATUS[@]} ":" $? +pamscale ${width_height} -filter=triangle ${enlarge_ppm} | \ + pnmpsnr -target1=41.52 -target2=56.96 -target3=52.68 testimg.ppm - || \ + echo failure ${PIPESTATUS[@]} ":" $? +rm ${enlarge_ppm} + +pamenlarge 4 testimg.ppm | pamvalidate > ${enlarge_ppm} +echo 4 quadratic: +pamscale 4 -filter=quadratic testimg.ppm | \ + pnmpsnr -target1=35.39 -target2=49.36 -target3=43.46 - ${enlarge_ppm} || \ + echo failure ${PIPESTATUS[@]} ":" $? +pamscale ${width_height} -filter=quadratic ${enlarge_ppm} | \ + pnmpsnr -target1=39.34 -target2=55.24 -target3=50.65 testimg.ppm - || \ + echo failure ${PIPESTATUS[@]} ":" $? +rm ${enlarge_ppm} + +pamenlarge 10 testimg.ppm | pamvalidate > ${enlarge_ppm} +echo 10 cubic: +pamscale 10 -filter=cubic testimg.ppm | \ + pnmpsnr -target1=34.39 -target2=48.45 -target3=42.52 - ${enlarge_ppm} || \ + echo failure ${PIPESTATUS[@]} ":" $? +pamscale ${width_height} -filter=cubic ${enlarge_ppm} | \ + pnmpsnr -target1=37.7 -target2=53.84 -target3=48.96 testimg.ppm - || \ + echo failure ${PIPESTATUS[@]} ":" $? +rm ${enlarge_ppm} + +pamenlarge 4 testimg.ppm | pamvalidate > ${enlarge_ppm} +echo 4 catrom: +pamscale 4 -filter=catrom testimg.ppm | \ + pnmpsnr -target1=36.05 -target2=49.51 -target3=43.49 - ${enlarge_ppm} || \ + echo failure ${PIPESTATUS[@]} ":" $? +pamscale ${width_height} -filter=catrom ${enlarge_ppm} | \ + pnmpsnr -target1=46.5 -target2=60.68 -target3=57.8 testimg.ppm - || \ + echo failure ${PIPESTATUS[@]} ":" $? +rm ${enlarge_ppm} diff --git a/test/pamscale-filters2.ok b/test/pamscale-filters2.ok new file mode 100644 index 00000000..b8d51d37 --- /dev/null +++ b/test/pamscale-filters2.ok @@ -0,0 +1,24 @@ +-xscale=4 -yscale=3 mitchell: +match +match +-xscale=3 -yscale=4 gauss: +match +match +-xscale=2 -yscale=2 sinc: +match +match +-xscale=2 -yscale=4 bessel: +match +match +-xscale=3 -yscale=3 hanning: +match +match +-xscale=5 -yscale=5 hamming: +match +match +5.85 blackman: +match +match +5.10 kaiser: +match +match diff --git a/test/pamscale-filters2.test b/test/pamscale-filters2.test new file mode 100755 index 00000000..f7370020 --- /dev/null +++ b/test/pamscale-filters2.test @@ -0,0 +1,97 @@ +#! /bin/bash +# This script tests: pamscale pamstretch pamstretch-gen +# Also requires: pamvalidate pnmpsnr + +tmpdir=${tmpdir:-/tmp} +stretch_ppm=${tmpdir}/stretch.ppm + +width_height=`pamfile -size testimg.ppm | \ + awk '{print "-width="$1, "-height="$2}'` + +pamstretch -xscale=4 -yscale=3 testimg.ppm | pamvalidate > ${stretch_ppm} +echo -xscale=4 -yscale=3 mitchell: +pamscale -xscale=4 -yscale=3 -filter=mitchell testimg.ppm | \ + pnmpsnr -target1=34.15 -target2=46.95 -target3=41.02 - ${stretch_ppm} || \ + echo failure ${PIPESTATUS[@]} ":" $? + +pamscale ${width_height} -filter=mitchell ${stretch_ppm} | \ + pnmpsnr -target1=33.36 -target2=46.74 -target3=40.79 testimg.ppm - || \ + echo failure ${PIPESTATUS[@]} ":" $? +rm ${stretch_ppm} + +pamstretch -xscale=3 -yscale=4 testimg.ppm | pamvalidate > ${stretch_ppm} +echo -xscale=3 -yscale=4 gauss: +pamscale -xscale=3 -yscale=4 -filter=gauss testimg.ppm | \ + pnmpsnr -target1=34.4 -target2=46.98 -target3=41.07 - ${stretch_ppm} || \ + echo failure ${PIPESTATUS[@]} ":" $? + +pamscale ${width_height} -filter=gauss ${stretch_ppm} | \ + pnmpsnr -target1=33.1 -target2=46.61 -target3=40.64 testimg.ppm - || \ + echo failure ${PIPESTATUS[@]} ":" $? +rm ${stretch_ppm} + +pamstretch -xscale=2 -yscale=2 testimg.ppm | pamvalidate > ${stretch_ppm} +echo -xscale=2 -yscale=2 sinc: +pamscale -xscale=2 -yscale=2 -filter=sinc testimg.ppm | \ + pnmpsnr -target1=36.27 -target2=49.39 -target3=43.62 - ${stretch_ppm} || \ + echo failure ${PIPESTATUS[@]} ":" $? + +pamscale ${width_height} -filter=sinc ${stretch_ppm} | \ + pnmpsnr -target1=36.23 -target2=49.47 -target3=43.69 testimg.ppm - || \ + echo failure ${PIPESTATUS[@]} ":" $? +rm ${stretch_ppm} + +pamstretch -xscale=2 -yscale=4 testimg.ppm | pamvalidate > ${stretch_ppm} +echo -xscale=2 -yscale=4 bessel: +pamscale -xscale=2 -yscale=4 -filter=bessel testimg.ppm | \ + pnmpsnr -target1=35.09 -target2=47.77 -target3=41.88 - ${stretch_ppm} || \ + echo failure ${PIPESTATUS[@]} ":" $? + +pamscale ${width_height} -filter=bessel ${stretch_ppm} | \ + pnmpsnr -target1=33.99 -target2=47.47 -target3=41.55 testimg.ppm - || \ + echo failure ${PIPESTATUS[@]} ":" $? +rm ${stretch_ppm} + +pamstretch -xscale=3 -yscale=3 testimg.ppm | pamvalidate > ${stretch_ppm} +echo -xscale=3 -yscale=3 hanning: +pamscale -xscale=3 -yscale=3 -filter=hanning testimg.ppm | \ + pnmpsnr -target1=34.73 -target2=47.42 -target3=41.54 - ${stretch_ppm} || \ + echo failure ${PIPESTATUS[@]} ":" $? + +pamscale ${width_height} -filter=hanning ${stretch_ppm} | \ + pnmpsnr -target1=33.86 -target2=47.24 -target3=41.29 testimg.ppm - || \ + echo failure ${PIPESTATUS[@]} ":" $? +rm ${stretch_ppm} + +pamstretch -xscale=5 -yscale=5 testimg.ppm | pamvalidate > ${stretch_ppm} +echo -xscale=5 -yscale=5 hamming: +pamscale -xscale=5 -yscale=5 -filter=hamming testimg.ppm | \ + pnmpsnr -target1=33.4 -target2=46.02 -target3=40.07 - ${stretch_ppm} || \ + echo failure ${PIPESTATUS[@]} ":" $? + +pamscale ${width_height} -filter=hamming ${stretch_ppm} | \ + pnmpsnr -target1=32.49 -target2=45.81 -target3=39.8 testimg.ppm - || \ + echo failure ${PIPESTATUS[@]} ":" $? +rm ${stretch_ppm} + +pamstretch-gen 5.85 testimg.ppm | pamvalidate > ${stretch_ppm} +echo 5.85 blackman: +pamscale 5.85 -filter=blackman testimg.ppm | \ + pnmpsnr -target1=34.29 -target2=48.78 -target3=42.75 - ${stretch_ppm} || \ + echo failure ${PIPESTATUS[@]} ":" $? + +pamscale ${width_height} -filter=blackman ${stretch_ppm} | \ + pnmpsnr -target1=33.69 -target2=48.83 -target3=42.72 testimg.ppm - || \ + echo failure ${PIPESTATUS[@]} ":" $? +rm ${stretch_ppm} + +pamstretch-gen 5.10 testimg.ppm | pamvalidate > ${stretch_ppm} +echo 5.10 kaiser: +pamscale 5.10 -filter=kaiser testimg.ppm | \ + pnmpsnr -target1=34.58 -target2=49.03 -target3=43.01 - ${stretch_ppm} || \ + echo failure ${PIPESTATUS[@]} ":" $? + +pamscale ${width_height} -filter=blackman ${stretch_ppm} | \ + pnmpsnr -target1=33.69 -target2=48.83 -target3=42.72 testimg.ppm - || \ + echo failure ${PIPESTATUS[@]} ":" $? +rm ${stretch_ppm} diff --git a/test/pamscale-filters3.ok b/test/pamscale-filters3.ok new file mode 100644 index 00000000..94d4ae96 --- /dev/null +++ b/test/pamscale-filters3.ok @@ -0,0 +1,7 @@ +failure : 0 +3.96 hermite: +match +match +2.75 lanczos: +match +match diff --git a/test/pamscale-filters3.test b/test/pamscale-filters3.test new file mode 100755 index 00000000..83198e2b --- /dev/null +++ b/test/pamscale-filters3.test @@ -0,0 +1,32 @@ +#! /bin/bash +# This script tests: pamscale pamstretch pamstretch-gen + # Also requires: pamvalidate pnmpsnr || \ + echo failure ${PIPESTATUS[@]} ":" $? + +tmpdir=${tmpdir:-/tmp} +stretch_ppm=${tmpdir}/stretch.ppm + +width_height=`pamfile -size testimg.ppm | \ + awk '{print "-width="$1, "-height="$2}'` + +pamstretch-gen 3.96 testimg.ppm | pamvalidate > ${stretch_ppm} +echo 3.96 hermite: +pamscale 3.96 -filter=hermite testimg.ppm | \ + pnmpsnr -target1=34.13 -target2=48.95 -target3=42.73 - ${stretch_ppm} || \ + echo failure ${PIPESTATUS[@]} ":" $? + +pamscale ${width_height} -filter=hermite ${stretch_ppm} | \ + pnmpsnr -target1=33.12 -target2=48.59 -target3=42.3 testimg.ppm - || \ + echo failure ${PIPESTATUS[@]} ":" $? +rm ${stretch_ppm} + +pamstretch-gen 2.75 testimg.ppm | pamvalidate > ${stretch_ppm} +echo 2.75 lanczos: +pamscale 2.75 -filter=lanczos testimg.ppm | \ + pnmpsnr -target1=32.93 -target2=48.28 -target3=41.89 - ${stretch_ppm} || \ + echo failure ${PIPESTATUS[@]} ":" $? + +pamscale ${width_height} -filter=lanczos ${stretch_ppm} | \ + pnmpsnr -target1=32.81 -target2=48.43 -target3=41.94 testimg.ppm - || \ + echo failure ${PIPESTATUS[@]} ":" $? +rm ${stretch_ppm} diff --git a/test/pamscale-reportonly.ok b/test/pamscale-reportonly.ok new file mode 100644 index 00000000..00152411 --- /dev/null +++ b/test/pamscale-reportonly.ok @@ -0,0 +1,18 @@ +227 149 3.000000 3.000000 681 447 +227 149 5.000000 5.000000 1135 745 +227 149 2.682819 2.684564 609 400 +227 149 2.819383 2.818792 640 420 +227 149 0.440529 0.442953 100 66 +227 149 0.167401 0.167785 38 25 +227 149 0.101322 0.100671 23 15 +227 149 2.819383 2.684564 640 400 +227 149 2.819383 2.684564 640 400 +227 149 2.819383 2.000000 640 298 +227 149 1.400881 2.684564 318 400 +227 149 1.000000 1.000000 227 149 +expected error +expected error +expected error +expected error +expected error +expected error diff --git a/test/pamscale-reportonly.test b/test/pamscale-reportonly.test new file mode 100755 index 00000000..7205be2f --- /dev/null +++ b/test/pamscale-reportonly.test @@ -0,0 +1,35 @@ +#! /bin/bash +# This script tests: pamscale +# Also requires: + +pamscale -reportonly 3 testimg.ppm +pamscale -reportonly 5 testimg.ppm +pamscale -reportonly -xysize 640 400 testimg.ppm +pamscale -reportonly -xyfill 640 400 testimg.ppm +pamscale -reportonly -xyfit 100 100 testimg.ppm +pamscale -reportonly -reduce 6 testimg.ppm +pamscale -reportonly -reduce 10 testimg.ppm +pamscale -reportonly -xsize=640 -ysize=400 testimg.ppm +pamscale -reportonly -width=640 -height=400 testimg.ppm +pamscale -reportonly -width=640 -yscale=2 testimg.ppm +pamscale -reportonly -xscale=1.4 -height=400 testimg.ppm +pamscale -reportonly -pixels=45000 testimg.ppm + +# expected error cases +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 +pamscale -reportonly -xsize=640 -ysize=400 -xscale=2 testimg.ppm || \ + echo expected error +pamscale -reportonly -xsize=640 -xscale=2 -yscale=3 testimg.ppm || \ + echo expected error +pamscale -reportonly -xsize=640 -ysize=400 -pixels=200000 testimg.ppm || \ + echo expected error +pamscale -reportonly -xsize=640 -ysize=400 -xysize 640 400 testimg.ppm || \ + echo expected error +pamscale -reportonly -xsize=640 -ysize=400 -xyfit 640 400 testimg.ppm || \ + echo expected error +pamscale -reportonly -xsize=640 -ysize=400 -xyfill 640 400 testimg.ppm || \ + echo expected error + diff --git a/test/pamstretch.ok b/test/pamstretch.ok new file mode 100644 index 00000000..3253cfd6 --- /dev/null +++ b/test/pamstretch.ok @@ -0,0 +1,20 @@ +test 1 +211995824 12277766 +test 2 +1361899 202953 +test 3 +2735552884 302379 +test 4 +3681010585 802767 +test 5 +1926073387 101484 +1926073387 101484 +1926073387 101484 +1926073387 101484 +test 6 +3638965616 913236 +598302847 913236 +220708621 903111 +3948746482 903111 +3948746482 903111 +220708621 903111 diff --git a/test/pamstretch.test b/test/pamstretch.test new file mode 100755 index 00000000..55dd4e9c --- /dev/null +++ b/test/pamstretch.test @@ -0,0 +1,48 @@ +#! /bin/bash +# This script tests: pamstretch +# Also requires: pamcut pamfile + +# Test 1. Should print 211995824 12277766 +echo test 1 +pamstretch 11 testimg.ppm | cksum + +# Test 2. Should print 1361899 202953 +echo test 2 + +pamstretch -xscale=2 -blackedge testimg.ppm | cksum + +# Test 3. Should print 3427416462 301047 +echo test 3 +dropedge1_ppm=${tmpdir}/drop1.ppm +pamstretch -yscale=3 -dropedge testimg.ppm | tee ${dropedge1_ppm} | cksum + +# Test 4. Should print 3681010585 802767 +echo test 4 +pamstretch -xscale=2 -yscale=4 -dropedge testimg.ppm | cksum + +# Test 5. Should print 1926073387 101484 four times +echo test 5 +pamstretch 1 testimg.ppm | cksum +pamstretch -xscale=1 -yscale=1 testimg.ppm | cksum +pamstretch 1 -dropedge testimg.ppm | cksum +pamstretch 1 -blackedge testimg.ppm | cksum + +# Test 6. +# Should print 3638965616 913236 , 598302847 913236 +# followed by 3948746482 903111 four times and finally +# -width=678 -height=444" + +echo test 6 +stretch_ppm=${tmpdir}/stretch.ppm +dropedge_ppm=${tmpdir}/drop.ppm +blackedge_ppm=${tmpdir}/black.ppm +pamstretch 3 testimg.ppm | tee ${stretch_ppm} | cksum +pamstretch 3 -blackedge testimg.ppm | tee ${blackedge_ppm} | cksum +pamstretch -xscale=3 -dropedge ${dropedge1_ppm} | tee ${dropedge_ppm} | cksum +width_height=`pamfile -size ${dropedge_ppm} | \ + awk '{print "-width="$1, "-height="$2}'` +pamcut -left=0 -top=0 ${width_height} ${stretch_ppm} | cksum +pamcut -left=0 -top=0 ${width_height} ${blackedge_ppm} | cksum +pamcut -left=0 -top=0 ${width_height} ${dropedge_ppm} | cksum + +rm ${stretch_ppm} ${dropedge_ppm} ${dropedge1_ppm} ${blackedge_ppm} \ No newline at end of file diff --git a/test/pamtable.ok b/test/pamtable.ok new file mode 100644 index 00000000..c8db6002 --- /dev/null +++ b/test/pamtable.ok @@ -0,0 +1,66 @@ +0 1 0 1 0 1 0 1 0 1 0 1 0 1 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 1 0 1 0 1 0 1 0 1 0 1 0 1 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 1 0 1 0 1 0 1 0 1 0 1 0 1 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 1 0 1 0 1 0 1 0 1 0 1 0 1 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 1 0 1 0 1 0 1 0 1 0 1 0 1 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 1 0 1 0 1 0 1 0 1 0 1 0 1 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 1 0 1 0 1 0 1 0 1 0 1 0 1 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 1 0 1 0 1 0 1 0 1 0 1 0 1 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +0 0 0|0 0 1|0 0 2|0 1 0|0 1 1|0 1 2|0 2 0|0 2 1|0 2 2|1 0 0|1 0 1|1 0 2|1 1 0|1 1 1|1 1 2|1 2 0|1 2 1|1 2 2|2 0 0|2 0 1|2 0 2|2 1 0|2 1 1|2 1 2|2 2 0|2 2 1|2 2 2 + +0 0 0 0|0 0 0 1|0 0 1 0|0 0 1 1|0 1 0 0|0 1 0 1|0 1 1 0|0 1 1 1|1 0 0 0|1 0 0 1|1 0 1 0|1 0 1 1|1 1 0 0|1 1 0 1|1 1 1 0|1 1 1 1 + +9 0 +0 9 + +0 0 0|4 4 4|9 9 9 +0 0 0|4 4 4|9 9 9 + +9 0 0|0 0 9|0 0 9|0 9 0 +9 0 0|0 0 9|0 0 9|0 9 0 + +10 0 + 0 10 + + 0 0 0| 5 5 5|10 10 10 + 0 0 0| 5 5 5|10 10 10 + +10 0 0| 0 0 10| 0 0 10| 0 10 0 +10 0 0| 0 0 10| 0 0 10| 0 10 0 + +9999 0 + 0 9999 + + 0 0 0|4980 4980 4980|9999 9999 9999 + 0 0 0|4980 4980 4980|9999 9999 9999 + +9999 0 0| 0 0 9999| 0 0 9999| 0 9999 0 +9999 0 0| 0 0 9999| 0 0 9999| 0 9999 0 + +10000 0 + 0 10000 + + 0 0 0| 4980 4980 4980|10000 10000 10000 + 0 0 0| 4980 4980 4980|10000 10000 10000 + +10000 0 0| 0 0 10000| 0 0 10000| 0 10000 0 +10000 0 0| 0 0 10000| 0 0 10000| 0 10000 0 + +65535 0 + 0 65535 + + 0 0 0|32639 32639 32639|65535 65535 65535 + 0 0 0|32639 32639 32639|65535 65535 65535 + +65535 0 0| 0 0 65535| 0 0 65535| 0 65535 0 +65535 0 0| 0 0 65535| 0 0 65535| 0 65535 0 + diff --git a/test/pamtable.test b/test/pamtable.test new file mode 100755 index 00000000..5c66b7ae --- /dev/null +++ b/test/pamtable.test @@ -0,0 +1,20 @@ +#! /bin/bash +# This script tests: pamtable +# Also requires: pamgradient pamseq pamdepth + +pamtable testgrid.pbm +echo +pamseq 3 2 -tupletype=RGB | pamtable +echo +pamseq 4 1 -tupletype=RGBA | pamtable +echo +for maxval in 9 10 9999 10000 65535 + do pbmmake -g 2 2 | pamdepth $maxval | pamtable + echo + ppmrainbow -width=3 -height=2 -norepeat black white | \ + pamdepth $maxval | pamtable + echo + ppmrainbow -width=4 -height=2 -norepeat red blue green | \ + pamdepth $maxval | pamtable + echo + done diff --git a/test/pamtopdbimg.ok b/test/pamtopdbimg.ok new file mode 100644 index 00000000..57258940 --- /dev/null +++ b/test/pamtopdbimg.ok @@ -0,0 +1,20 @@ +high compression +2 +1 +poor compression +1 +2 +long titles +268 +0 +268 +0 +0 +1 +large notefile +3344 +0 +68885 +0 +0 +1 diff --git a/test/pamtopdbimg.test b/test/pamtopdbimg.test new file mode 100755 index 00000000..8de78a70 --- /dev/null +++ b/test/pamtopdbimg.test @@ -0,0 +1,95 @@ +#! /bin/bash +# This script tests: pamtopdbimg +# Also requires: pgmmake pgmnoise + +tmpdir=${tmpdir:-/tmp} +mono_pgm=${tmpdir}/graymono.pgm +noise_pgm=${tmpdir}/graynoise.pgm +text65533=${tmpdir}/ascii65533.txt +text65534=${tmpdir}/ascii65534.txt +text65597=${tmpdir}/ascii65597.txt + +# The PDB image format has a time stamp. This causes pamtopdbimg +# to produce slightly different output files with each invocation. + +# Test 1. High compression +# -maybecompressed should produce a compressed file +# Should print: +# 2 +# 1 +echo high compression +pgmmake 0.5 -maxval=15 160 160 > ${mono_pgm} +for flag in "-compressed" "-maybecompressed" "-uncompressed" + do + pamtopdbimg $flag ${mono_pgm} | wc -c + done | uniq -c | awk '{print $1}' +rm ${mono_pgm} + + +# Test 2. Poor compression +# -maybecompressed should produce a uncompressed file +# Should print: +# 1 +# 2 +echo poor compression +pgmnoise -maxval=15 -randomseed=0 160 160 > ${noise_pgm} +for flag in "-compressed" "-maybecompressed" "-uncompressed" + do + pamtopdbimg $flag ${noise_pgm} | wc -c + done | uniq -c | awk '{print $1}' +rm ${noise_pgm} + + +# Test 3. long titles +# Should succeed twice and fail once, producing: +# 268 +# 0 +# 268 +# 0 +# 1 +# 0 + +# Some versions of wc have extra whitespace in the output (e.g. MAC OS) +# Delete with tr -d + +echo long titles +for flag in "" "-title=0123456789012345678901234567890" \ + "-title=01234567890123456789012345678901" + do + pamtopdbimg $flag testgrid.pbm | wc -c | tr -d ' ' + echo ${PIPESTATUS[0]} + done + + + +# Test 4. large notefile +# Should succeed twice and fail once, producing: +# 3344 +# 0 +# 68886 +# 0 +# 1 +# 0 +echo large notefile +awk 'BEGIN { ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + abc="abcdefghijklmnopqrstuvwxyz"; + digits="0123456789"; string =""; + + while ( length(string) < 65597 ) + string = string ABC abc digits; + + print string }' > ${text65597} + +head -c 65533 ${text65597} > ${text65533} +head -c 65534 ${text65597} > ${text65534} +pamtopdbimg -uncompressed testgrid.pbm | \ + wc -c | tr -d ' ' + echo ${PIPESTATUS[0]} +pamtopdbimg -uncompressed -notefile=${text65533} testgrid.pbm | \ + wc -c | tr -d ' ' + echo ${PIPESTATUS[0]} +pamtopdbimg -uncompressed -notefile=${text65534} testgrid.pbm | \ + wc -c | tr -d ' ' + echo ${PIPESTATUS[0]} + +rm ${text65533} ${text65534} ${text65597} \ No newline at end of file diff --git a/test/pbmtext-bdf.ok b/test/pbmtext-bdf.ok new file mode 100644 index 00000000..b1486493 --- /dev/null +++ b/test/pbmtext-bdf.ok @@ -0,0 +1,21 @@ +386826492 35 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +0 +0 diff --git a/test/pbmtext-bdf.test b/test/pbmtext-bdf.test new file mode 100755 index 00000000..50df7b75 --- /dev/null +++ b/test/pbmtext-bdf.test @@ -0,0 +1,169 @@ +#! /bin/bash +# This script tests: pbmtext +# Also requires: + +tmpdir=${tmpdir:-/tmp} + +font_bdf=${tmpdir}/font.bdf +font_corrupt=${tmpdir}/fontcorrupt + +# Though this BDF font file defines only three letters, it is valid. + +cat > ${font_bdf} << EOF +STARTFONT 2.1 +COMMENT simple font for pbmtext test +COMMENT derived from: $XFree86: xc/fonts/bdf/misc/micro.bdf,v 1.1 1999/09/25 14:36:34 dawes Exp $ +FONT test +SIZE 4 75 75 +FONTBOUNDINGBOX 4 5 0 0 +STARTPROPERTIES 5 +FONT_DESCENT 0 +FONT_ASCENT 5 +CHARSET_REGISTRY "ISO88591" +CHARSET_ENCODING "1" +COPYRIGHT "Public domain font. Share and enjoy." +ENDPROPERTIES +CHARS 3 +STARTCHAR A +ENCODING 65 +SWIDTH 1000 0 +DWIDTH 4 0 +BBX 4 5 0 0 +BITMAP +e0 +a0 +e0 +a0 +a0 +ENDCHAR +STARTCHAR B +ENCODING 66 +SWIDTH 1000 0 +DWIDTH 4 0 +BBX 4 5 0 0 +BITMAP +e0 +a0 +c0 +a0 +e0 +ENDCHAR +STARTCHAR C +ENCODING 67 +SWIDTH 1000 0 +DWIDTH 4 0 +BBX 4 5 0 0 +BITMAP +e0 +80 +80 +80 +e0 +ENDCHAR +ENDFONT +EOF + +# Test 1 +# This should succeed and produce 386826492 35 +pbmtext -font ${font_bdf} ABC | cksum + + +# Test 2 +# These should all fail. Writes 1 eightteen times. + +echo "Test whether corrupted BDF font files are properly handled." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +pbmtext -font ${font_bdf} BCD +echo $? + +for token in "STARTPROPERTIES" "CHARS" "STARTCHAR" "ENCODING" "DWIDTH" +do + font_corrupt_bdf=${font_corrupt}.naked_${token}.bdf + sed 's/^'${token}' .*$/'${token}'/' \ + ${font_bdf} > ${font_corrupt_bdf} + pbmtext -font ${font_corrupt_bdf} ABC > /dev/null + echo $? + rm ${font_corrupt_bdf} +done + +font_corrupt_bdf=${font_corrupt}.fbbx_narrow.bdf +sed 's/FONTBOUNDINGBOX 4 5 0 0/FONTBOUNDINGBOX 4 4 0 0/' \ + ${font_bdf} > ${font_corrupt_bdf} +pbmtext -font ${font_corrupt_bdf} ABC > /dev/null +echo $? +rm ${font_corrupt_bdf} + +font_corrupt_bdf=${font_corrupt}.fbbx_low.bdf +sed 's/FONTBOUNDINGBOX 4 5 0 0/FONTBOUNDINGBOX 3 5 0 0/' \ + ${font_bdf} > ${font_corrupt_bdf} +pbmtext -font ${font_corrupt_bdf} ABC > /dev/null +echo $? +rm ${font_corrupt_bdf} + +font_corrupt_bdf=${font_corrupt}.bbx_only3fields.bdf +sed 's/BBX 4 5 0 0/BBX 4 5 0/' \ + ${font_bdf} > ${font_corrupt_bdf} +pbmtext -font ${font_corrupt_bdf} ABC > /dev/null +echo $? +rm ${font_corrupt_bdf} + +font_corrupt_bdf=${font_corrupt}.bbx_wide.bdf +sed 's/BBX 4 5 0 0/BBX 9 5 0 0/' \ + ${font_bdf} > ${font_corrupt_bdf} +pbmtext -font ${font_corrupt_bdf} ABC > /dev/null +echo $? +rm ${font_corrupt_bdf} + +font_corrupt_bdf=${font_corrupt}.bbx_zerowidth.bdf +sed 's/BBX 4 5 0 0/BBX 0 5 0 0/' \ + ${font_bdf} > ${font_corrupt_bdf} +pbmtext -font ${font_corrupt_bdf} ABC > /dev/null +echo $? +rm ${font_corrupt_bdf} + +font_corrupt_bdf=${font_corrupt}.bbx_tall.bdf +sed 's/BBX 4 5 0 0/BBX 4 6 0 0/' \ + ${font_bdf} > ${font_corrupt_bdf} +pbmtext -font ${font_corrupt_bdf} ABC > /dev/null +echo $? +rm ${font_corrupt_bdf} + +font_corrupt_bdf=${font_corrupt}.bbx_low.bdf +sed 's/BBX 4 5 0 0/BBX 4 1 0 0/' \ + ${font_bdf} > ${font_corrupt_bdf} +pbmtext -font ${font_corrupt_bdf} ABC > /dev/null +echo $? +rm ${font_corrupt_bdf} + +font_corrupt_bdf=${font_corrupt}.bbx_zeroheight.bdf +sed 's/BBX 4 5 0 0/BBX 4 0 0 0/' \ + ${font_bdf} > ${font_corrupt_bdf} +pbmtext -font ${font_corrupt_bdf} ABC > /dev/null +echo $? +rm ${font_corrupt_bdf} + +for delete_line in 14 16 18 20 + do + font_corrupt_bdf=${font_corrupt}.del${delete_line}.pdf + sed "${delete_line}"d ${font_bdf} > ${font_corrupt_bdf} + pbmtext -font ${font_corrupt_bdf} ABC > /dev/null + echo $? + rm ${font_corrupt_bdf} + done + + +# Test 2 +# These should succeed. Warning messages will be displayed. +# Writes 1 two times. + +for token in "CHARSET_ENCODING" "CHARSET_REGISTRY" +do + font_corrupt_bdf=${font_corrupt}.naked_${token}.bdf + sed 's/^'${token}' .*$/'${token}'/' \ + ${font_bdf} > ${font_corrupt_bdf} + pbmtext -font ${font_corrupt_bdf} ABC > /dev/null + echo $? + rm ${font_corrupt_bdf} +done diff --git a/test/pbmtext-iso88591.ok b/test/pbmtext-iso88591.ok new file mode 100644 index 00000000..6cc1a856 --- /dev/null +++ b/test/pbmtext-iso88591.ok @@ -0,0 +1,4 @@ +3806607098 5110 +3806607098 5110 +2858870527 192 +2858870527 192 diff --git a/test/pbmtext-iso88591.test b/test/pbmtext-iso88591.test new file mode 100755 index 00000000..bc5e83ab --- /dev/null +++ b/test/pbmtext-iso88591.test @@ -0,0 +1,46 @@ +#! /bin/bash +# This script tests: pbmtext +# Also requires: + +# This test requires the following locale: +# LC_ALL en_US.iso88591 +# Skip this test if it is not available + +iconv /dev/null +if [ $? -ne 0 ] + then echo "iconv command not available." 1>&2 + echo "Skipping." 1>&2 + exit 80; +fi + +echo "A" | LC_ALL=en_US.iso88591 pbmtext -wchar > /dev/null +if [ $? -ne 0 ] + then echo "LC_ALL could not be set to en_US.iso88591" 1>&2 + echo "Skipping." 1>&2 + exit 80; +fi + +# Two rows +# Should print 3806607098 5110 twice +LC_ALL=C \ +awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print ""; \ + for (i=160;i<=255;++i) printf("%c",i); }' | \ + pbmtext -builtin bdf | cksum + + +LC_ALL=C \ +awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print ""; \ + for (i=160;i<=255;++i) printf("%c",i); }' | \ + LC_ALL=en_US.iso88591 pbmtext -builtin bdf -wchar | cksum + + +# Two rows +# Should print 2858870527 192 twice +LC_ALL=C \ +awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print ""; \ + for (i=161;i<=255;++i) printf("%c",i); print "" }' | cksum + +LC_ALL=C \ +awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print ""; \ + for (i=161;i<=255;++i) printf("%c",i); print ""}' | \ + LC_ALL=en_US.iso88591 pbmtext -builtin bdf -wchar -text-dump | cksum \ No newline at end of file diff --git a/test/pbmtext-utf8.ok b/test/pbmtext-utf8.ok new file mode 100644 index 00000000..588bf617 --- /dev/null +++ b/test/pbmtext-utf8.ok @@ -0,0 +1,8 @@ +2066913605 5110 +2066913605 5110 +2920616515 2301 +2920616515 2301 +0 0 0 0 : 0 + !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ + !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ +0 1 : 1 diff --git a/test/pbmtext-utf8.test b/test/pbmtext-utf8.test new file mode 100755 index 00000000..cf495b7c --- /dev/null +++ b/test/pbmtext-utf8.test @@ -0,0 +1,95 @@ +#! /bin/bash +# This script tests: pbmtext +# Also requires: + +# This test requires the en_US.utf8 locale +# Skip this test if it is not available + +iconv /dev/null +if [ $? -ne 0 ] + then echo "iconv command not available." 1>&2 + echo "Skipping." 1>&2 + exit 80; +fi + +echo "A" | LC_ALL=en_US.utf8 pbmtext -wchar > /dev/null +if [ $? -ne 0 ] + then echo "LC_ALL could not be set to en_US.utf8." 1>&2 + echo "Skipping." 1>&2 + exit 80; +fi + +# Test 1. +# Two rows +# Should print 2066913605 5110 twice +LC_ALL=C \ +awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print ""; \ + for (i=161;i<=255;++i) printf("%c",i); }' | \ + pbmtext -builtin bdf | cksum + +LC_ALL=C \ +awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print ""; \ + for (i=161;i<=255;++i) printf("%c",i); }' | \ + iconv -f iso8859-1 -t utf-8 | \ + LC_ALL=en_US.utf8 pbmtext -builtin bdf -wchar | cksum + + +# Test 2. +# One row +# Should print 2920616515 2301 twice +LC_ALL=C \ +awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print "" }' | \ + pbmtext -builtin bdf | cksum + +LC_ALL=C \ +awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print ""}' | \ + LC_ALL=en_US.utf8 pbmtext -builtin bdf -wchar | cksum + + +tmpdir=${tmpdir:-/tmp} +output=${tmpdir}/output + + +# Test 3. +# Two rows +# Output may be affected by locale. Compare with cmp. +# Should print 0 +LC_ALL=C \ +awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print ""; \ + for (i=161;i<=255;++i) printf("%c",i); print "" }' | \ + iconv -f iso8859-1 -t utf-8 > ${output} + +LC_ALL=C \ +awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print ""; \ + for (i=161;i<=255;++i) printf("%c",i); print "" }' | \ + iconv -f iso8859-1 -t utf-8 | \ + LC_ALL=en_US.utf8 pbmtext -builtin bdf -wchar -text-dump | \ + cmp --quiet - ${output} + +echo ${PIPESTATUS[@]} ":" $? +rm ${output} + + +# Test 4. +# One row +# Should print the following twice: +# !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ +LC_ALL=C \ +awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print "" } ' + +LC_ALL=C \ +awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print ""}' | \ + LC_ALL=en_US.utf8 pbmtext -builtin bdf -wchar -text-dump + + +echo "Invalid utf-8 sequence as input." 1>&2 +echo "An error message should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +# Test 5. +# Invalid utf-8 sequence +# Should print 1 +LC_ALL=C \ +awk 'BEGIN { for (i=128; i<=129;++i) printf("%c",i); print ""}' | \ + LC_ALL=en_US.utf8 pbmtext -builtin bdf -wchar -text-dump +echo ${PIPESTATUS[@]} ":" $? diff --git a/test/pbmtext.ok b/test/pbmtext.ok index 438fe7b8..96e351f9 100644 --- a/test/pbmtext.ok +++ b/test/pbmtext.ok @@ -1,21 +1,16 @@ -1427751145 328 -1975911793 129 -3145408696 273 -2662867350 328 -3630387453 129 -1251480181 297 -1522829573 299 -1333433014 114 -4128014259 249 -2350105502 270 -2044333794 84 -2845861861 177 -2754777566 416 -3452484090 174 -2294575230 297 -67558248 387 -1647907430 159 -2846042958 249 -307551150 328 -584153820 114 -3355717231 177 +3898818212 967 +3898818212 967 +2506052117 1354 +2506052117 1354 +1028079028 967 +1888680721 445 +1305436978 1018 +1028079028 967 +1028079028 967 +1305436978 1018 +1305436978 1018 +1647614653 2027 +1647614653 2027 +1647614653 2027 +2547645687 4564 +1174281741 5741 diff --git a/test/pbmtext.test b/test/pbmtext.test index dffb2cb4..38578636 100755 --- a/test/pbmtext.test +++ b/test/pbmtext.test @@ -1,12 +1,94 @@ #! /bin/bash # This script tests: pbmtext -# Also requires: +# Also requires: pamfile +tmpdir=${tmpdir:-/tmp} -for i in 0123456789 abcdefghijk lmnopqrst uzwxyz ABCDEFGHIJK LMNOPQRST UVWXYZ -do -for flags in "" "-nom" "-builtin fixed" +# Test 1: + +# Should print 3898818212 967 twice + +pbmtext UNIX Philosophy: Do one thing and do it well. | cksum +echo -n "UNIX Philosophy: Do one thing and do it well." | pbmtext | cksum + +# Should print 2506052117 1354 twice + +pbmtext -builtin fixed \ + For truth is always strange. Stranger than fiction. Lord Byron | cksum +echo -n "For truth is always strange. Stranger than fiction. Lord Byron" | \ + pbmtext -builtin fixed | cksum + + +text="The quick brown fog jumps over the lazy docs." + +# Test 2: + +for flags in "" "-nomargins" "-builtin fixed" do -echo $i | pbmtext $flags | cksum +echo ${text} | pbmtext ${flags} | cksum done + +temp_pbm=${tmpdir}/temp.pbm + + +# Test 3: Check if image is produced unaltered when -width is specified +# Should print 1028079028 967 twice, then 1305436978 1018 twice + +for flags in "" "-builtin fixed" +do +pbmtext ${flags} ${text} | tee ${temp_pbm} | cksum +width1=`pamfile ${temp_pbm} | awk '$2=="PBM" && NR==1 {w=$4}; END {print w}' ` +width2=`pbmtext ${flags} ${text} --dry-run | awk '{print $1}' ` + +if [ ${width1} -eq ${width2} ]; then + pbmtext ${flags} -width=${width1} ${text} | cksum +else + echo ${width1} ${width2} +fi +rm ${temp_pbm} done + + +# Test 4: Should print 1647614653 2027 three times +# Note: backslashes inserted in 3 locations in the rectange to make +# possible input as a here document. + +fontRectangle_txt=${tmpdir}/fontRectangle.txt +font_pbm=${tmpdir}/font.pbm + +cat > ${fontRectangle_txt} << EOF +M ",/^_[\`jpqy| M + +/ !"#$%&'()*+ / +< ,-./01234567 < +> 89:;<=>?@ABC > +@ DEFGHIJKLMNO @ +_ PQRSTUVWXYZ[ _ +{ \\]^_\`abcdefg { +} hijklmnopqrs } +~ tuvwxyz{|}~ ~ + +M ",/^_[\`jpqy| M +EOF + +pbmtext -dump-sheet -builtin fixed | tee ${font_pbm} | cksum +cat ${fontRectangle_txt} | pbmtext -nom -builtin fixed | cksum +cat ${fontRectangle_txt} | pbmtext -nom -font ${font_pbm} | cksum +rm ${fontRectangle_txt} ${font_pbm} + + +# Test 5: Print all characters defined in the built-in bdf font + +# One long row +# Should print 3233136020 4535 +LC_ALL=C \ +awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); + for (i=160;i<=255;++i) printf("%c",i); }' | \ + pbmtext -builtin bdf | cksum + +# One tall column +# Should print 1216262214 5711 +LC_ALL=C \ +awk 'BEGIN { for (i=32; i<=126;++i) printf("%c\n",i); + for (i=160;i<=255;++i) printf("%c\n",i); }' | \ + pbmtext -nomargins -builtin bdf | cksum diff --git a/test/pbmtog3.ok b/test/pbmtog3.ok index a0768f95..cef9e3f9 100644 --- a/test/pbmtog3.ok +++ b/test/pbmtog3.ok @@ -5,7 +5,6 @@ 28792587 47 277456854 32 28792587 47 -871281767 162 3736247115 62 2820255307 2191856 4159089282 2226575 diff --git a/test/pbmtog3.test b/test/pbmtog3.test index 15c0cdf9..c5dc3357 100755 --- a/test/pbmtog3.test +++ b/test/pbmtog3.test @@ -2,7 +2,6 @@ # This script tests: pbmtog3 # Also requires: pbmmake - # Test 1. Should print 3697098186 144 pbmtog3 testgrid.pbm | cksum # Test 2. Should print 1248301383 122 @@ -18,12 +17,9 @@ pbmmake -w 10 10 | \ pbmtog3 -nofixedwidth | cksum # Test 7. Should print 28792587 47 pbmmake -w 10000 10 | pbmtog3 | cksum -# Test 8. Should print 871281767 162 -pbmmake -w 10000 10 | \ - pbmtog3 -nofixedwidth | cksum -# Test 9. Should print 3736247115 62 +# Test 8. Should print 3736247115 62 pbmmake -b 10 10 | pbmtog3 | cksum -# Test 10. Should print 2820255307 2191856 +# Test 9. Should print 2820255307 2191856 pbmmake -g 1700 2286 | pbmtog3 | cksum -# Test 11. Should print 4159089282 2226575 +# Test 10. Should print 4159089282 2226575 pbmmake -g 1800 2286 | pbmtog3 | cksum diff --git a/test/pdb-roundtrip.ok b/test/pdb-roundtrip.ok new file mode 100644 index 00000000..b903da8d --- /dev/null +++ b/test/pdb-roundtrip.ok @@ -0,0 +1,18 @@ +pbm grid +2224198737 25671 +2224198737 25671 +2224198737 25671 +pbm tiled +0 0 0 0 : 0 +0 0 0 0 : 0 +0 0 0 0 : 0 +0 0 0 0 : 0 +pgm ellipse +0 0 0 0 0 : 0 +0 0 0 0 0 : 0 +0 0 0 0 0 : 0 +0 0 0 0 0 : 0 +pgm ellipse -4depth +0 0 0 0 0 : 0 +0 0 0 0 0 : 0 +0 0 0 0 0 : 0 diff --git a/test/pdb-roundtrip.test b/test/pdb-roundtrip.test new file mode 100755 index 00000000..6b4e152c --- /dev/null +++ b/test/pdb-roundtrip.test @@ -0,0 +1,55 @@ +#! /bin/bash +# This script tests: pamtopdbimg pdbimgtopam +# Also requires: pnmtile pgmramp pamtopnm + +tmpdir=${tmpdir:-/tmp} +tiled_pbm=${tmpdir}/tiled.pbm +ellipse_pgm=${tmpdir}/ellipse.pgm + + +# Test 1. Should produce 2224198737 25671 +# 3 times +echo pbm grid +for flag in "-compressed" "-maybecompressed" "-uncompressed" + do + pamtopdbimg ${flag} testgrid.pbm | pdbimgtopam | cksum + done + + +# Test 2. Should produce 0 0 0 +# 4 times +echo pbm tiled +pnmtile 160 160 testgrid.pbm > ${tiled_pbm} +for flag in "" "-compressed" "-maybecompressed" "-uncompressed" + do + pamtopdbimg ${flag} ${tiled_pbm} | pdbimgtopam | pamtopnm | \ + cmp -s - ${tiled_pbm} + echo ${PIPESTATUS[@]} ":" $? + done +rm ${tiled_pbm} + + +# Test 3. Should produce 0 0 0 +# 4 times +echo pgm ellipse +pgmramp -ellipse 160 160 -maxval=3 > ${ellipse_pgm} +for flag in "" "-compressed" "-maybecompressed" "-uncompressed" + do + pamtopdbimg ${flag} ${ellipse_pgm} | pdbimgtopam | \ + pamtopnm | pamdepth 3 | cmp -s - ${ellipse_pgm} + echo ${PIPESTATUS[@]} ":" $? + done +rm ${ellipse_pgm} + + +# Test 3. Should produce 0 0 0 +# 3 times +echo pgm ellipse -4depth +pgmramp -ellipse 160 160 -maxval=15 > ${ellipse_pgm} +for flag in "-compressed" "-maybecompressed" "-uncompressed" + do + pamtopdbimg -4depth ${flag} ${ellipse_pgm} | pdbimgtopam | \ + pamtopnm | pamdepth 15 | cmp -s - ${ellipse_pgm} + echo ${PIPESTATUS[@]} ":" $? + done +rm ${ellipse_pgm} \ No newline at end of file diff --git a/test/pgmnoise.ok b/test/pgmnoise.ok deleted file mode 100644 index 138218c2..00000000 --- a/test/pgmnoise.ok +++ /dev/null @@ -1 +0,0 @@ -2005134911 10015 diff --git a/test/pgmnoise.rand-ok b/test/pgmnoise.rand-ok new file mode 100644 index 00000000..b69f48e5 --- /dev/null +++ b/test/pgmnoise.rand-ok @@ -0,0 +1,3 @@ +000|0 +081|2005134911 10015 +082|3516404574 10015 diff --git a/test/pgmnoise.test b/test/pgmnoise.test index 0b38553b..03301ce6 100755 --- a/test/pgmnoise.test +++ b/test/pgmnoise.test @@ -2,22 +2,6 @@ # This script tests: pgmnoise # Also requires: - -# We first check whether random number generator is glibc rand(). -# If not, this test is skipped. - -testrandom - -case $? in - 81) - # Should print: 1663614689 10015 - pgmnoise --randomseed=0 100 100 | cksum ;; - - # Any additional tests go here. - - 8[02-9] | 90) - echo "Skipping: random number generator is not glibc." 1>&2 - exit 80;; - - *) exit 1;; # testrandom failed -esac +# Should print: 1663614689 10015 (Glibc) +# 3516404574 10015 (MAC OS) +pgmnoise --randomseed=0 100 100 | cksum diff --git a/test/pnmpaste-pbm.ok b/test/pnmpaste-pbm.ok new file mode 100644 index 00000000..d3b0a7e8 --- /dev/null +++ b/test/pnmpaste-pbm.ok @@ -0,0 +1,22 @@ +Test 1. +-replace +P1 18 1 001010101010101011 +-and +P1 18 1 001111101111101111 +-or +P1 18 1 000010000010000011 +-xor +P1 18 1 010010010010010011 +-nand +P1 18 1 010000010000010011 +-nor +P1 18 1 011101111101111111 +-nxor +P1 18 1 001101101101101111 +Test 2. +-and -nand +P1 18 1 110000000000000001 +-or -nor +P1 18 1 110000000000000001 +-xor -nxor +P1 18 1 110000000000000001 diff --git a/test/pnmpaste-pbm.test b/test/pnmpaste-pbm.test new file mode 100755 index 00000000..b75797af --- /dev/null +++ b/test/pnmpaste-pbm.test @@ -0,0 +1,47 @@ +#! /bin/bash +# This script tests: pnmpaste +# Also requires: pbmmake + +tmpdir=${tmpdir:-/tmp} +base_pbm=${tmpdir}/font.pbm +insert_pbm=${tmpdir}/insert.pbm + +cat > ${base_pbm} << EOF +P1 +18 1 +000111000111000111 +EOF + +pbmmake -g 15 1 > ${insert_pbm} + +# Test 1. +echo "Test 1." + +for operation in "-replace" "-and" "-or" "-xor" "-nand" "-nor" "-nxor" + do + echo ${operation} + pnmpaste ${operation} -plain ${insert_pbm} 1 0 ${base_pbm} | tr '\n' ' ' + echo + done + + +# Test 2. +# Perform an operation and its negative counterpart, combine the +# resulting images with "-xor". +# The untouched area of the base image should be 1; inserted area 0. + +echo "Test 2." + +positive_pbm=${tmpdir}/positive.pbm +negative_pbm=${tmpdir}/negative.pbm + +for operation in "and" "or" "xor" + do + echo "-"$operation " -n"$operation + pnmpaste "-"${operation} ${insert_pbm} 2 0 ${base_pbm} > ${positive_pbm} + pnmpaste "-n"${operation} ${insert_pbm} 2 0 ${base_pbm} > ${negative_pbm} + pnmpaste -xor -plain ${positive_pbm} 0 0 ${negative_pbm} | tr '\n ' ' ' + echo + done + +rm ${base_pbm} ${insert_pbm} ${positive_pbm} ${negative_pbm} diff --git a/test/pnmpsnr.ok b/test/pnmpsnr.ok index b303cc9d..3469f836 100644 --- a/test/pnmpsnr.ok +++ b/test/pnmpsnr.ok @@ -1,2 +1,7 @@ -0.00 dB -no difference +0.00 +inf +1000.00 +match +300.00 300.00 300.00 +match +match diff --git a/test/pnmpsnr.test b/test/pnmpsnr.test index 3e7408ec..f24c08aa 100755 --- a/test/pnmpsnr.test +++ b/test/pnmpsnr.test @@ -12,9 +12,12 @@ b_pbm=${tmpdir}/b.pbm pbmmake -w 10 10 > ${w_pbm} pbmmake -b 10 10 > ${b_pbm} -pnmpsnr ${w_pbm} ${b_pbm} 2>&1 | \ - awk '$2=="lumina" {print $(NF-1),$NF}' -pnmpsnr ${w_pbm} ${w_pbm} 2>&1 | \ - awk '$2=="lumina" {print $(NF-1),$NF}' +pnmpsnr ${w_pbm} ${b_pbm} -machine +pnmpsnr ${w_pbm} ${w_pbm} -machine +pnmpsnr ${w_pbm} ${w_pbm} -machine -max=1000 +pnmpsnr ${w_pbm} ${w_pbm} -target=1000 +pnmpsnr testimg.ppm testimg.ppm -machine -max=300 +pnmpsnr testimg.ppm testimg.ppm -target=1000 +pnmpsnr testimg.ppm testimg.ppm -target1=1000 -target2=1000 -target3=1000 rm ${b_pbm} ${w_pbm} diff --git a/test/pnmquantall.ok b/test/pnmquantall.ok new file mode 100644 index 00000000..172eb0aa --- /dev/null +++ b/test/pnmquantall.ok @@ -0,0 +1,5 @@ +got color map +2373957371 33838 +3892560659 33838 +1383839923 33838 +1 diff --git a/test/pnmquantall.test b/test/pnmquantall.test new file mode 100755 index 00000000..cd01bb8d --- /dev/null +++ b/test/pnmquantall.test @@ -0,0 +1,27 @@ +#! /bin/bash +# This script tests: pnmquantall +# Also requires: ppmtorgb3 pgmhist + +tmpdir=${tmpdir:-/tmp} +test_ppm=${tmpdir}/testimg.ppm + +cp testimg.ppm ${tmpdir} && +ppmtorgb3 ${test_ppm} + +test_red=${tmpdir}/testimg.red +test_grn=${tmpdir}/testimg.grn +test_blu=${tmpdir}/testimg.blu + +pnmquantall 20 ${test_red} ${test_grn} ${test_blu} + +for i in ${test_red} ${test_grn} ${test_blu} +do +cat $i | cksum +done + +# Should print 1 + +pnmcat ${test_red} ${test_grn} ${test_blu} -tb | \ + pgmhist -m | awk '$2>0 {s++}; END { print (s<=20) }' + +rm ${test_red} ${test_grn} ${test_blu} ${test_ppm} \ No newline at end of file diff --git a/test/pnmtile.ok b/test/pnmtile.ok index 559d0f65..4a29e0dc 100644 --- a/test/pnmtile.ok +++ b/test/pnmtile.ok @@ -1,2 +1,2 @@ 4228632379 259 -0 +0 0 : 0 diff --git a/test/pnmtile.test b/test/pnmtile.test index 409c0e50..e297da66 100755 --- a/test/pnmtile.test +++ b/test/pnmtile.test @@ -17,6 +17,6 @@ pnmtile 454 298 testimg.ppm > ${testimg4_ppm} && pnmcat -lr testimg.ppm testimg.ppm > ${testimg2_ppm} && pnmcat -tb ${testimg2_ppm} ${testimg2_ppm} | \ cmp -s - ${testimg4_ppm} -echo $? +echo ${PIPESTATUS[@]} ":" $? rm ${testimg2_ppm} ${testimg4_ppm} diff --git a/test/ppmbrighten.ok b/test/ppmbrighten.ok index 65feb812..376e71d3 100644 --- a/test/ppmbrighten.ok +++ b/test/ppmbrighten.ok @@ -1,3 +1,3 @@ -2737989845 101484 -1059247992 101484 -32344911 101484 +1969633344 101484 +3688219243 101484 +295150171 101484 diff --git a/test/ppmbrighten.test b/test/ppmbrighten.test index fa7702d8..46c5cab5 100755 --- a/test/ppmbrighten.test +++ b/test/ppmbrighten.test @@ -2,6 +2,10 @@ # This script tests: ppmbrighten # Also requires: +# Failure message +## Ppmbrighten is sensitive to subtle differences in floating point math. +## If this test fails, please run the program and visually examine +## the output. ppmbrighten -v 100 testimg.ppm | cksum ppmbrighten -v 100 -normalize testimg.ppm | cksum diff --git a/test/ppmchange.ok b/test/ppmchange.ok index 130c3c45..aba3a7a8 100644 --- a/test/ppmchange.ok +++ b/test/ppmchange.ok @@ -1,4 +1,9 @@ 22488533 203 1008787190 613 -3885709071 613 -2101746192 613 +1983174784 613 +2146447222 613 +1216791938 613 + 0 0 0 0 78 + 0 0 255 29 40 + 0 50 2 30 41 + 100 0 1 30 41 diff --git a/test/ppmchange.test b/test/ppmchange.test index d29a699f..a749a5d2 100755 --- a/test/ppmchange.test +++ b/test/ppmchange.test @@ -1,18 +1,19 @@ #! /bin/bash # This script tests: ppmchange -# Also requires: ppmrainbow pgmramp +# Also requires: ppmrainbow pgmramp ppmhist # Failure message ## If this test fails and ppmchange-roundtrip.test succeeds, -## the probably cause is a problem with one of the options of +## 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 -# Explicit values for intermediate colors: rgb.txt may be defining them -# in unusual ways. +# Explicit values for intermediate colors: rgb.txt may not be the one +# Netpbm provides; they may be defined in unusual ways. brown=rgb:67/43/00 cyan=rgb:00/ff/ff @@ -20,7 +21,7 @@ yellow=rgb:ff/ff/00 gray=rgb:7f/7f/7f -# Test 1. Should print 811868957 60 +# Test 1. Should print 22488533 203 pgmramp -lr 8 8 | ppmchange black black white white $gray $gray \ -close=10 -remainder=blue | cksum @@ -31,29 +32,31 @@ ppmrainbow -tmpdir=$tmpdir -width=200 -height=1 red green blue | \ tee ${rainbow_ppm} | \ ppmchange red $brown green $brown blue $brown | cksum +# Validate ${rainbow_ppm} +# Should print 1983174784 613 -# Test 3. Should print 3885709071 613 +cat ${rainbow_ppm} | cksum + + +# Test 3. Should print 2146447222 613 ppmchange red $brown green $cyan blue $yellow \ -closeness=25 ${rainbow_ppm} | cksum -# Test 4. Should print 2101746192 613 +# Test 4. Should print 1216791938 613 ppmchange red rgb:64/00/01 rgb:00/ff/00 rgb:00/32/02 blue blue \ - -remainder=black -closeness=25 ${rainbow_ppm} | cksum + -remainder=black -closeness=25 ${rainbow_ppm} | tee ${changed_ppm} | cksum -rm ${rainbow_ppm} +# Produce a histogram of the colors in the output image +# Should produce +# 0 0 0 0 78 +# 0 0 255 29 40 +# 0 50 2 30 41 +# 100 0 1 30 41 +ppmhist -sort=rgb -noheader ${changed_ppm} -# cksum ${rainbow_ppm} -# 1983174784 613 rainbow.ppm -# ppmchange red rgb:64/00/01 rgb:00/ff/00 rgb:00/32/02 blue blue \ -# -remainder=black -closeness=25 ${rainbow_ppm} | \ -# pphist -sort=rgb -noheader -# -# 0 0 0 0 75 -# 0 0 255 29 42 -# 0 50 2 30 42 -# 100 0 1 30 41 +rm ${rainbow_ppm} ${changed_ppm} diff --git a/test/ppmforge.ok b/test/ppmforge.ok deleted file mode 100644 index e4a4c9e2..00000000 --- a/test/ppmforge.ok +++ /dev/null @@ -1 +0,0 @@ -3634219838 196623 diff --git a/test/ppmforge.rand-ok b/test/ppmforge.rand-ok new file mode 100644 index 00000000..c8b3ac9f --- /dev/null +++ b/test/ppmforge.rand-ok @@ -0,0 +1,3 @@ +000|0 +081|3634219838 196623 +082|3262664440 196623 diff --git a/test/ppmforge.test b/test/ppmforge.test index 65280d14..3ebea88c 100755 --- a/test/ppmforge.test +++ b/test/ppmforge.test @@ -4,17 +4,6 @@ # Use small x y values to avoid floating point issues. - -testrandom -q -case $? in - 81) - # Test 1: Should print: 3634219838 196623 - ppmforge -night -seed 1 | cksum - ;; - - 8[02-9] | 90) - echo "Skipping: random number generator is not glibc." 1>&2 - exit 80;; - - *) exit 1;; # testrandom failed -esac +# Should print: 3634219838 196623 (Glibc) +# 3262664440 196623 (MAC OS) +ppmforge -night -seed 1 | cksum diff --git a/test/ppmhist.ok b/test/ppmhist.ok index d7ecf07e..f2ba637b 100644 --- a/test/ppmhist.ok +++ b/test/ppmhist.ok @@ -1,5 +1,3 @@ - r g b lum count - ----- ----- ----- ----- ------- 0 0 0 0 2 1 1 1 1 2 2 2 2 2 2 @@ -8,4 +6,14 @@ 5 5 5 5 2 6 6 6 6 2 8 8 8 8 2 -3438989921 711087 +3081591280 60957 + Summary: 1 colors: 1 black, 0 white, 0 gray, 0 color + Summary: 1 colors: 0 black, 1 white, 0 gray, 0 color + Summary: 2 colors: 1 black, 1 white, 0 gray, 0 color + Summary: 16 colors: 1 black, 1 white, 14 gray, 0 color + Summary: 8 colors: 1 black, 1 white, 6 gray, 0 color + Summary: 8 colors: 1 black, 1 white, 0 gray, 6 color + Summary: 27 colors: 1 black, 1 white, 1 gray, 24 color + Summary: 6 colors: 0 black, 0 white, 0 gray, 6 color + Summary: 6 colors: 1 black, 0 white, 0 gray, 5 color + Summary: 6 colors: 1 black, 1 white, 1 gray, 3 color diff --git a/test/ppmhist.test b/test/ppmhist.test index 97fbd79d..27d31562 100755 --- a/test/ppmhist.test +++ b/test/ppmhist.test @@ -1,7 +1,22 @@ #! /bin/bash # This script tests: ppmhist -# Also requires: pgmramp +# Also requires: pgmramp pamtopnm pbmmake pamseq ppmpat +pgmramp -maxval=8 -lr 8 2 | ppmhist -sort=rgb -noheader +ppmhist -map -sort=rgb -noheader testimg.ppm | pamtopnm | cksum -pgmramp -maxval=8 -lr 8 2 | ppmhist -sort=rgb -ppmhist -map -sort=rgb testimg.ppm | cksum +# Test summary header + +pbmmake -b 2 1 | ppmhist | head -n1 +pbmmake -w 2 1 | ppmhist | head -n1 +pbmmake -g 2 1 | ppmhist | head -n1 +pgmramp -lr 16 1 | ppmhist | head -n1 +pgmramp -lr -maxval=7 16 1 | ppmhist | head -n1 +pamseq 3 1 | ppmhist | head -n1 +pamseq 3 2 | ppmhist | head -n1 +ppmpat -madras --color=rgb:32/0d/b7,rgb:31/58/a3,rgb:e9/5e/d4 25 25 | \ + ppmhist | head -n1 +ppmpat -madras --color=rgb:00/00/00,rgb:31/58/a3,rgb:e9/5e/d4 25 25 | \ + ppmhist | head -n1 +ppmpat -madras --color=rgb:00/00/00,rgb:31/58/a3,rgb:ff/ff/ff 25 25 | \ + ppmhist | head -n1 \ No newline at end of file diff --git a/test/ppmpat-random.rand-ok b/test/ppmpat-random.rand-ok new file mode 100644 index 00000000..eb8779ab --- /dev/null +++ b/test/ppmpat-random.rand-ok @@ -0,0 +1,7 @@ +000|0 +081|2219119109 36015 +081|3436846137 16813 +081|908097729 16813 +082|3606254242 36015 +082|3615722579 16813 +082|1756684515 16813 diff --git a/test/ppmpat-random.test b/test/ppmpat-random.test new file mode 100755 index 00000000..a6daa982 --- /dev/null +++ b/test/ppmpat-random.test @@ -0,0 +1,22 @@ +#! /bin/bash +# This script tests: ppmpat +# Also requires: + +# TODO: Write tests for squig and poles. It appears that they are +# sensitive to differences in floating point math. + +# These tests require random numbers. + +# Test 1. Should print: 2219119109 36015 (glibc) +# 3606254242 36015 (MAC OS) +ppmpat --randomseed=0 -camo 100 120 | cksum + +# Test 2. Should print: 3436846137 16813 (glibc) +# 3615722579 16813 (MAC OS) +ppmpat --randomseed=0 -anticamo 80 70 | cksum + +# Test 3. Should print: 908097729 16813 (glibc) +# 1756684515 16813 (MAC OS) +ppmpat --randomseed=0 --color \ + rgb:55/c0/34,rgb:0/ff/0,rgb:0/ee/0,rgb:0/cd/0,rgb:0/8b/0,rgb:4f/4f/2f \ + -camo 80 70 | cksum diff --git a/test/ppmpat.ok b/test/ppmpat.ok index c5b71909..bb940aee 100644 --- a/test/ppmpat.ok +++ b/test/ppmpat.ok @@ -1,6 +1,6 @@ 4008533639 781 -2448908863 9613 +3805937800 9613 2698433077 1549 3705929501 781 -2219119109 36015 -3436846137 16813 +3057513592 661 +1861389287 661 diff --git a/test/ppmpat.test b/test/ppmpat.test index 89f86f67..cd00c0f1 100755 --- a/test/ppmpat.test +++ b/test/ppmpat.test @@ -2,34 +2,20 @@ # This script tests: ppmpat # Also requires: -# TODO: Write tests for squig and poles. It appears that they are -# sensitive to differences in floating point math. +# Test 1. Should print: 4008533639 781 +ppmpat -g2 --color=rgb:32/0d/b7,rgb:31/58/a3 16 16 | cksum -testrandom -q -case $? in - 81) - # Test 1. Should print: 4008533639 781 - ppmpat --randomseed=0 -g2 16 16 | cksum +# Test 2. Should print: 3805937800 9613 +ppmpat -g3 --color=rgb:32/0d/b7,rgb:31/58/a3,rgb:e9/5e/d4 64 50 | cksum - # Test 2. Should print: 2448908863 9613 - ppmpat --randomseed=0 -g2 64 50 | cksum +# Test 3. Should print: 2698433077 1549 +ppmpat -madras --color=rgb:32/0d/b7,rgb:31/58/a3,rgb:e9/5e/d4 32 16 | cksum - # Test 3. Should print: 2698433077 1549 - ppmpat --randomseed=0 -madras 32 16 | cksum +# Test 4. Should print: 3705929501 781 +ppmpat -tartan --color=rgb:32/0d/b7,rgb:31/58/a3,rgb:e9/5e/d4 16 16 | cksum - # Test 4. Should print: 3705929501 781 - ppmpat --randomseed=0 -tartan 16 16 | cksum +# Test 5. Should print: 3057513592 661 +ppmpat -argyle1 --color=rgb:ff/ff/ff,rgb:ff/0/0 12 18 | cksum - # Test 5. Should print: 2219119109 36015 - ppmpat --randomseed=0 -camo 100 120 | cksum - - # Test 6. Should print: 3436846137 16813 - ppmpat --randomseed=0 -anticamo 80 70 | cksum - ;; - - 8[02-9] | 90) - echo "Skipping: random number generator is not glibc." 1>&2 - exit 80;; - - *) exit 1;; # testrandom failed -esac +# Test 6. Should print: 1861389287 661 +ppmpat -argyle2 --color=rgb:00/00/00,rgb:ff/80/80,rgb:e0/e0/e0 12 18 | cksum diff --git a/test/ppmrough.ok b/test/ppmrough.ok deleted file mode 100644 index 83643849..00000000 --- a/test/ppmrough.ok +++ /dev/null @@ -1 +0,0 @@ -378403602 30015 diff --git a/test/ppmrough.rand-ok b/test/ppmrough.rand-ok new file mode 100644 index 00000000..216545c7 --- /dev/null +++ b/test/ppmrough.rand-ok @@ -0,0 +1,3 @@ +000|0 +081|378403602 30015 +082|378403602 30015 diff --git a/test/ppmrough.test b/test/ppmrough.test index cf948f9f..bd4211a3 100755 --- a/test/ppmrough.test +++ b/test/ppmrough.test @@ -2,16 +2,5 @@ # This script tests: ppmrough # Also requires: -testrandom -q -case $? in - 81) - # Should print: 378403602 30015 - ppmrough -randomseed 1 | cksum - ;; - - 8[02-9] | 90) - echo "Skipping: random number generator is not glibc." 1>&2 - exit 80;; - - *) exit 1;; # testrandom failed -esac +# Should print: 378403602 30015 (Glibc and MAC OS) +ppmrough -randomseed 1 | cksum diff --git a/test/ps-flate-roundtrip.ok b/test/ps-flate-roundtrip.ok new file mode 100644 index 00000000..57fb124f --- /dev/null +++ b/test/ps-flate-roundtrip.ok @@ -0,0 +1,3 @@ +1926073387 101484 +1926073387 101484 +1386192571 507420 diff --git a/test/ps-flate-roundtrip.test b/test/ps-flate-roundtrip.test new file mode 100755 index 00000000..de1105f0 --- /dev/null +++ b/test/ps-flate-roundtrip.test @@ -0,0 +1,48 @@ +#! /bin/bash +# This script tests: pnmtops pstopnm +# Also requires: pamtopnm gs zlib + +# This script tests the optional flate (zlib) compression feature of +# pstopnm. +# Flate compression allows you to make smaller output (.ps) files: +# it is useful, but not essential. Flate compression is not neccessary for +# printing pages with postscript printers - which is why many people need +# pnmtops on their systems. + +# Failure message +## This test fails when ghostscript is not available. + +tmpdir=${tmpdir:-/tmp} + +# pstopnm does not use libnetpbm functions for output. +# Output is filtered through pamtopnm. + +# Test 1. Should print: 1926073387 101484 twice +test1_ps=${tmpdir}/testimg1.ps + +for flag in "-ps -flate" "-ps -rle -ascii -flate" + do + pnmtops -nocenter -equalpixels -dpi 72 -noturn ${flag} testimg.ppm \ + > ${test1_ps} && \ + xysize1=`awk '/BoundingBox/ {print "-xsize="$4,"-ysize="$5}' \ + ${test1_ps}` && \ + pstopnm -portrait -xborder=0 -yborder=0 $xysize1 -stdout -quiet \ + ${test1_ps} | pamtopnm | cksum + done + +rm ${test1_ps} + +# Test 2. Should print: 1386192571 507420 +# See comments in ps-roundtrip.test + +test3_ps=${tmpdir}/testimg3.ps +flag="-ps -bitspersample=12 -flate -rle -vmreclaim" +cat testimg.ppm testimg.ppm testimg.ppm testgrid.pbm testgrid.pbm | \ +pnmtops -nocenter -equalpixels -dpi 72 -noturn -setpage ${flag} \ + > ${test3_ps} && +xysize3=`awk '/BoundingBox/ {print "-xsize="$4,"-ysize="$5 ; exit}' \ + ${test3_ps}` && +pstopnm -portrait -xborder=0 -yborder=0 $xysize3 -stdout ${test3_ps} | \ + pamtopnm | cksum + +rm ${test3_ps} diff --git a/test/ps-roundtrip.ok b/test/ps-roundtrip.ok index 0ebfb94a..5ef66cc4 100644 --- a/test/ps-roundtrip.ok +++ b/test/ps-roundtrip.ok @@ -2,7 +2,6 @@ 1926073387 101484 1926073387 101484 1926073387 101484 -1926073387 101484 2918318199 62 2918318199 62 2918318199 62 diff --git a/test/ps-roundtrip.test b/test/ps-roundtrip.test index 873bbdef..207646cc 100755 --- a/test/ps-roundtrip.test +++ b/test/ps-roundtrip.test @@ -4,21 +4,17 @@ # Failure message -## This test fails when: -## (1) zlib was not linked. -## (2) ghostscript is not available. +## This test fails when ghostscript is not available. tmpdir=${tmpdir:-/tmp} # pstopnm does not use libnetpbm functions for output. # Output is filtered through pamtopnm. -# Test 1. Should print: 1926073387 101484 five times -# *NOTE* Fifth iteration fails if pnmtops was compiled without zlib -# (flate compression) support. +# Test 1. Should print: 1926073387 101484 four times test1_ps=${tmpdir}/testimg1.ps -for flag in "" "-ps" "-rle" "-ps -ascii" "-ps -flate" +for flag in "" "-ps" "-rle" "-ps -ascii" do pnmtops -nocenter -equalpixels -dpi 72 -noturn ${flag} testimg.ppm \ > ${test1_ps} && \ @@ -57,8 +53,6 @@ for flag in "" "-rle" "-ps -rle -ascii" \ rm ${grid_ps} ${g_pbm} ${t_pbm} #Test 3. Should print: 1386192571 507420 three times -# *NOTE* Second iteration fails if pnmtops was compiled without zlib -# (flate compression) support. # # Special care is needed when conducting round-trips with multiple-image # files as input. @@ -72,7 +66,7 @@ rm ${grid_ps} ${g_pbm} ${t_pbm} test3_ps=${tmpdir}/testimg3.ps for flag in "" "-ps" \ - "-ps -bitspersample=12 -flate -rle -vmreclaim" + "-ps -bitspersample=12 -rle -vmreclaim" do cat testimg.ppm testimg.ppm testimg.ppm testgrid.pbm testgrid.pbm | \ pnmtops -nocenter -equalpixels -dpi 72 -noturn -setpage ${flag} \ diff --git a/test/rgb3-roundtrip.ok b/test/rgb3-roundtrip.ok index 64da849d..367e5429 100644 --- a/test/rgb3-roundtrip.ok +++ b/test/rgb3-roundtrip.ok @@ -3,4 +3,4 @@ 2425386270 41 0 0 -0 +0 0 : 0 diff --git a/test/rgb3-roundtrip.test b/test/rgb3-roundtrip.test index cac52220..42fd822f 100755 --- a/test/rgb3-roundtrip.test +++ b/test/rgb3-roundtrip.test @@ -41,6 +41,6 @@ rgb3toppm ${testgrid_red} ${testgrid_grn} ${testgrid_blu} | \ cmp -s ${testgrid_red} ${testgrid_grn} ; echo $? cmp -s ${testgrid_grn} ${testgrid_blu} ; echo $? pgmtopgm < testgrid.pbm | cmp -s - ${testgrid_red} - echo $? + echo ${PIPESTATUS[@]} ":" $? rm ${testgrid_pbm} ${testgrid_red} ${testgrid_grn} ${testgrid_blu} diff --git a/test/symmetry.ok b/test/symmetry.ok index 23129684..a5945014 100644 --- a/test/symmetry.ok +++ b/test/symmetry.ok @@ -10,3 +10,9 @@ ok ok ok ok +ok +ok +ok +ok +ok +ok diff --git a/test/symmetry.test b/test/symmetry.test index e6a6b654..52ba6388 100755 --- a/test/symmetry.test +++ b/test/symmetry.test @@ -48,9 +48,11 @@ pgmramp -ell 63 63 > ${circle_pgm} rm ${circle_pgm} -# Test 3. +# Test 3. Should print "ok" 7 times gauss_pgm=${tmpdir}/gauss.pgm -pamgauss -sigma=0.1 -tupletype=GRAYSCALE 25 25 > ${gauss_pgm} +for size in 3 4 5 8 13 21 25 +do +pamgauss -sigma=0.1 -tupletype=GRAYSCALE $size $size > ${gauss_pgm} ( for op in -null -tb -lr -r90 do pamflip $op ${gauss_pgm} | cksum @@ -58,6 +60,8 @@ pamgauss -sigma=0.1 -tupletype=GRAYSCALE 25 25 > ${gauss_pgm} awk '$1==4 && $3>0 { print "ok"; exit }; { print }' rm ${gauss_pgm} +done + # Test 4. kernel_pgm=${tmpdir}/kernel.pgm diff --git a/test/targa-roundtrip.ok b/test/targa-roundtrip.ok index 9a428195..514f970f 100644 --- a/test/targa-roundtrip.ok +++ b/test/targa-roundtrip.ok @@ -1,3 +1,43 @@ +Test 1 2425386270 41 +2425386270 41 +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 +1571496937 33838 +1571496937 33838 +Test 3 +1926073387 101484 +1926073387 101484 +1926073387 101484 1926073387 101484 +Test 4 +0 0 0 : 0 +0 0 0 : 0 +0 0 0 : 0 +0 0 0 : 0 +0 0 0 : 0 +0 0 0 : 0 +Test 5 +0 0 0 : 0 +0 0 0 : 0 +0 0 0 0 : 0 +0 0 0 0 : 0 +0 0 0 0 : 0 +0 0 0 0 : 0 +0 0 0 0 : 0 +0 0 0 0 : 0 diff --git a/test/targa-roundtrip.test b/test/targa-roundtrip.test index f646b8c1..79b01b61 100755 --- a/test/targa-roundtrip.test +++ b/test/targa-roundtrip.test @@ -1,18 +1,80 @@ #! /bin/bash # This script tests: pamtotga tgatoppm -# Also requires: ppmtopgm pgmtopbm pamchannel +# Also requires: ppmtopgm pgmtopbm pamchannel pnmquant pamdepth +tmpdir=${tmpdir:-/tmp} -#Test 1: Should print 2425386270 41, cksum of testgrid.pbm +#Test 1: Should print 2425386270 41, cksum of testgrid.pbm, ten 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" "-cmap16" "-cmap16 -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, ten 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" "-cmap16" "-cmap16 -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 six times + +echo "Test 4" + +test256_ppm=${tmpdir}/test256.ppm +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 ${PIPESTATUS[@]} ":" $? +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 ${PIPESTATUS[@]} ":" $? + 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 ${PIPESTATUS[@]} ":" $? + done + +rm ${test256_31_ppm} diff --git a/test/testrandom.c b/test/testrandom.c index 43414926..5b85a6e8 100644 --- a/test/testrandom.c +++ b/test/testrandom.c @@ -8,6 +8,7 @@ Options: -q : quiet mode + -x : print exit code to stdout, otherwise equivalent to quite mode -v : verbose mode : Use to generate values for new table This is a self-contained program which does not require any libnetpbm @@ -16,11 +17,17 @@ #include <stdio.h> #include <stdlib.h> +#define bool int +#define TRUE 1 +#define FALSE 0 + + /* Exit values */ #define EXIT_ERROR 1 #define EXIT_UNKNOWN 80 #define ISO_GLIBC 81 -/* 82-90: reserved */ +#define MAC_OS 82 +/* 83-90: reserved */ typedef enum {QUIET=0, NORMAL=1, VERBOSE=2} VerbosityLevel; @@ -41,11 +48,15 @@ static struct { /* Sample values returned from our tests */ const char * const name; /* Name for this rand() function */ -} rTable[2] = { +} rTable[3] = { { ISO_GLIBC, /* glibc rand() */ 0x7fffffff, /* 31 bits */ { 217313873, 969144303, 1757357552, 1096307597, 818311031 }, "ISO C glibc rand() or equivalent" }, + { MAC_OS, + 0x7fffffff, /* 31 bits */ + { 63715337, 1416812753, 1073261735, 1594828992, 1547470337 }, + "MAC OS c library rand() or equivalent" }, /* Insert additional entries here */ @@ -59,15 +70,19 @@ static struct { static void parseCommandLine(int const argc, const char * const argv[], - VerbosityLevel * const verbosityP) { + VerbosityLevel * const verbosityP, + bool * const printExitCodeP) { - *verbosityP = NORMAL; /* Initial value */ + *verbosityP = NORMAL; /* Initial value */ + *printExitCodeP = FALSE; /* Initial value */ if (argc == 2) { if (argv[1][0] == '-' && argv[1][2] == '\0') { switch ( argv[1][1] ) { case 'v' : *verbosityP = VERBOSE; break; case 'q' : *verbosityP = QUIET ; break; + case 'x' : *verbosityP = QUIET ; + *printExitCodeP = TRUE ; break; default : fprintf (stderr, "Error: Unrecognized argument: %s\n", argv[1]); exit (EXIT_ERROR); @@ -88,8 +103,9 @@ main(int const argc, const char * const argv[]) { unsigned int i; unsigned int res[5]; VerbosityLevel verbosity; + bool printExitCode; - parseCommandLine(argc, argv, &verbosity); + parseCommandLine(argc, argv, &verbosity, &printExitCode); if (verbosity == VERBOSE) { if (RAND_MAX > 0) @@ -120,12 +136,16 @@ main(int const argc, const char * const argv[]) { fprintf(stderr, "Random number generator is %s.\n", rTable[i].name); + if (printExitCode == TRUE) + printf("%03u", rTable[i].type); exit(rTable[i].type); } } /* No matches */ if (verbosity != QUIET) fprintf(stderr, "Random number generator is of unknown type.\n"); + if (printExitCode == TRUE) + printf("%03u",EXIT_UNKNOWN); exit(EXIT_UNKNOWN); } diff --git a/test/tiff-flate-lzw-roundtrip.ok b/test/tiff-flate-lzw-roundtrip.ok new file mode 100644 index 00000000..4d5597cc --- /dev/null +++ b/test/tiff-flate-lzw-roundtrip.ok @@ -0,0 +1,7 @@ +1079668603 10237 +1079668603 10237 +1079668603 10237 +1079668603 10237 +1079668603 10237 +1079668603 10237 +2425386270 41 diff --git a/test/tiff-flate-lzw-roundtrip.test b/test/tiff-flate-lzw-roundtrip.test new file mode 100755 index 00000000..59d4c483 --- /dev/null +++ b/test/tiff-flate-lzw-roundtrip.test @@ -0,0 +1,34 @@ +#! /bin/bash +# This script tests: pamtotiff tifftopnm +# Also requires: ppmpat + +# Failure message +## If tiff-rountrip.test succeeds and this test fails, the likely +## cause is an old TIFF library which lacks certain compression +## features. + +tmpdir=${tmpdir:-/tmp} + +tartan_ppm=${tmpdir}/testimg40.ppm + +# Make a test image with reduced colors which compresses better +# cksum is 1079668603 10237 + +ppmpat -tartan --color=rgb:32/0d/b7,rgb:31/58/a3,rgb:e9/5e/d4 71 48 | \ + tee ${tartan_ppm} | cksum +pamtotiff ${tartan_ppm} | tifftopnm | cksum + +# test flate compression +pamtotiff -flate ${tartan_ppm} | tifftopnm | cksum + +# test adobeflate compression +pamtotiff -adobeflate ${tartan_ppm} | tifftopnm | cksum + +# test LZW compression +pamtotiff -lzw ${tartan_ppm} | tifftopnm | cksum +pamtotiff -lzw -predictor=1 ${tartan_ppm} | tifftopnm | cksum + +# PBM image: test flate compression +pamtotiff -flate testgrid.pbm | tifftopnm | cksum + +rm ${tartan_ppm} diff --git a/test/tiff-roundtrip.ok b/test/tiff-roundtrip.ok index 0e712ce7..14258de2 100644 --- a/test/tiff-roundtrip.ok +++ b/test/tiff-roundtrip.ok @@ -1,4 +1,38 @@ +PPM-rose 1926073387 101484 1926073387 101484 +1926073387 101484 +1926073387 101484 +1926073387 101484 +PPM-6 +1646869394 29498 +1646869394 29498 +1646869394 29498 +1646869394 29498 +PPM-2 +3743909631 14836 +3743909631 14836 +3743909631 14836 +3743909631 14836 +PPM-gray +603974118 4954 +603974118 4954 +603974118 4954 +603974118 4954 +603974118 4954 +603974118 4954 +PPM-bilevel-black-white +1001018459 4954 +1001018459 4954 +1001018459 4954 +1001018459 4954 +PBM 2425386270 41 2425386270 41 +2425386270 41 +Extract from multi-image TIFF +1926073387 101484 +1646869394 29498 +3743909631 14836 +603974118 4954 +1001018459 4954 diff --git a/test/tiff-roundtrip.test b/test/tiff-roundtrip.test index a99425fa..55aba278 100755 --- a/test/tiff-roundtrip.test +++ b/test/tiff-roundtrip.test @@ -1,23 +1,99 @@ #! /bin/bash # This script tests: pamtotiff tifftopnm -# Also requires: - +# Also requires: ppmpat pampick ppmtopgm # Failure message -## Second test fails if Netpbm was built without the flate library +## If this test fails, the cause may be a problem in the TIFF library. + +tmpdir=${tmpdir:-/tmp} +tartan_ppm=${tmpdir}/tartan.ppm +gingham_ppm=${tmpdir}/gingham.ppm +argylecolor_ppm=${tmpdir}/argyle1.ppm +argylegray_ppm=${tmpdir}/argyle2.ppm +multiimage_tiff=${tmpdir}/multiimage.ppm + +# PPM image +# Should print 1926073387 101484 five times + +echo PPM-rose +pamtotiff testimg.ppm | tifftopnm -headerdump | cksum +pamtotiff -truecolor testimg.ppm -output ${multiimage_tiff} && \ + tifftopnm ${multiimage_tiff} -byrow | cksum +pamtotiff -truecolor -packbits testimg.ppm | tifftopnm | cksum +pamtotiff -truecolor -rowsperstrip=2 testimg.ppm | tifftopnm | cksum +pamtotiff -truecolor -lsb2msb testimg.ppm | \ + tifftopnm -respectfillorder | cksum + +# PPM image with six colors +# Should print 1646869394 29498 four times + +echo PPM-6 +ppmpat -tartan -color=rgb:0/8/8,rgb:8/f/8,rgb:f/f/0 108 91 | \ + tee ${tartan_ppm} | cksum +pamtotiff -truecolor ${tartan_ppm} | tifftopnm | cksum +pamtotiff ${tartan_ppm} | tifftopnm -respectfillorder | cksum +pamtotiff ${tartan_ppm} -append -output ${multiimage_tiff} && \ + tifftopnm ${multiimage_tiff} | pampick 1 | cksum + + +# PPM image with two colors +# Should print 3743909631 14836 four times + +echo PPM-2 +ppmpat -argyle2 -color=rgb:0/0/0,rgb:f/8/f,rgb:0/0/0 61 81 | \ + tee ${argylecolor_ppm} | cksum +pamtotiff -indexbits=2 ${argylecolor_ppm} -append -output ${multiimage_tiff} && \ + tifftopnm ${multiimage_tiff} | pampick 2 | cksum +pamtotiff -indexbits=1 ${argylecolor_ppm} | tifftopnm | cksum +pamtotiff -indexbits=1 -g4 ${argylecolor_ppm} | tifftopnm | cksum + +# PPM image with six shades of gray +# pamtotiff detects the absence of colors and produces a grayscale +# tiff image unless -color is specified +# Pipeline output is PGM unless -color is specified +# Should print 603974118 4954 six times + +echo PPM-gray +ppmpat -gingham3 -color=rgb:0/0/0,rgb:ff/ff/ff,rgb:0/0/0 61 81 | \ + tee ${gingham_ppm} | ppmtopgm | cksum +pamtotiff -color ${gingham_ppm} | tifftopnm | cksum +pamtotiff -indexbits=1,2 -mb -fill ${gingham_ppm} | tifftopnm | cksum +pamtotiff -indexbits=1,2 -mw ${gingham_ppm} | tifftopnm | cksum +pamtotiff -indexbits=1,2,4,8 -mb ${gingham_ppm} | tifftopnm | cksum +pamtotiff -mb ${gingham_ppm} -append -output ${multiimage_tiff} && \ + tifftopnm ${multiimage_tiff} | pampick 3 | cksum + +# PPM image with two shades of gray (bilevel) +# pamtotiff detects the absence of colors and produces a grayscale +# tiff image unless -color is specified +# Pipeline output is PGM unless -color is specified +# Should print 1001018459 4954 four times + +echo PPM-bilevel-black-white +ppmpat -argyle2 -color=rgb:0/0/0,rgb:ff/ff/ff,rgb:0/0/0 61 81 | \ + tee ${argylegray_ppm} | ppmtopgm | cksum +pamtotiff -color -fill ${argylegray_ppm} | tifftopnm | cksum +pamtotiff -indexbits=1 -mw ${argylegray_ppm} | tifftopnm | cksum +pamtotiff -mb ${argylegray_ppm} -append -output ${multiimage_tiff} && \ + tifftopnm ${multiimage_tiff} | pampick 4 | cksum -pamtotiff testimg.ppm 1<>${tmpdir}/test1.tiff && - tifftopnm ${tmpdir}/test1.tiff | cksum +# PBM image +# Should print 2425386270 41 three times -# test flate compression -pamtotiff -flate testimg.ppm 1<>${tmpdir}/test2.tiff && - tifftopnm ${tmpdir}/test2.tiff | cksum +echo PBM +pamtotiff testgrid.pbm | tifftopnm | cksum +pamtotiff -g3 -fill testgrid.pbm | tifftopnm | cksum +pamtotiff -g4 -mb testgrid.pbm -append -output ${multiimage_tiff} && \ + tifftopnm ${multiimage_tiff} | pampick 5 | cksum -pamtotiff testgrid.pbm 1<>${tmpdir}/test3.tiff && - tifftopnm ${tmpdir}/test3.tiff | cksum +# Extract individual images from multi-image tiff file -# test G4 compression -pamtotiff -g4 testgrid.pbm 1<>${tmpdir}/test4.tiff && - tifftopnm ${tmpdir}/test4.tiff | cksum +echo "Extract from multi-image TIFF" +tifftopnm ${multiimage_tiff} | pampick 0 | cksum +tifftopnm ${multiimage_tiff} | pampick 1 | cksum +tifftopnm ${multiimage_tiff} | pampick 2 | cksum +tifftopnm ${multiimage_tiff} | pampick 3 | cksum +tifftopnm ${multiimage_tiff} | pampick 4 | cksum -rm ${tmpdir}/test[1234].tiff +rm ${tartan_ppm} ${gingham_ppm} ${argylecolor_ppm} \ + ${argylegray_ppm} ${multiimage_tiff} \ No newline at end of file diff --git a/test/tiffcmyk-roundtrip.ok b/test/tiffcmyk-roundtrip.ok new file mode 100644 index 00000000..05c0b188 --- /dev/null +++ b/test/tiffcmyk-roundtrip.ok @@ -0,0 +1,5 @@ +match +match +match +match +match diff --git a/test/tiffcmyk-roundtrip.test b/test/tiffcmyk-roundtrip.test new file mode 100755 index 00000000..133c81b7 --- /dev/null +++ b/test/tiffcmyk-roundtrip.test @@ -0,0 +1,42 @@ +#! /bin/bash +# This script tests: pnmtotiffcmyk tifftopnm +# Also requires: pnmpsnr + +# Failure message +## If this test fails, the cause may be a problem in the TIFF library. + +tmpdir=${tmpdir:-/tmp} +tartan_ppm=${tmpdir}/tartan.ppm +output_ppm=${tmpdir}/output.ppm +output_tiff=${tmpdir}/output.tiff + +# Note that color images cannot be tested by the roundtrip method +# because of approximations incurred by converting from RGB to CMYK + +pnmtotiffcmyk testimg.ppm > ${output_tiff} && \ + tifftopnm -headerdump -byrow ${output_tiff} | \ + pnmpsnr -target1=45.0 -target2=59.5 -target3=56.5 - testimg.ppm + + +# Note that "-rowsperstrip=1" does not work +pnmtotiffcmyk -rowsperstrip 1 -lsb2msb testimg.ppm > ${output_tiff} && \ + tifftopnm -respectfillorder -byrow ${output_tiff} | \ + pnmpsnr -target1=45.0 -target2=59.5 -target3=56.5 - testimg.ppm + + +pnmtotiffcmyk -packbits testimg.ppm > ${output_tiff} && \ + tifftopnm -byrow ${output_tiff} | \ + pnmpsnr -target1=45.0 -target2=59.5 -target3=56.5 - testimg.ppm + + +pnmtotiffcmyk -lzw testimg.ppm > ${output_tiff} && \ + tifftopnm -byrow ${output_tiff} | \ + pnmpsnr -target1=45.0 -target2=59.5 -target3=56.5 - testimg.ppm + + +pnmtotiffcmyk -lzw -predictor 2 testimg.ppm > ${output_tiff} && \ + tifftopnm -respectfillorder -byrow ${output_tiff} | \ + pnmpsnr -target1=45.0 -target2=59.5 -target=56.5 - testimg.ppm + + +rm ${output_tiff} diff --git a/test/utahrle-roundtrip.test b/test/utahrle-roundtrip.test index 982b72a9..17f1a6c4 100755 --- a/test/utahrle-roundtrip.test +++ b/test/utahrle-roundtrip.test @@ -2,7 +2,6 @@ # This script tests: pnmtorle rletopnm # Also requires: pamchannel pamtopnm - #Test 1. Should produce 1571496937 33838, cksum of testimg.red pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 | pamtopnm | \ pnmtorle | rletopnm | cksum |