blob: b7aa816c74413eec55b0edf9f4194a1948e73c1d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
#! /bin/bash
# This script tests: pnmtops pstopnm
# Also requires: pnmtopnm pamtopnm gs pbmmake pnmshear pnmpad pnmcat
# Test 1. Should print: 1926073387 101484 five times
# *NOTE* Fifth iteration fails if pnmtops was compiled without zlib
# (flate compression) support.
for flag in "" "-ps" "-rle" "-ps -ascii" "-ps -flate"
do
${PBM_TESTPREFIX}pnmtops -nocenter -equalpixels -dpi 72 -noturn \
${flag} testimg.ppm \
> ${tmpdir}/testimg.ps
xysize1=`awk '/BoundingBox/ {print "-xsize="$4,"-ysize="$5}' \
${tmpdir}/testimg.ps`
${PBM_TESTPREFIX}pstopnm -xborder=0 -yborder=0 $xysize1 -stdout \
-quiet ${tmpdir}/testimg.ps | \
${PBM_BINPREFIX}pnmtopnm | cksum
done
# Test 2. Should print: 2918318199 62 seven times
# Test image designed to detect problems with run-length compression
#
${PBM_BINPREFIX}pbmmake -g 2 2 > ${tmpdir}/g.pbm
${PBM_BINPREFIX}pbmmake -g 8 4 | \
${PBM_BINPREFIX}pnmshear 45 -noantialias -background=black | \
${PBM_BINPREFIX}pnmpad -right 60 | \
${PBM_BINPREFIX}pnmcat -tb -jright - ${tmpdir}/g.pbm > ${tmpdir}/t.pbm &&
for flag in "" "-rle" "-ps -rle -ascii" \
"-bitspersample=2 -rle" "-ps -bitspersample=4 -rle" \
"-bitspersample=8 -rle" "-ps -bitspersample=12 -rle -dict"
do
${PBM_TESTPREFIX}pnmtops -nocenter -equalpixels -dpi 72 -noturn \
${flag} ${tmpdir}/t.pbm > ${tmpdir}/testgrid.ps &&
xysize2=`awk '/BoundingBox/ {print "-xsize="$4,"-ysize="$5}' \
${tmpdir}/testgrid.ps`
${PBM_TESTPREFIX}pstopnm -xborder=0 -yborder=0 $xysize2 -stdout \
-quiet ${tmpdir}/testgrid.ps -pbm | \
${PBM_BINPREFIX}pnmtopnm | cksum
done
#Test 3. Should print: 1386192571 507420 three times
# *NOTE* Second iteration fails if pnmtops was compiled without zlib
# (flate compression) support.
#
# Special care is needed when conducting round-trips with multiple-image
# files as input.
# (1) pnmtops: -setpage is mandatory
# (2) awk: xy values are taken from the first "BoundingBox" encountered.
# Subsequent BoundingBox values are ignored.
# (3) pstopnm: input must be an ordinary file. Input from stdin
# (by pipe or input redirection: "< file" ) does not work.
#
for flag in "" "-ps" \
"-ps -bitspersample=12 -flate -rle -vmreclaim"
do
cat testimg.ppm testimg.ppm testimg.ppm testgrid.pbm testgrid.pbm | \
${PBM_TESTPREFIX}pnmtops -nocenter -equalpixels -dpi 72 -noturn -setpage \
${flag} > ${tmpdir}/testimg5.ps
xysize3=`awk '/BoundingBox/ {print "-xsize="$4,"-ysize="$5 ; exit}' \
${tmpdir}/testimg5.ps`
${PBM_TESTPREFIX}pstopnm -xborder=0 -yborder=0 $xysize3 \
-stdout ${tmpdir}/testimg5.ps | \
${PBM_BINPREFIX}pnmtopnm | cksum
done
rm ${tmpdir}/testgrid.ps ${tmpdir}/testimg.ps ${tmpdir}/testimg5.ps \
${tmpdir}/t.pbm
|