diff options
| author | Alexander Valavanis <valavanisalex@gmail.com> | 2017-07-29 22:08:00 +0000 |
|---|---|---|
| committer | Alexander Valavanis <valavanisalex@gmail.com> | 2017-07-29 22:08:00 +0000 |
| commit | 8195fe5704ac822671a95d968b5e19e8a9dabf78 (patch) | |
| tree | 93960f15226d46883c20264d782e7058f7f39e5f /testfiles | |
| parent | filter-effects-dialog: Avoid copy-constructor (diff) | |
| parent | *Actually* run tests out of source (diff) | |
| download | inkscape-8195fe5704ac822671a95d968b5e19e8a9dabf78.tar.gz inkscape-8195fe5704ac822671a95d968b5e19e8a9dabf78.zip | |
Merge branch 'master' of gitlab.com:inkscape/inkscape
Diffstat (limited to 'testfiles')
| -rw-r--r-- | testfiles/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | testfiles/rendering_tests/CMakeLists.txt | 12 | ||||
| -rw-r--r-- | testfiles/rendering_tests/README | 24 | ||||
| -rw-r--r-- | testfiles/rendering_tests/expected_rendering/test-empty-large.png | bin | 0 -> 69082 bytes | |||
| -rw-r--r-- | testfiles/rendering_tests/expected_rendering/test-empty.png | bin | 0 -> 6920 bytes | |||
| -rw-r--r-- | testfiles/rendering_tests/test-empty.svg | 65 | ||||
| -rwxr-xr-x | testfiles/rendering_tests/test.sh | 40 |
7 files changed, 143 insertions, 1 deletions
diff --git a/testfiles/CMakeLists.txt b/testfiles/CMakeLists.txt index 388a04b11..e7198a39f 100644 --- a/testfiles/CMakeLists.txt +++ b/testfiles/CMakeLists.txt @@ -28,4 +28,5 @@ foreach(source ${TEST_SOURCES}) add_test(NAME ${source} COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${source}) set_tests_properties(${source} PROPERTIES ENVIRONMENT ${CMAKE_CTEST_ENV}) add_dependencies(tests ${source}) -endforeach()
\ No newline at end of file +endforeach() +add_subdirectory(rendering_tests) diff --git a/testfiles/rendering_tests/CMakeLists.txt b/testfiles/rendering_tests/CMakeLists.txt new file mode 100644 index 000000000..3f838628a --- /dev/null +++ b/testfiles/rendering_tests/CMakeLists.txt @@ -0,0 +1,12 @@ + +#add your test here (do not put the .svg extension) +set(RENDERING_TESTS + test-empty +) + + +foreach(rendering_test ${RENDERING_TESTS}) + add_test(NAME ${rendering_test} COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/test.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/inkscape ${CMAKE_CURRENT_SOURCE_DIR}/${rendering_test} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/testfiles/rendering_tests ) + set_tests_properties(${rendering_test} PROPERTIES ENVIRONMENT ${CMAKE_CTEST_ENV}) +endforeach() + diff --git a/testfiles/rendering_tests/README b/testfiles/rendering_tests/README new file mode 100644 index 000000000..92cf95ef6 --- /dev/null +++ b/testfiles/rendering_tests/README @@ -0,0 +1,24 @@ +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 CMakeLists.txt + - 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 + + diff --git a/testfiles/rendering_tests/expected_rendering/test-empty-large.png b/testfiles/rendering_tests/expected_rendering/test-empty-large.png Binary files differnew file mode 100644 index 000000000..34acf1f26 --- /dev/null +++ b/testfiles/rendering_tests/expected_rendering/test-empty-large.png diff --git a/testfiles/rendering_tests/expected_rendering/test-empty.png b/testfiles/rendering_tests/expected_rendering/test-empty.png Binary files differnew file mode 100644 index 000000000..2e0a5fe1d --- /dev/null +++ b/testfiles/rendering_tests/expected_rendering/test-empty.png diff --git a/testfiles/rendering_tests/test-empty.svg b/testfiles/rendering_tests/test-empty.svg new file mode 100644 index 000000000..3b5ee5a4a --- /dev/null +++ b/testfiles/rendering_tests/test-empty.svg @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="210mm" + height="297mm" + viewBox="0 0 210 297" + version="1.1" + id="svg8" + inkscape:version="0.92.1 r15371" + sodipodi:docname="test-empty.svg"> + <defs + id="defs2" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="0.7" + inkscape:cx="132.86611" + inkscape:cy="438.52092" + inkscape:document-units="mm" + inkscape:current-layer="layer1" + showgrid="false" + inkscape:window-width="1920" + inkscape:window-height="1055" + inkscape:window-x="1920" + inkscape:window-y="0" + inkscape:window-maximized="1" /> + <metadata + id="metadata5"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1"> + <rect + style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.64583325;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.98039216" + id="rect7" + width="92.226196" + height="75.595238" + x="52.160713" + y="46.023808" + rx="6.6565199" + ry="6.6565199" /> + </g> +</svg> diff --git a/testfiles/rendering_tests/test.sh b/testfiles/rendering_tests/test.sh new file mode 100755 index 000000000..a9738e69a --- /dev/null +++ b/testfiles/rendering_tests/test.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +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 +test=$2 +EXPECTED=$(dirname $test)"/expected_rendering/"$(basename $test) +testname=$(basename $test) + + + ${INKSCAPE_EXE} -z ${test}.svg -d 96 -e ${testname}.png #2>/dev/null >/dev/null + compare -metric AE ${testname}.png ${EXPECTED}.png ${testname}-compare.png 2> .tmp + test1=`cat .tmp` + echo $test1 + if [ $test1 == 0 ]; then + echo ${testname} "PASSED" + rm ${testname}.png ${testname}-compare.png + else + echo ${testname} "FAILED" + exit_status=1 + fi + ${INKSCAPE_EXE} -z ${test}.svg -d 384 -e ${testname}-large.png #2>/dev/null >/dev/null + compare -metric AE ${testname}-large.png ${EXPECTED}-large.png ${testname}-compare-large.png 2>.tmp + test2=`cat .tmp` + if [ $test2 == 0 ]; then + echo ${testname}-large "PASSED" + rm ${testname}-large.png ${testname}-compare-large.png + else + echo ${testname}-large "FAILED" + exit_status=1 + fi + +rm .tmp +exit $exit_status |
