about summary refs log tree commit diff
path: root/test/ps-roundtrip.test
blob: 60ecf60ac86b6e7305145e3aa5af941e3c6d21e5 (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
#! /bin/bash
# This script tests: pnmtops pstopnm
# Also requires: pnmtopnm pamtopnm gs

# Test 1.  Should print: 1926073387 101484
${PBM_TESTPREFIX}pnmtops -nocenter -equalpixels -dpi 72 -noturn 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


# Test 2.  Should print: 2425386270 41
${PBM_TESTPREFIX}pnmtops -nocenter -equalpixels -dpi 72 -noturn \
  testgrid.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


#Test 3. Should print: 1386192571 507420
cat testimg.ppm testimg.ppm testimg.ppm testgrid.pbm testgrid.pbm | \
${PBM_TESTPREFIX}pnmtops -nocenter -equalpixels -dpi 72 -noturn -setpage \
  > ${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


#rm  ${tmpdir}/testgrid.ps  ${tmpdir}/testimg.ps  ${tmpdir}/testimg5.ps
rm   ${tmpdir}/testimg.ps  ${tmpdir}/testimg5.ps
mv ${tmpdir}/testgrid.ps /tmp