2009-12-07 Rolf Bjarne Kvinge <RKvinge@novell.com>
[moon.git] / test / xaml2png / run-test.sh
blob9d1c09ac9fe759581c787ff24218962707fdea4e
1 #!/bin/bash
3 mode=$1
4 tst=$2
5 resultprefix=$3
7 if [ x$mode != "xbaseline" -a x$mode != "xtest" ] ; then
8 echo unknown mode: $mode
9 exit 1
12 resultprefix=`basename $tst`
13 resultpng=results/$resultprefix.png
14 basepng=baselines/$resultprefix.png
15 differencespng=differences-$resultprefix.png
17 if test x$mode == "xbaseline"; then
18 echo -n " Generating baseline for test $tst... "
20 ./xaml2png $tst $basepng
22 echo done.
23 elif test x$mode == "xtest"; then
24 echo -n " Running test $tst... "
26 rm -f $resultpng $differencespng
28 ./xaml2png $tst $resultpng
30 # and compare to our baseline
31 if diff $resultpng $basepng >/dev/null; then
32 echo PASSED.
33 rm -f $resultpng
34 else
35 echo FAILED.
36 convert $resultpng $basepng -compose difference -composite $differencespng