|
Packit |
78deda |
#! /bin/bash
|
|
Packit |
78deda |
# This script tests: pnmtops pstopnm
|
|
Packit |
78deda |
# Also requires: pamtopnm gs zlib
|
|
Packit |
78deda |
|
|
Packit |
78deda |
# This script tests the optional flate (zlib) compression feature of
|
|
Packit |
78deda |
# pstopnm.
|
|
Packit |
78deda |
# Flate compression allows you to make smaller output (.ps) files:
|
|
Packit |
78deda |
# it is useful, but not essential. Flate compression is not neccessary for
|
|
Packit |
78deda |
# printing pages with postscript printers - which is why many people need
|
|
Packit |
78deda |
# pnmtops on their systems.
|
|
Packit |
78deda |
|
|
Packit |
78deda |
# Failure message
|
|
Packit |
78deda |
## This test fails when ghostscript is not available.
|
|
Packit |
78deda |
|
|
Packit |
78deda |
tmpdir=${tmpdir:-/tmp}
|
|
Packit |
78deda |
|
|
Packit |
78deda |
# pstopnm does not use libnetpbm functions for output.
|
|
Packit |
78deda |
# Output is filtered through pamtopnm.
|
|
Packit |
78deda |
|
|
Packit |
78deda |
# Test 1. Should print: 1926073387 101484 twice
|
|
Packit |
78deda |
test1_ps=${tmpdir}/testimg1.ps
|
|
Packit |
78deda |
|
|
Packit |
78deda |
for flag in "-ps -flate" "-ps -rle -ascii -flate"
|
|
Packit |
78deda |
do
|
|
Packit |
78deda |
pnmtops -nocenter -equalpixels -dpi 72 -noturn ${flag} testimg.ppm \
|
|
Packit |
78deda |
> ${test1_ps} && \
|
|
Packit |
78deda |
xysize1=`awk '/BoundingBox/ {print "-xsize="$4,"-ysize="$5}' \
|
|
Packit |
78deda |
${test1_ps}` && \
|
|
Packit |
78deda |
pstopnm -portrait -xborder=0 -yborder=0 $xysize1 -stdout -quiet \
|
|
Packit |
78deda |
${test1_ps} | pamtopnm | cksum
|
|
Packit |
78deda |
done
|
|
Packit |
78deda |
|
|
Packit |
78deda |
rm ${test1_ps}
|
|
Packit |
78deda |
|
|
Packit |
78deda |
# Test 2. Should print: 1386192571 507420
|
|
Packit |
78deda |
# See comments in ps-roundtrip.test
|
|
Packit |
78deda |
|
|
Packit |
78deda |
test3_ps=${tmpdir}/testimg3.ps
|
|
Packit |
78deda |
flag="-ps -bitspersample=12 -flate -rle -vmreclaim"
|
|
Packit |
78deda |
cat testimg.ppm testimg.ppm testimg.ppm testgrid.pbm testgrid.pbm | \
|
|
Packit |
78deda |
pnmtops -nocenter -equalpixels -dpi 72 -noturn -setpage ${flag} \
|
|
Packit |
78deda |
> ${test3_ps} &&
|
|
Packit |
78deda |
xysize3=`awk '/BoundingBox/ {print "-xsize="$4,"-ysize="$5 ; exit}' \
|
|
Packit |
78deda |
${test3_ps}` &&
|
|
Packit |
78deda |
pstopnm -portrait -xborder=0 -yborder=0 $xysize3 -stdout ${test3_ps} | \
|
|
Packit |
78deda |
pamtopnm | cksum
|
|
Packit |
78deda |
|
|
Packit |
78deda |
rm ${test3_ps}
|