diff options
Diffstat (limited to 'Build/tests/largefile/testlfs-thanh')
-rw-r--r-- | Build/tests/largefile/testlfs-thanh/Makefile | 66 | ||||
-rwxr-xr-x | Build/tests/largefile/testlfs-thanh/test-include | 40 | ||||
-rw-r--r-- | Build/tests/largefile/testlfs-thanh/test-lfs.tex | 38 |
3 files changed, 144 insertions, 0 deletions
diff --git a/Build/tests/largefile/testlfs-thanh/Makefile b/Build/tests/largefile/testlfs-thanh/Makefile new file mode 100644 index 00000000000..4ec390eeb38 --- /dev/null +++ b/Build/tests/largefile/testlfs-thanh/Makefile @@ -0,0 +1,66 @@ +default: + +clean: + rm -f image.*-* + +files = \ + Makefile \ + test-lfs.tex \ + test-include \ + image.jbig2 \ + image.png \ + image.jpg + + +image.png: image.jpg + convert image.jpg image.png + +image.jbig2: image.jpg + jbig2 -4 image.jpg > image.jbig2 + +test-include-jpeg-1-page: image.jpg + ./test-include image.jpg 200 1 + +test-include-jpeg-2-pages: image.jpg + ./test-include image.jpg 100 2 + +test-include-png-1-page: image.png + ./test-include image.png 140 1 + +test-include-png-2-pages: image.png + ./test-include image.png 70 2 + +test-include-jbig2-1-page: image.jbig2 + ./test-include image.jbig2 3000 1 + +test-include-jbig2-2-pages: image.jbig2 + ./test-include image.jbig2 1500 2 + +test-include-pdf: + make test-include-jpeg-1-page + ./test-include image.jpg-200-1.pdf 1 1 + +rsync: + rsync -avL $(files) thanhs-desktop:test-lfs/ + +jpeg: + -make test-include-jpeg-2-pages + -make test-include-jpeg-1-page + +png: + -make test-include-png-2-pages + -make test-include-png-1-page + +jbig2: + -make test-include-jbig2-2-pages + -make test-include-jbig2-1-page + +pdf: + -make test-include-pdf + +all: + -make jpeg png jbig2 pdf + +dist: + -rm -f test-lfs.zip + zip test-lfs.zip $(files) diff --git a/Build/tests/largefile/testlfs-thanh/test-include b/Build/tests/largefile/testlfs-thanh/test-include new file mode 100755 index 00000000000..f859cd66b4e --- /dev/null +++ b/Build/tests/largefile/testlfs-thanh/test-include @@ -0,0 +1,40 @@ +#!/bin/bash +# Usage: $0 <image-file> <image-count-per-page> <page-count> +# Example: $0 foo.png 10 2 => include foo.png 10x per page and make 2 pages + +set -e +set -u + +img="$1" +count="$2" +pages="$3" +output="$img-$count-$pages" + +runCmd() { + echo "running '$@'" + "$@" || true + echo "" +} + +# gen test file +cat <<EOT > $output.tex +\input test-lfs.tex +\includeImage $img $count $pages +\end +EOT + +# compile it +runCmd ./pdftex -ini $output.tex + +# validate result +ls -lh $output.pdf +if which pdftoppm > /dev/null; then + echo "check $output.pdf using pdftoppm" + runCmd pdftoppm -r 72 $output.pdf $output + rm -f '*.ppm' || true +fi + +if which gs > /dev/null; then + echo "check $output.pdf using gs" + runCmd gs -q -dNOPAUSE -r72 -sDEVICE=ppmraw -sOutputFile=/dev/null -dBATCH $output.pdf +fi diff --git a/Build/tests/largefile/testlfs-thanh/test-lfs.tex b/Build/tests/largefile/testlfs-thanh/test-lfs.tex new file mode 100644 index 00000000000..06e91877979 --- /dev/null +++ b/Build/tests/largefile/testlfs-thanh/test-lfs.tex @@ -0,0 +1,38 @@ +%% copied from plain.tex {{ +\catcode`\{=1 % left brace is begin-group character +\catcode`\}=2 % right brace is end-group character +\catcode`\$=3 % dollar sign is math shift +\catcode`\&=4 % ampersand is alignment tab +\catcode`\#=6 % hash mark is macro parameter character +\catcode`\^=7 \catcode`\^^K=7 % circumflex and uparrow are for superscripts +% \catcode`\_=8 \catcode`\^^A=8 % underline and downarrow are for subscripts +\catcode`\^^I=10 % ascii tab is a blank space +\chardef\active=13 \catcode`\~=\active % tilde is active +\catcode`\^^L=\active \outer\def^^L{\par} % ascii form-feed is "\outer\par" +\def\loop#1\repeat{\def\body{#1}\iterate} +\def\iterate{\body \let\next\iterate \else\let\next\relax\fi \next} +\let\repeat=\fi % this makes \loop...\if...\repeat skippable +%% }} + +\def\includeImage #1 #2 #3 { + \count1=0 + \count2=#2 + \count3=#3 + \loop + \shipout\vbox{ + \count0=0 + \hsize=20cm + \indent + \loop + \immediate\pdfximage width 1cm height 1cm {#1} + \hbox{\pdfrefximage\pdflastximage} + \hskip 0pt plus \hsize + \advance\count0 1 + \ifnum\count0 < \count2 \repeat + } + \advance\count1 1 + \ifnum\count1 < \count3 \repeat +} +\pdfoutput=1 +\batchmode +\endinput |