about summary refs log tree commit diff
path: root/test/ppmmix.test
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2012-11-24 19:18:45 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2012-11-24 19:18:45 +0000
commit4296fe52a37736b7533b3bf447b29ad7933a3ab4 (patch)
tree87644c5b7e46fb333bcde7903f8dcf0de4964d3d /test/ppmmix.test
parentb3f62ef1f3fb72b5674c4481dd25148fbe51850b (diff)
downloadnetpbm-mirror-4296fe52a37736b7533b3bf447b29ad7933a3ab4.tar.gz
netpbm-mirror-4296fe52a37736b7533b3bf447b29ad7933a3ab4.tar.xz
netpbm-mirror-4296fe52a37736b7533b3bf447b29ad7933a3ab4.zip
New test framework, lots of tests
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1775 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test/ppmmix.test')
-rwxr-xr-xtest/ppmmix.test29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/ppmmix.test b/test/ppmmix.test
new file mode 100755
index 00000000..0f9deedc
--- /dev/null
+++ b/test/ppmmix.test
@@ -0,0 +1,29 @@
+#! /bin/bash
+# This script tests: ppmmix
+# Also requires: pamdepth pamenlarge pamsumm pbmmake
+# Also requires: pgmtopgm pnminvert ppmtopgm
+
+# Print a pretty checkerboard pattern
+${PBM_BINPREFIX}pbmmake -g 8 8 | \
+ ${PBM_BINPREFIX}pgmtopgm > ${tmpdir}/a1.pgm &&
+${PBM_BINPREFIX}pbmmake -g 2 2 | ${PBM_BINPREFIX}pamenlarge 4 | \
+ ${PBM_BINPREFIX}pgmtopgm > ${tmpdir}/a2.pgm &&
+${PBM_TESTPREFIX}ppmmix 0.75 ${tmpdir}/a1.pgm ${tmpdir}/a2.pgm -plain | \
+ ${PBM_BINPREFIX}ppmtopgm | ${PBM_BINPREFIX}pamdepth 3 -plain &&
+rm ${tmpdir}/a1.pgm ${tmpdir}/a2.pgm
+
+# Mix image with itself.
+# Output should match input regardless of ratio. 
+for i in 0 0.5 0.6 1
+do 
+${PBM_TESTPREFIX}ppmmix $i testimg.ppm testimg.ppm | cksum
+done
+
+# Mix image with its own inverse.
+# Output should be a monotone gray sheet.
+${PBM_BINPREFIX}pnminvert testimg.ppm | ${PBM_TESTPREFIX}ppmmix .5 \
+    testimg.ppm - | tee ${tmpdir}/a3.ppm | \
+  ${PBM_BINPREFIX}pamsumm -brief -max &&
+  ${PBM_BINPREFIX}pamsumm -brief -min ${tmpdir}/a3.ppm &&
+
+rm ${tmpdir}/a3.ppm