summaryrefslogtreecommitdiff
path: root/Build/tests/largefile/pdfimage.test
blob: 0b66acafe6c14de4411a786061db99e80bf98b27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#! /bin/sh
#
# Copyright (C) 2012 Peter Breitenlohner <tex-live@tug.org>
# You may freely use, modify and/or distribute this file.

usage () {
  echo "usage: $0 PDFTEX-ENGINE IMG" >&2
  echo "	test that pdfTeX can create PDF files with >2GB" >&2
  echo "	using various jpeg, png, jbig2, and pdf images" >&2
  echo "" >&2
  echo "	where PDFTEX-ENGINE is the path to pdfTeX (or perhaps luaTeX)" >&2
  echo "" >&2
  echo "	and IMG is jpeg-1, jpeg-2, or jpeg for both," >&2
  echo "		png-1, png-2, or png for both," >&2
  echo "		jbig2-1, jbig2-2, or jbig2 for both," >&2
  echo "		pdf, or all for all of them" >&2
  exit 1
}

test -n "$1" && test -x "$1" || usage

dir=`dirname "$0"`
TEXMFCNF=`cd "$dir" && pwd`
export TEXMFCNF

PDFTEX=`dirname "$1"`/`basename "$1"`

echo testing "'$PDFTEX'"
echo
"$PDFTEX" -ini pdfimage || {
  echo could not create pdfimage format
  echo FAIL: pdfimage.test
  exit 1
  }

jpeg_1=jpg_200_1
jpeg_2=jpg_100_2_s
png_1=png_140_1
png_2=png_70_2_s
jbig2_1=jbig2_3000_1
jbig2_2=jbig2_1500_2_s
pdf_1=jpg-200-1.pdf_1_1

case $2 in
  jpeg-1) list=$jpeg_1;;
  jpeg-2) list=$jpeg_2;;
  jpeg) list="$jpeg_1 $jpeg_2";;
  png-1) list=$png_1;;
  png-2) list=$png_2;;
  png) list="$png_1 $png_2";;
  jbig2-1) list=$jbig2_1;;
  jbig2-2) list=$jbig2_2;;
  jbig2) list="$jbig2_1 $jbig2_2";;
  pdf) list="$jpeg_1 $pdf_1";;
  all) list="$jpeg_1 $jpeg_2 $png_1 $png_2 $jbig2_1 $jbig2_2 $pdf_1";;
  *) usage;;
esac

exit_fail () {
  echo
  echo FAIL: pdfimage.test
  exit 1
}

ls_list=

test_one () {
  file=image.$1-$2-$3
  echo "testing $file"
  if "$PDFTEX" -fmt=pdfimage -jobname=$file pdfimage; then
    if grep "^Output written.*($3 page$4," $file.log >/dev/null; then
      ls_list="$ls_list
      `ls -lh $file.pdf`"
    else
      exit_fail
    fi
  else
    exit_fail
  fi
}

for l in $list; do
  test_one `echo $l | tr '_' ' '`
done

echo
echo "$ls_list"
echo PASS: pdfimage.test
rm -f pdfimage.fmt pdfimage.log