diff options
author | Carl Worth <cworth@cworth.org> | 2005-02-15 15:07:25 +0000 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2005-02-15 15:07:25 +0000 |
commit | 8c8ced257379bdca4c37b312cb353e4f592f8cd2 (patch) | |
tree | 53ca08eeb832a9905bd10c7dfbf59c23f4f08abe /test | |
parent | 9597c0b791d68d258618773996da67cf8f07113f (diff) |
Added testsvg script
Diffstat (limited to 'test')
-rwxr-xr-x | test/testsvg | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/test/testsvg b/test/testsvg new file mode 100755 index 00000000..52044294 --- /dev/null +++ b/test/testsvg @@ -0,0 +1,51 @@ +#!/bin/sh + +IMAGEDIFF=./imagediff + +OUTDIR=testsvg-output +REFDIR=testsvg-reference +DIFFDIR=testsvg-diff +IMAGELIST=testsvg-imagelist + +if [ $# -lt 1 ]; then + argv0=`basename $0` + echo "Usage: $argv0 file.svg [...]" >&2 + exit 1; +fi + +mkdir -p $OUTDIR +mkdir -p $DIFFDIR +rm -f $IMAGELIST + +err=0 +for svg in $@; do + svgbase=`basename $svg` + png=${svgbase/\.svg/.png} + outpng=$OUTDIR/$png + refpng=$REFDIR/$png + diffpng=$DIFFDIR/$png +# if xsvg $svg -p $outpng ; then + if svg2png $svg $outpng ; then + if [ -e $refpng ]; then + if diff $refpng $outpng > /dev/null; then + echo "Rendering of $svg matches." >&2 + else + echo "ERROR: Rendering of $svg differs from reference image." >&2 + $IMAGEDIFF $refpng $outpng > $diffpng + echo $refpng $outpng $diffpng >> $IMAGELIST + err=$(($err+1)) + fi + else + echo "WARNING: No reference file found for $svg (looked in $refpng)" >&2 + fi + else + echo "ERROR: Failed to render $svg" >&2 + err=$(($err+1)) + fi +done + +if [ $err -gt 0 ] ; then + echo "Differences found in $err renderings." +else + echo "All renderings matched reference images." +fi |