summaryrefslogtreecommitdiff
path: root/test/check-pdf-structure.sh
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2023-02-19 21:10:58 +1030
committerAdrian Johnson <ajohnson@redneon.com>2023-04-18 18:27:12 +0930
commitb53b48116e610d61cdf630c24a11b59a18345e16 (patch)
tree3bc8f3410e795ce81c1408b9d7f3a217033d29ba /test/check-pdf-structure.sh
parente7ed40a71dac04cb4c608b409b04577d01f08454 (diff)
downloadcairo-b53b48116e610d61cdf630c24a11b59a18345e16.tar.gz
Make cairo_tag_begin/end work correctly in groups
Fixes #508
Diffstat (limited to 'test/check-pdf-structure.sh')
-rwxr-xr-xtest/check-pdf-structure.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/check-pdf-structure.sh b/test/check-pdf-structure.sh
new file mode 100755
index 000000000..31ae5ac2c
--- /dev/null
+++ b/test/check-pdf-structure.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+if test $# -ne 4 ; then
+ echo "Usage: $0 <pdf-file> <pdfinfo-output> <pdfinfo-ref> <diff-output>"
+ exit 3
+fi
+
+# Check for pdfinfo version >= 21.10.00
+if pdfinfo -v 2>& 1 | awk '/pdfinfo version/ { split($3,v,/[.]/); if (v[1] > 21 || (v[1] == 21 && v[2] >= 10) ) { print "yes" } } ' | grep -q 'yes'; then
+ pdfinfo -struct-text "$1" > "$2"
+ if test -f "$3" ; then
+ diff -u "$3" "$2" > "$4"
+ # diff exit codes: 0 = match, 1 = different, 2 = error
+ exit $?
+ else
+ exit 3 # missing ref file
+ fi
+fi
+
+ # pdfinfo missing or wrong version
+exit 4