Skip to content

Commit 357e630

Browse files
author
giraffedata
committed
Improve pnmpaste tests
git-svn-id: https://svn.code.sf.net/p/netpbm/code/trunk@2664 9d0c8265-081b-0410-96cb-a4ca84ce46f8
1 parent f20ecf9 commit 357e630

File tree

2 files changed

+56
-2
lines changed

2 files changed

+56
-2
lines changed

test/cut-paste-roundtrip.ok

+9
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1+
2999529086 101484
12
1926073387 101484
3+
514843768 41
4+
1880210648 41
5+
2425386270 41
6+
2425386270 41
7+
2425386270 41
8+
2425386270 41
9+
2425386270 41
10+
2425386270 41

test/cut-paste-roundtrip.test

+47-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,52 @@
11
#! /bin/bash
22
# This script tests: pamcut pnmpaste
3-
# Also requires:
3+
# Also requires: pbmmake pnmpad
44

5+
base_ppm=${tmpdir}/base.ppm
6+
7+
# Test 1. Should produce 2999529086 101484
8+
# (Make a modified base image to prevent false positives.)
9+
10+
pbmmake -g 100 70 | \
11+
pnmpaste -replace - 50 40 testimg.ppm | tee ${base_ppm} | cksum
12+
13+
# Test 2. Should produce 1926073387 101484
514

615
pamcut 50 40 100 70 testimg.ppm | \
7-
pnmpaste -replace - 50 40 testimg.ppm | cksum
16+
pnmpaste -replace - 50 40 ${base_ppm} | cksum
17+
18+
rm ${base_ppm}
19+
20+
21+
basewhite_pbm=${tmpdir}/basewhite.pbm
22+
baseblack_pbm=${tmpdir}/baseblack.pbm
23+
part_pbm=${tmpdir}/part.pbm
24+
25+
# Test 3. Should produce 514843768 41
26+
# (Make a modified base image to prevent false positives.)
27+
28+
pbmmake -w 5 7 |
29+
pnmpaste -replace - 7 9 testgrid.pbm | tee ${basewhite_pbm} | cksum
30+
31+
# Test 4. Should produce 1880210648 41
32+
# (Another modified base image with target area black.)
33+
34+
pbmmake -b 5 7 |
35+
pnmpaste -replace - 7 9 ${basewhite_pbm} | tee ${baseblack_pbm} | cksum
36+
37+
38+
# Test 5. Should produce 2425386270 41 six times.
39+
40+
pamcut 7 9 5 7 testgrid.pbm > ${part_pbm}
41+
42+
pnmpaste -replace ${part_pbm} 7 9 ${basewhite_pbm} | cksum
43+
pnmpaste -and ${part_pbm} 7 9 ${basewhite_pbm} | cksum
44+
pnmpaste -or ${part_pbm} 7 9 ${baseblack_pbm} | cksum
45+
pnmpad -left 3 -white ${part_pbm} |\
46+
pnmpaste -and - 4 9 ${basewhite_pbm} | cksum
47+
pnmpad -left 7 -right 2 -top 1 -black ${part_pbm} |\
48+
pnmpaste -or - 0 8 ${baseblack_pbm} | cksum
49+
pnmpaste -xor ${part_pbm} 7 9 testgrid.pbm |\
50+
pnmpaste -xor ${part_pbm} 7 9 | cksum
51+
52+
rm ${part_pbm} ${basewhite_pbm} ${baseblack_pbm}

0 commit comments

Comments
 (0)