|
1 | 1 | #! /bin/bash
|
2 | 2 | # This script tests: pamcut pnmpaste
|
3 |
| -# Also requires: |
| 3 | +# Also requires: pbmmake pnmpad |
4 | 4 |
|
| 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 |
5 | 14 |
|
6 | 15 | 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