diff options
Diffstat (limited to 'test/ppmmix.test')
-rwxr-xr-x | test/ppmmix.test | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/ppmmix.test b/test/ppmmix.test new file mode 100755 index 00000000..e1c6486b --- /dev/null +++ b/test/ppmmix.test @@ -0,0 +1,33 @@ +#! /bin/bash +# This script tests: ppmmix +# Also requires: pamdepth pamenlarge pamsumm pbmmake +# Also requires: pgmtopgm pnminvert ppmtopgm + + +tmpdir=${tmpdir:-/tmp} + +# Test 1. Print a pretty checkerboard pattern +a1_pgm=${tmpdir}/a1.pgm +a2_pgm=${tmpdir}/a2.pgm + +pbmmake -g 8 8 | pgmtopgm > ${a1_pgm} && +pbmmake -g 2 2 | pamenlarge 4 | pgmtopgm > ${a2_pgm} && +ppmmix 0.75 ${a1_pgm} ${a2_pgm} | ppmtopgm | pamdepth 3 -plain && +rm ${a1_pgm} ${a2_pgm} + +# Mix image with itself. +# Output should match input regardless of ratio. +for i in 0 0.5 0.6 1 +do +ppmmix $i testimg.ppm testimg.ppm | cksum +done + +# Mix image with its own inverse. +# Output should be a monotone gray sheet. +a3_ppm=${tmpdir}/a3.ppm + +pnminvert testimg.ppm | ppmmix .5 \ + testimg.ppm - | tee ${a3_ppm} | \ + pamsumm -brief -max && + pamsumm -brief -min ${a3_ppm} && +rm ${a3_ppm} |