summaryrefslogtreecommitdiffstats
path: root/testfiles/rendering_tests/test.sh
blob: c77b5ef0f67a22a3fd67db6424d14c0a04244b2a (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash

### HOWTO ###
# Add a rendering test: 
#  - create the svg file
#  - inkscape <yourfile>.svg -d 96  -e expected_rendering/<yourfile>.png
#  - inkscape <yourfile>.svg -d 384 -e expected_rendering/<yourfile>-large.png
#  - add the test in the list below
#  - use stable if possible to generate the reference png files
#  - git add <yourfile>.svg expected_rendering/<yourfile>-large.png expected_rendering/<yourfile>.png
#  
# Fix a failing test (due to a change in code):
#  - DO *NOT* MODIFY the expected rendering (or the svg) before getting advice from inkscape-devel@
#  - fix your code if possible
#  - IF you change introduces a greater compatibility with css or browsers
#  - AND you cannot reasonably "update" files from older versions to match the appearance
#  - AND inkscape-devel@ has a consensus that it's the only way
#  -> do as you must
#  - manually double check the changes
# Fix a failing test (due to a change in pixman or cairo):
#  - update renderings. Use a *stable* version to generate the renderings, NOT TRUNK
#  - manually check appearances
#############

### test list ###

tests="\
    test-empty\
    "

### script ###



if [ "$#" -lt 1 ]; then
    echo "pass the path of the inkscape executable as parameter" $#
    exit 1
fi
INKSCAPE_EXE=$1
exit_status=0
for test in $tests
do
    ${INKSCAPE_EXE} -z ${test}.svg -d 96  -e ${test}.png #2>/dev/null >/dev/null
    compare -metric AE ${test}.png expected_rendering/${test}.png ${test}-compare.png 2> .tmp 
    test1=`cat .tmp`
    echo $test1
    if [ $test1 == 0 ]; then
        echo ${test} "PASSED"
        rm ${test}.png ${test}-compare.png
    else
        echo ${test} "FAILED"
        exist_status=1
    fi
    ${INKSCAPE_EXE} -z ${test}.svg -d 384 -e ${test}-large.png #2>/dev/null >/dev/null
    compare -metric AE ${test}-large.png expected_rendering/${test}-large.png ${test}-compare-large.png 2>.tmp 
    test2=`cat .tmp`
    if [ $test2 == 0 ]; then
        echo ${test}-large "PASSED"
        rm ${test}-large.png ${test}-compare-large.png
    else
        echo ${test}-large "FAILED"
    fi
done
rm .tmp
exit $exit_status