]> gitweb.michael.orlitzky.com - libsvgtiny.git/commitdiff
Extend polyline tests
authorVincent Sanders <vince@kyllikki.org>
Thu, 13 Jun 2024 10:22:55 +0000 (11:22 +0100)
committerVincent Sanders <vince@kyllikki.org>
Mon, 24 Jun 2024 08:55:52 +0000 (09:55 +0100)
test/data/polypoints.mvg [new file with mode: 0644]
test/data/polypoints.svg [new file with mode: 0644]
test/runtest.sh

diff --git a/test/data/polypoints.mvg b/test/data/polypoints.mvg
new file mode 100644 (file)
index 0000000..6a80245
--- /dev/null
@@ -0,0 +1,12 @@
+viewbox 0 0 200 200
+fill none stroke #ff0000 stroke-width 1 path 'M 100 100 L 109 109 ' 
+fill none stroke #ff0000 stroke-width 1 path 'M 100 100 L 100 300 ' 
+fill none stroke #ff0000 stroke-width 1 path 'M -3.40282e+38 -3.40282e+38 L 3.40282e+38 3.40282e+38 ' 
+fill none stroke #008000 stroke-width 1 path 'M 100 109 L 109 100 ' 
+fill none stroke #008000 stroke-width 1 path 'M 100 100 L 112.346 112.346 ' 
+fill none stroke #0000ff stroke-width 1 path 'M 100 104.5 L 109 104.5 ' 
+fill none stroke #0000ff stroke-width 1 path 'M 0 0 L 0 200 ' 
+fill #000000 stroke #112233 stroke-width 1 path 'M 100 100 ' 
+fill #000000 stroke #090909 stroke-width 1 path 'M 100 100 ' 
+fill #000000 stroke #112233 stroke-width 1 path 'M 100 100 ' 
+fill #000000 stroke #112233 stroke-width 1 path 'M 100 100 ' 
diff --git a/test/data/polypoints.svg b/test/data/polypoints.svg
new file mode 100644 (file)
index 0000000..9c83781
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<svg width="200" height="200"  viewPort="0 0 200 200" version="1.1"
+     xmlns="http://www.w3.org/2000/svg">
+
+    <g transform="translate(100,100)">
+        <!-- smallest minimal point set is line from top left to bottom right -->
+        <polyline fill="none" stroke="red" points="0 0 9 9"/>
+
+        <!-- underflow -->
+        <polyline fill="none" stroke="red" points="1e-100-1e-100 0 200"/>
+
+        <!-- overflow -->
+        <polyline fill="none" stroke="red" points="-1e+39-1e+39+1e+39+1e+39"/>
+
+        <!-- really long and strange representations -->
+        <polyline fill="none" stroke="green" points="000000.0000E10 0.900000000000001e1 8.99999999e0-0.0"/>
+
+        <!-- very long numbers -->
+        <polyline fill="none" stroke="green" points="0,0,123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890e-298,0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001234567890e301"/>
+
+        <!-- missing point -->
+        <polyline fill="none" stroke="blue" points="0 4.5 9 4.5 0"/>
+
+        <!-- junk on the end -->
+        <polyline fill="none" stroke="blue" points="  -100-100-100+100-none"/>
+
+        <!-- missing digits -->
+        <polyline stroke="#123" points="0 0 ------9"/>
+        <polyline stroke="rgb(9,9,9)" points="0 0 .....9"/>
+        <polyline stroke="#112233" points="0 0 +e9 9"/>
+        <polyline stroke="#112233" points="0 0 .e9 9"/>
+       
+    </g>
+</svg>
index 708f84a7e582dfb459028ce91effc5c5a486c3d0..35dc17f97cecc0ba259d65e1ec60b62f80998173 100755 (executable)
@@ -25,19 +25,21 @@ SVGTESTS="${SVGTESTS} test/ns-afl-svg/*.svg"
 
 svgdecode()
 {
-    OUTF=$(basename ${1} .svg)
-    CMPF=$(dirname  ${1})/${OUTF}.mvg
+    LEAFNAME=$(basename ${1} .svg) # leaf name of the test file
+    CHECKNAME=$(dirname ${1})/${LEAFNAME}.mvg # name of comparison file
+    OUTNAME=${TEST_OUT}/${LEAFNAME}.mvg # name of the generated output file
+
     echo "SVG:${1}" >> ${TEST_LOG}
-    ${TEST_PATH}/test_decode_svg ${1} 1.0 ${TEST_OUT}/${OUTF}.mvg 2>> ${TEST_LOG}
+    ${TEST_PATH}/test_decode_svg ${1} 1.0 ${OUTNAME} 2>> ${TEST_LOG}
     ECODE=$?
 
-    echo "Exit code:${ECODE}" >> ${TEST_LOG}
     if [ "${ECODE}" -gt 0 ];then
+        echo "Exit code:${ECODE}" >> ${TEST_LOG}
        return ${ECODE}
     fi
 
-    if [ -f "${CMPF}" ]; then
-       cmp ${CMPF} ${TEST_OUT}/${OUTF}.ppm >> ${TEST_LOG} 2>> ${TEST_LOG}
+    if [ -f "${CHECKNAME}" ]; then
+       cmp ${CHECKNAME} ${OUTNAME} >> ${TEST_LOG} 2>> ${TEST_LOG}
        if [ "$?" -ne 0 ]; then
            return 128
        fi