about summary refs log tree commit diff
path: root/test/ps-flate-roundtrip.test
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2017-03-28 15:34:36 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2017-03-28 15:34:36 +0000
commitca561223546a7e8acd055d5b2114869dd88f5114 (patch)
tree79a54d551eac6df794c539d8b8924aab217a1941 /test/ps-flate-roundtrip.test
parent8b32628b4c65cdd2b09e877150bbc4bcdd9b6ba7 (diff)
downloadnetpbm-mirror-ca561223546a7e8acd055d5b2114869dd88f5114.tar.gz
netpbm-mirror-ca561223546a7e8acd055d5b2114869dd88f5114.tar.xz
netpbm-mirror-ca561223546a7e8acd055d5b2114869dd88f5114.zip
Copy Development as new Advanced
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@2932 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test/ps-flate-roundtrip.test')
-rwxr-xr-xtest/ps-flate-roundtrip.test48
1 files changed, 48 insertions, 0 deletions
diff --git a/test/ps-flate-roundtrip.test b/test/ps-flate-roundtrip.test
new file mode 100755
index 00000000..de1105f0
--- /dev/null
+++ b/test/ps-flate-roundtrip.test
@@ -0,0 +1,48 @@
+#! /bin/bash
+# This script tests: pnmtops pstopnm
+# Also requires: pamtopnm gs zlib
+
+# This script tests the optional flate (zlib) compression feature of
+# pstopnm.
+# Flate compression allows you to make smaller output (.ps) files:
+# it is useful, but not essential.  Flate compression is not neccessary for
+# printing pages with postscript printers - which is why many people need
+# pnmtops on their systems.
+
+# Failure message
+## This test fails when ghostscript is not available.
+
+tmpdir=${tmpdir:-/tmp}
+
+# pstopnm does not use libnetpbm functions for output.
+# Output is filtered through pamtopnm.
+
+# Test 1.  Should print: 1926073387 101484 twice
+test1_ps=${tmpdir}/testimg1.ps
+
+for flag in "-ps -flate" "-ps -rle -ascii -flate"
+  do
+  pnmtops -nocenter -equalpixels -dpi 72 -noturn ${flag} testimg.ppm \
+    > ${test1_ps} && \
+  xysize1=`awk  '/BoundingBox/ {print "-xsize="$4,"-ysize="$5}' \
+    ${test1_ps}` && \
+  pstopnm -portrait -xborder=0 -yborder=0 $xysize1 -stdout -quiet \
+    ${test1_ps} | pamtopnm | cksum
+  done
+
+rm ${test1_ps}
+
+# Test 2. Should print: 1386192571 507420
+# See comments in ps-roundtrip.test
+
+test3_ps=${tmpdir}/testimg3.ps
+flag="-ps -bitspersample=12 -flate -rle -vmreclaim"
+cat testimg.ppm testimg.ppm testimg.ppm testgrid.pbm testgrid.pbm | \
+pnmtops -nocenter -equalpixels -dpi 72 -noturn -setpage ${flag} \
+  > ${test3_ps} &&
+xysize3=`awk  '/BoundingBox/ {print "-xsize="$4,"-ysize="$5 ; exit}' \
+  ${test3_ps}` &&
+pstopnm -portrait -xborder=0 -yborder=0 $xysize3 -stdout  ${test3_ps} | \
+  pamtopnm | cksum
+
+rm ${test3_ps}