about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2015-12-19 18:43:17 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2015-12-19 18:43:17 +0000
commit68e75bb869f9bede2634c10d41147d1dc049d1f1 (patch)
treefbfd8457b2de168b3a124b423b637572e4c69e10
parent4efac4cdfc7b0e21346117c4c9a2e75b1bc320d3 (diff)
downloadnetpbm-mirror-68e75bb869f9bede2634c10d41147d1dc049d1f1.tar.gz
netpbm-mirror-68e75bb869f9bede2634c10d41147d1dc049d1f1.tar.xz
netpbm-mirror-68e75bb869f9bede2634c10d41147d1dc049d1f1.zip
Improve pnmpaste tests
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2664 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--test/cut-paste-roundtrip.ok9
-rwxr-xr-xtest/cut-paste-roundtrip.test49
2 files changed, 56 insertions, 2 deletions
diff --git a/test/cut-paste-roundtrip.ok b/test/cut-paste-roundtrip.ok
index 82eac5a8..6e0f9359 100644
--- a/test/cut-paste-roundtrip.ok
+++ b/test/cut-paste-roundtrip.ok
@@ -1 +1,10 @@
+2999529086 101484
 1926073387 101484
+514843768 41
+1880210648 41
+2425386270 41
+2425386270 41
+2425386270 41
+2425386270 41
+2425386270 41
+2425386270 41
diff --git a/test/cut-paste-roundtrip.test b/test/cut-paste-roundtrip.test
index 9f466020..1bb3a7c2 100755
--- a/test/cut-paste-roundtrip.test
+++ b/test/cut-paste-roundtrip.test
@@ -1,7 +1,52 @@
 #! /bin/bash
 # This script tests: pamcut pnmpaste
-# Also requires:
+# Also requires: pbmmake pnmpad
 
+base_ppm=${tmpdir}/base.ppm
+
+# Test 1. Should produce 2999529086 101484
+# (Make a modified base image to prevent false positives.)
+
+pbmmake -g 100 70 | \
+pnmpaste -replace - 50 40 testimg.ppm | tee ${base_ppm} | cksum
+
+# Test 2. Should produce 1926073387 101484
 
 pamcut 50 40 100 70 testimg.ppm | \
-pnmpaste -replace - 50 40 testimg.ppm | cksum
+pnmpaste -replace - 50 40 ${base_ppm} | cksum
+
+rm ${base_ppm}
+
+
+basewhite_pbm=${tmpdir}/basewhite.pbm
+baseblack_pbm=${tmpdir}/baseblack.pbm
+part_pbm=${tmpdir}/part.pbm
+
+# Test 3. Should produce 514843768 41
+# (Make a modified base image to prevent false positives.)
+
+pbmmake -w 5 7 |
+pnmpaste -replace - 7 9 testgrid.pbm | tee ${basewhite_pbm} | cksum
+
+# Test 4. Should produce 1880210648 41
+# (Another modified base image with target area black.)
+
+pbmmake -b 5 7 |
+pnmpaste -replace - 7 9 ${basewhite_pbm} | tee ${baseblack_pbm} | cksum
+
+
+# Test 5. Should produce 2425386270 41 six times.
+
+pamcut 7 9 5 7 testgrid.pbm > ${part_pbm}
+
+pnmpaste -replace ${part_pbm} 7 9 ${basewhite_pbm}  | cksum
+pnmpaste -and     ${part_pbm} 7 9 ${basewhite_pbm}  | cksum
+pnmpaste -or      ${part_pbm} 7 9 ${baseblack_pbm}  | cksum
+pnmpad -left 3 -white ${part_pbm} |\
+              pnmpaste -and - 4 9 ${basewhite_pbm}  | cksum
+pnmpad -left 7 -right 2 -top 1 -black ${part_pbm} |\
+              pnmpaste -or  - 0 8 ${baseblack_pbm}  | cksum
+pnmpaste -xor     ${part_pbm} 7 9 testgrid.pbm  |\
+              pnmpaste -xor ${part_pbm} 7 9 | cksum
+
+rm ${part_pbm} ${basewhite_pbm} ${baseblack_pbm}