about summary refs log tree commit diff
path: root/test/ps-alt-roundtrip.test
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2013-12-13 00:47:15 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2013-12-13 00:47:15 +0000
commitd37a4e36beda69688cabd0d7a56536a48c3e21eb (patch)
treede28c4ec588dd2f016fc20f1ac3960055181a237 /test/ps-alt-roundtrip.test
parent8a7ebe932acc06d8faae7dc3c628d0c703435f1b (diff)
downloadnetpbm-mirror-d37a4e36beda69688cabd0d7a56536a48c3e21eb.tar.gz
netpbm-mirror-d37a4e36beda69688cabd0d7a56536a48c3e21eb.tar.xz
netpbm-mirror-d37a4e36beda69688cabd0d7a56536a48c3e21eb.zip
Add ps-alt-roundtrip test
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2058 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test/ps-alt-roundtrip.test')
-rwxr-xr-xtest/ps-alt-roundtrip.test46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/ps-alt-roundtrip.test b/test/ps-alt-roundtrip.test
new file mode 100755
index 00000000..8ce1689d
--- /dev/null
+++ b/test/ps-alt-roundtrip.test
@@ -0,0 +1,46 @@
+#! /bin/bash
+# This script tests: pbmtoepsi pbmtopsg3 pbmtolps psidtopgm pstopnm
+# Also requires: gs pnmtopnm pnmcrop
+
+# This script is for testing alternative (or minor) utilities that
+# read/write Postscript and encapsulated Postscript:
+# pbmtoepsi, pbmtopsg3, pbmtolps and psidtopgm.
+#
+# We keep these tests separate from those for pnmtops and pstopnm
+# which are far more popular.
+#
+# pbmtopsg3 and pbmtolps produce output that require pstopnm for decoding.
+#
+# If ps-roundtrip.test succeeds and this test fails, it is most likely
+# a problem with one of the minor utilities, and vice versa.
+
+
+# Test 1. Should print: 2425386270 41
+${PBM_TESTPREFIX}pbmtopsg3 -dpi=72 testgrid.pbm \
+     > ${tmpdir}/testgrid1.ps && \
+${PBM_TESTPREFIX}pstopnm -xborder=0 -yborder=0 -llx=0 -lly=-16 -urx=14 \
+    -dpi=72 -stdout -quiet -pbm ${tmpdir}/testgrid1.ps | \
+    ${PBM_BINPREFIX}pnmcrop | cksum
+
+
+# Test 2. Should print: 2425386270 41
+${PBM_TESTPREFIX}pbmtolps -dpi 72 testgrid.pbm \
+     > ${tmpdir}/testgrid2.ps && \
+${PBM_TESTPREFIX}pstopnm -xborder=0 -yborder=0 -dpi=72 -stdout \
+    -quiet ${tmpdir}/testgrid2.ps -pbm | \
+  ${PBM_BINPREFIX}pnmcrop | cksum
+
+
+# Test 3. Should print: 2916080186 235
+# Output is pgm maxval=1 with black and white inverted.
+#
+${PBM_TESTPREFIX}pbmtoepsi testgrid.pbm > ${tmpdir}/testgrid.epsi && \
+xysizebps=`awk  '/BeginPreview/ {print $2,$3,$4}' \
+    ${tmpdir}/testgrid.epsi` && \
+awk '/^%%BeginPreview:/ { p=1; next } /^%%EndImage/ { p=0; next } \
+  p==1 && /%[ \t0-9a-fA-F]+/ { print substr($0,2); next } \
+  p==1 {print "!"$0}' \
+    ${tmpdir}/testgrid.epsi | ${PBM_TESTPREFIX}psidtopgm $xysizebps | cksum
+
+
+rm ${tmpdir}/testgrid[12].ps  ${tmpdir}/testgrid.epsi