diff options
Diffstat (limited to 'test/ppmdim.test')
-rwxr-xr-x | test/ppmdim.test | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/ppmdim.test b/test/ppmdim.test new file mode 100755 index 00000000..27bbc4e1 --- /dev/null +++ b/test/ppmdim.test @@ -0,0 +1,19 @@ +#! /bin/bash +# This script tests: ppmdim +# Also requires: pamfunc pamarith pamsumm + +# Compare ppmdim and pamfunc with various dim factors +# Due to the difference rounding methods, pamfunc produces slightly +# brighter images, by about 0.5 per pixel. +# If the mean difference is between 0 and 0.75 we consider the output +# normal. This works for dim values up to 0.994 . + +for i in 0.125 0.25 0.5 0.75 0.1 0.0117 0.2 0.4 0.333 0.666 0.8 0.9 0.95 + do + ${PBM_TESTPREFIX}ppmdim $i testimg.ppm > ${tmpdir}/dim1.ppm + ${PBM_BINPREFIX}pamfunc -mult=$i testimg.ppm > ${tmpdir}/dim2.ppm + ${PBM_BINPREFIX}pnmarith -diff ${tmpdir}/dim1.ppm ${tmpdir}/dim2.ppm | \ + ${PBM_BINPREFIX}pamsumm -mean -brief | \ + awk '{print $1<0.75 ? "ok" : "fail"}' + done +rm ${tmpdir}/dim[12].ppm |