diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2018-12-29 16:32:28 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2018-12-29 16:32:28 +0000 |
commit | ee250e7490cbb3550fed22fdb98b7152cce20b72 (patch) | |
tree | 83fd278faf86341c5495567396e5abea2ec1a4a4 /test/pnmpaste-pbm.test | |
parent | ebf403d4015d30f19a37895efdce201300c9b418 (diff) | |
download | netpbm-mirror-ee250e7490cbb3550fed22fdb98b7152cce20b72.tar.gz netpbm-mirror-ee250e7490cbb3550fed22fdb98b7152cce20b72.tar.xz netpbm-mirror-ee250e7490cbb3550fed22fdb98b7152cce20b72.zip |
Promote current Development release as Advanced
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@3468 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} |