diff options
| author | Marc Jeanmougin <marc@jeanmougin.fr> | 2017-07-29 10:41:58 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marc@jeanmougin.fr> | 2017-07-29 10:41:58 +0000 |
| commit | c6e348a272ed1f7f15b6a8ffbd0a257eceb1d022 (patch) | |
| tree | 9669c9d8e35c87c359cdf02669b756de0ccdf572 /testfiles/rendering_tests | |
| parent | undo (diff) | |
| download | inkscape-c6e348a272ed1f7f15b6a8ffbd0a257eceb1d022.tar.gz inkscape-c6e348a272ed1f7f15b6a8ffbd0a257eceb1d022.zip | |
refactor a bit
Diffstat (limited to 'testfiles/rendering_tests')
| -rw-r--r-- | testfiles/rendering_tests/CMakeLists.txt | 7 | ||||
| -rwxr-xr-x | testfiles/rendering_tests/test.sh | 45 |
2 files changed, 15 insertions, 37 deletions
diff --git a/testfiles/rendering_tests/CMakeLists.txt b/testfiles/rendering_tests/CMakeLists.txt new file mode 100644 index 000000000..0e0f43b99 --- /dev/null +++ b/testfiles/rendering_tests/CMakeLists.txt @@ -0,0 +1,7 @@ +set(RENDERING_TESTS + test-empty +) +foreach(rendering_test ${RENDERING_TESTS}) + add_test(NAME ${rendering_test} COMMAND test.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/inkscape ${rendering_test} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/testfiles/rendering_tests ) +endforeach() + diff --git a/testfiles/rendering_tests/test.sh b/testfiles/rendering_tests/test.sh index 153f3a5e9..2a8adf42c 100755 --- a/testfiles/rendering_tests/test.sh +++ b/testfiles/rendering_tests/test.sh @@ -1,45 +1,16 @@ #!/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" $# +if [ "$#" -lt 2 ]; then + echo "pass the path of the inkscape executable as parameter then the name of the test" $# exit 1 fi + +command -v compare >/dev/null 2>&1 || { echo >&2 "I require ImageMagick's 'compare' but it's not installed. Aborting."; exit 1; } + INKSCAPE_EXE=$1 exit_status=0 -for test in $tests -do +test=$2 + ${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` @@ -61,6 +32,6 @@ do echo ${test}-large "FAILED" exit_status=1 fi -done + rm .tmp exit $exit_status |
