1#!/bin/bash 2# 3# Copyright 2015 The PDFium Authors 4# Use of this source code is governed by a BSD-style license that can be 5# found in the LICENSE file. 6# 7# Script to generate expected result files. 8 9# Arbitrary timestamp, expressed in seconds since the epoch, used to make sure 10# that tests that depend on the current time are stable. Happens to be the 11# timestamp of the first commit to repo, 2014/5/9 17:48:50. 12TEST_SEED_TIME=1399672130 13 14# Do this before "set -e" so "which" failing is not fatal. 15PNGOPTIMIZER="$(which optipng)" 16 17set -e 18while (( "$#" )); do 19 INFILE="$1" 20 echo $INFILE | grep -qs ' ' && echo space in filename detected && exit 1 21 EVTFILE="${INFILE%.*}.evt" 22 SEND_EVENTS= 23 if [ -f "$EVTFILE" ]; then 24 SEND_EVENTS="--send-events" 25 fi 26 FONT_DIR=`readlink -f third_party/test_fonts` 27 out/Debug/pdfium_test $SEND_EVENTS --time=$TEST_SEED_TIME --png \ 28 --croscore-font-names --font-dir=$FONT_DIR $INFILE 29 RESULTS="$INFILE.*.png" 30 for RESULT in $RESULTS ; do 31 EXPECTED=`echo -n $RESULT | sed 's/[.]pdf[.]/_expected.pdf./'` 32 mv $RESULT $EXPECTED 33 if [ -n "$PNGOPTIMIZER" ]; then 34 "$PNGOPTIMIZER" $EXPECTED 35 fi 36 done 37 shift 38done 39