Blame tests/r_pdf/01_pdf-test.sh

Christoph Galuschka 9c5937
#!/bin/sh
Christoph Galuschka 9c5937
# Author: Christoph Galuschka <tigalch@tigalch.org>
Christoph Galuschka 9c5937
Christoph Galuschka 9c5937
t_Log "Running $0 - Create PDF from postscript from text, and convert PDF back to text and check contents"
Christoph Galuschka 9c5937
Christoph Galuschka 4e53bf
FILE=/etc/redhat-release
Christoph Galuschka 9c5937
FIND='CentOS'
Christoph Galuschka 9c5937
PS_FILE=/var/tmp/test.ps
Christoph Galuschka 9c5937
PDF_FILE=/var/tmp/test.pdf
Christoph Galuschka 9c5937
TEST_FILE=/var/tmp/result
Christoph Galuschka 9c5937
Christoph Galuschka 9c5937
# generate postscript file
Christoph Galuschka 9c5937
enscript -q -p $PS_FILE $FILE
Christoph Galuschka 9c5937
Christoph Galuschka 9c5937
# check-file
Christoph Galuschka 9c5937
t_Log 'Check created PS-File'
Christoph Galuschka 9c5937
grep -q $FIND $PS_FILE
Christoph Galuschka 9c5937
t_CheckExitStatus $?
Christoph Galuschka 9c5937
Christoph Galuschka 9c5937
# convert to PDF
Christoph Galuschka 9c5937
ps2pdf $PS_FILE $PDF_FILE
Christoph Galuschka 9c5937
Christoph Galuschka 9c5937
# read file and check
Christoph Galuschka 9c5937
pdftotext -q $PDF_FILE $TEST_FILE
Christoph Galuschka 9c5937
t_Log 'Check Textfile after conversion'
Christoph Galuschka 9c5937
grep -q $FIND $TEST_FILE
Christoph Galuschka 9c5937
t_CheckExitStatus $?
Christoph Galuschka 9c5937
Christoph Galuschka 9c5937
#clean up
Christoph Galuschka 9c5937
rm -rf $PDF_FILE $TEST_FILE $PS_FILE