diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2018-12-22 17:11:33 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2018-12-22 17:11:33 +0000 |
commit | 7b42fdfafb461b568a259870de22c34d4b4e1343 (patch) | |
tree | 2dc9fc53cea7d039725e01a49f4ba091896d6a6a /test/pnmpaste-pbm.test | |
parent | 79e5c046891c7dbe74fb28af94dc0166bb76df31 (diff) | |
download | netpbm-mirror-7b42fdfafb461b568a259870de22c34d4b4e1343.tar.gz netpbm-mirror-7b42fdfafb461b568a259870de22c34d4b4e1343.tar.xz netpbm-mirror-7b42fdfafb461b568a259870de22c34d4b4e1343.zip |
Add tests
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3462 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test/pnmpaste-pbm.test')
-rwxr-xr-x | test/pnmpaste-pbm.test | 47 |
1 files changed, 47 insertions, 0 deletions
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} |