summaryrefslogtreecommitdiff
path: root/support/extractpdfmark/test/test-round.sh
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /support/extractpdfmark/test/test-round.sh
Initial commit
Diffstat (limited to 'support/extractpdfmark/test/test-round.sh')
-rwxr-xr-xsupport/extractpdfmark/test/test-round.sh54
1 files changed, 54 insertions, 0 deletions
diff --git a/support/extractpdfmark/test/test-round.sh b/support/extractpdfmark/test/test-round.sh
new file mode 100755
index 0000000000..f5ff6e82d0
--- /dev/null
+++ b/support/extractpdfmark/test/test-round.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+EXTRACTEDPDFMARK=$1
+BASENAME=`basename ${EXTRACTEDPDFMARK} | sed -e "s/-round\(-.\+\)\?\.ps$//"`
+OPTSUFFIX=`echo ${EXTRACTEDPDFMARK} | sed -e "s/^\(.*-round\)\(-.\+\)\?\.ps$/\2/"`
+
+PDF="${BASENAME}.pdf"
+PDF2="${BASENAME}-round${OPTSUFFIX}-test.pdf"
+EXTRACTEDPDFMARK2="${BASENAME}-round${OPTSUFFIX}-test.ps"
+
+if [ ! -e ${PDF} ]; then
+ PDF="${srcdir}/${BASENAME}.pdf"
+fi
+if [ ! -s ${PDF} ]; then
+ # skip
+ exit 77
+fi
+
+case "$OPTSUFFIX" in
+ "-literal" )
+ OPTION="--style=literal"
+ ;;
+ "-literal-escape" )
+ OPTION="--style=literal --escape"
+ ;;
+ "-hex" )
+ OPTION="--style=hex"
+ ;;
+ "-name" )
+ OPTION="--style=name"
+ ;;
+ "-name-escape" )
+ OPTION="--style=name --escape"
+ ;;
+ * )
+ OPTION=""
+ ;;
+esac
+
+if test x"$GHOSTSCRIPT" = x; then
+ # skip
+ exit 77
+fi
+
+${GHOSTSCRIPT} -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=${PDF2} \
+ ${PDF} ${EXTRACTEDPDFMARK}
+${top_builddir}/src/extractpdfmark ${OPTION} -o ${EXTRACTEDPDFMARK2} ${PDF2}
+
+if test x"$DIFF" = x; then
+ # skip
+ exit 77
+fi
+
+${DIFF} -u ${EXTRACTEDPDFMARK} ${EXTRACTEDPDFMARK2}