summaryrefslogtreecommitdiffstats
path: root/testfiles/rendering_tests/test.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:24:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:24:48 +0000
commitcca66b9ec4e494c1d919bff0f71a820d8afab1fa (patch)
tree146f39ded1c938019e1ed42d30923c2ac9e86789 /testfiles/rendering_tests/test.sh
parentInitial commit. (diff)
downloadinkscape-12fc8abae6d434cac7670a59ed3a67301cc2eb10.tar.xz
inkscape-12fc8abae6d434cac7670a59ed3a67301cc2eb10.zip
Adding upstream version 1.2.2.upstream/1.2.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testfiles/rendering_tests/test.sh')
-rwxr-xr-xtestfiles/rendering_tests/test.sh46
1 files changed, 46 insertions, 0 deletions
diff --git a/testfiles/rendering_tests/test.sh b/testfiles/rendering_tests/test.sh
new file mode 100755
index 0000000..e31376d
--- /dev/null
+++ b/testfiles/rendering_tests/test.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+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} --export-png-use-dithering false --export-filename=${testname}.png -d 96 ${test}.svg #2>/dev/null >/dev/null
+ compare -metric AE ${testname}.png ${EXPECTED}.png ${testname}-compare.png 2> ${testname}-result.txt
+ test1=`cat ${testname}-result.txt`
+ echo $test1
+ if [ "$test1" = 0 ]; then
+ echo ${testname} "PASSED"
+ rm ${testname}.png ${testname}-compare.png
+ else
+ echo ${testname} "FAILED"
+ exit_status=1
+ fi
+
+if [ -f "${EXPECTED}-large.png" ]; then
+ ${INKSCAPE_EXE} --export-png-use-dithering false --export-filename=${testname}-large.png -d 384 ${test}.svg #2>/dev/null >/dev/null
+ compare -metric AE ${testname}-large.png ${EXPECTED}-large.png ${testname}-compare-large.png 2> ${testname}-result.txt
+ test2=`cat ${testname}-result.txt`
+ 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
+else
+ echo ${testname}-large "SKIPPED"
+fi
+
+rm ${testname}-result.txt
+exit $exit_status