blob: 5204429488c399acd17b6b0f56650eced89d7ea1 (
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
|
#!/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
|