diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/svg/painting/parsing | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/svg/painting/parsing')
61 files changed, 1496 insertions, 0 deletions
diff --git a/testing/web-platform/tests/svg/painting/parsing/color-interpolation-computed.svg b/testing/web-platform/tests/svg/painting/parsing/color-interpolation-computed.svg new file mode 100644 index 0000000000..c437a0a908 --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/color-interpolation-computed.svg @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: getComputedStyle().colorInterpolation</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#ColorInterpolationProperty"/> + <h:meta name="assert" content="color-interpolation computed value is as specified."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/computed-testcommon.js"/> + <script><![CDATA[ + +test_computed_value("color-interpolation", "auto"); +test_computed_value("color-interpolation", "srgb"); +test_computed_value("color-interpolation", "linearrgb"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/color-interpolation-invalid.svg b/testing/web-platform/tests/svg/painting/parsing/color-interpolation-invalid.svg new file mode 100644 index 0000000000..11fd05be07 --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/color-interpolation-invalid.svg @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing color-interpolation with invalid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#ColorInterpolationProperty"/> + <h:meta name="assert" content="color-interpolation supports only the grammar 'auto | sRGB | linearRGB'."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_invalid_value("color-interpolation", "none"); +test_invalid_value("color-interpolation", "auto srgb"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/color-interpolation-valid.svg b/testing/web-platform/tests/svg/painting/parsing/color-interpolation-valid.svg new file mode 100644 index 0000000000..9465edb232 --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/color-interpolation-valid.svg @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing color-interpolation with valid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#ColorInterpolationProperty"/> + <h:meta name="assert" content="color-interpolation supports the full grammar 'auto | sRGB | linearRGB'."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_valid_value("color-interpolation", "auto"); +test_valid_value("color-interpolation", "srgb"); +test_valid_value("color-interpolation", "linearrgb"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/fill-computed.svg b/testing/web-platform/tests/svg/painting/parsing/fill-computed.svg new file mode 100644 index 0000000000..7012fb6ca6 --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/fill-computed.svg @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: getComputedStyle().fill</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#FillProperty"/> + <h:meta name="assert" content="fill computed value is as specified, with url values absolute."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/computed-testcommon.js"/> + <script><![CDATA[ + +test_computed_value("fill", "none"); +test_computed_value("fill", "rgb(12, 34, 56)"); + +test_computed_value("fill", 'url("https://example.com/")'); +test_computed_value("fill", 'url("https://example.com/") none'); +test_computed_value("fill", 'url("https://example.com/") rgb(12, 34, 56)'); + +// context-fill and context-stroke are not yet supported by browsers. + +test(() => { + const target = document.getElementById('target'); + target.style['fill'] = 'url("a.b#c")'; + const result = getComputedStyle(target)['fill']; + const resolved = new URL("a.b#c", document.URL).href; + assert_equals(result, 'url("' + resolved + '")'); +}, 'url values are made absolute'); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/fill-invalid.svg b/testing/web-platform/tests/svg/painting/parsing/fill-invalid.svg new file mode 100644 index 0000000000..1feb867c3a --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/fill-invalid.svg @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing fill with invalid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#FillProperty"/> + <h:meta name="assert" content="fill supports only the paint grammar 'none | color | url [none | color]? | context-fill | context-stroke'."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_invalid_value("fill", "auto"); +test_invalid_value("fill", "none red"); +test_invalid_value("fill", 'none url("https://example.com/")'); +test_invalid_value("fill", 'red url("https://example.com/")'); +test_invalid_value("fill", 'url("https://example.com/") none red'); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/fill-opacity-computed.svg b/testing/web-platform/tests/svg/painting/parsing/fill-opacity-computed.svg new file mode 100644 index 0000000000..16843bccee --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/fill-opacity-computed.svg @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: getComputedStyle().fillOpacity</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#FillOpacity"/> + <h:meta name="assert" content="fill-opacity computed value is clamped to the range [0,1]."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/computed-testcommon.js"/> + <script><![CDATA[ + +test_computed_value("fill-opacity", "-1", "0"); +test_computed_value("fill-opacity", "0.5"); +test_computed_value("fill-opacity", "3", "1"); +test_computed_value("fill-opacity", "-100%", "0"); +test_computed_value("fill-opacity", "50%", "0.5"); +test_computed_value("fill-opacity", "300%", "1"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/fill-opacity-invalid.svg b/testing/web-platform/tests/svg/painting/parsing/fill-opacity-invalid.svg new file mode 100644 index 0000000000..86726c6ad0 --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/fill-opacity-invalid.svg @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing fill-opacity with invalid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#FillOpacityProperty"/> + <h:meta name="assert" content="fill-opacity supports only the grammar 'alpha-value'."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_invalid_value("fill-opacity", "1."); +test_invalid_value("fill-opacity", "2 3"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/fill-opacity-valid.svg b/testing/web-platform/tests/svg/painting/parsing/fill-opacity-valid.svg new file mode 100644 index 0000000000..90d2732b18 --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/fill-opacity-valid.svg @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing fill-opacity with valid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#FillOpacityProperty"/> + <h:meta name="assert" content="fill-opacity supports the full grammar 'alpha-value'."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_valid_value("fill-opacity", "-1"); +test_valid_value("fill-opacity", "0.5"); +test_valid_value("fill-opacity", "3"); +test_valid_value("fill-opacity", "-100%", "-1"); +test_valid_value("fill-opacity", "50%", "0.5"); +test_valid_value("fill-opacity", "300%", "3"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/fill-rule-computed.svg b/testing/web-platform/tests/svg/painting/parsing/fill-rule-computed.svg new file mode 100644 index 0000000000..293450e13c --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/fill-rule-computed.svg @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: getComputedStyle().fillRule</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#FillRuleProperty"/> + <h:meta name="assert" content="fill-rule computed value is as specified."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/computed-testcommon.js"/> + <script><![CDATA[ + +test_computed_value("fill-rule", "nonzero"); +test_computed_value("fill-rule", "evenodd"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/fill-rule-invalid.svg b/testing/web-platform/tests/svg/painting/parsing/fill-rule-invalid.svg new file mode 100644 index 0000000000..d89a81acbb --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/fill-rule-invalid.svg @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing fill-rule with invalid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#FillRuleProperty"/> + <h:meta name="assert" content="fill-rule supports only the grammar 'nonzero | evenodd'."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_invalid_value("fill-rule", "auto"); +test_invalid_value("fill-rule", "nonzero evenodd"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/fill-rule-valid.svg b/testing/web-platform/tests/svg/painting/parsing/fill-rule-valid.svg new file mode 100644 index 0000000000..5112bda894 --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/fill-rule-valid.svg @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing fill-rule with valid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#FillRuleProperty"/> + <h:meta name="assert" content="fill-rule supports the full grammar 'nonzero | evenodd'."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_valid_value("fill-rule", "nonzero"); +test_valid_value("fill-rule", "evenodd"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/fill-valid.svg b/testing/web-platform/tests/svg/painting/parsing/fill-valid.svg new file mode 100644 index 0000000000..d5bb5ceb0f --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/fill-valid.svg @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing fill with valid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#FillProperty"/> + <h:meta name="assert" content="fill supports the full paint grammar 'none | color | url [none | color]? | context-fill | context-stroke'."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_valid_value("fill", "none"); +test_valid_value("fill", "context-fill"); +test_valid_value("fill", "context-stroke"); +test_valid_value("fill", "rgb(12, 34, 56)"); + +test_valid_value("fill", 'url("https://example.com/")'); +test_valid_value("fill", 'url("https://example.com/") none'); +test_valid_value("fill", 'url("https://example.com/") rgb(12, 34, 56)'); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/image-rendering-computed.svg b/testing/web-platform/tests/svg/painting/parsing/image-rendering-computed.svg new file mode 100644 index 0000000000..c842e05906 --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/image-rendering-computed.svg @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: getComputedStyle().imageRendering</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#ImageRenderingProperty"/> + <h:meta name="assert" content="image-rendering computed value is as specified."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/computed-testcommon.js"/> + <script><![CDATA[ + +test_computed_value("image-rendering", "auto"); +test_computed_value("image-rendering", "optimizequality"); +test_computed_value("image-rendering", "optimizespeed"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/image-rendering-invalid.svg b/testing/web-platform/tests/svg/painting/parsing/image-rendering-invalid.svg new file mode 100644 index 0000000000..5c3cc9f054 --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/image-rendering-invalid.svg @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing image-rendering with invalid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#ImageRenderingProperty"/> + <h:meta name="assert" content="image-rendering supports only the grammar 'auto | optimizeQuality | optimizeSpeed'."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_invalid_value("image-rendering", "optimizelegibility"); +test_invalid_value("image-rendering", "auto optimizequality"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/image-rendering-valid.svg b/testing/web-platform/tests/svg/painting/parsing/image-rendering-valid.svg new file mode 100644 index 0000000000..18402493f3 --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/image-rendering-valid.svg @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing image-rendering with valid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#ImageRenderingProperty"/> + <h:meta name="assert" content="image-rendering supports the full grammar 'auto | optimizeQuality | optimizeSpeed'."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_valid_value("image-rendering", "auto"); +test_valid_value("image-rendering", "optimizequality"); +test_valid_value("image-rendering", "optimizespeed"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/marker-computed.svg b/testing/web-platform/tests/svg/painting/parsing/marker-computed.svg new file mode 100644 index 0000000000..329dedbbce --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/marker-computed.svg @@ -0,0 +1,27 @@ +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: getComputedStyle().marker</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#MarkerProperty"/> + <h:meta name="assert" content="marker computed value is as specified, with url values absolute."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/computed-testcommon.js"/> + <script><![CDATA[ + +test_computed_value("marker", "none"); +test_computed_value("marker", 'url("https://example.com/")'); + +test(() => { + const target = document.getElementById('target'); + target.style['marker'] = 'url("a.b#c")'; + const result = getComputedStyle(target)['marker']; + const resolved = new URL("a.b#c", document.URL).href; + assert_equals(result, 'url("' + resolved + '")'); +}, 'url values are made absolute'); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/marker-end-computed.svg b/testing/web-platform/tests/svg/painting/parsing/marker-end-computed.svg new file mode 100644 index 0000000000..da641abb94 --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/marker-end-computed.svg @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: getComputedStyle().MarkerEnd</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#MarkerEndProperty"/> + <h:meta name="assert" content="marker-end computed value is as specified, with url values absolute."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/computed-testcommon.js"/> + <script><![CDATA[ + +test_computed_value("marker-end", "none"); +test_computed_value("marker-end", 'url("https://example.com/")'); + +test(() => { + const target = document.getElementById('target'); + target.style['marker-end'] = 'url("a.b#c")'; + const result = getComputedStyle(target)['marker-end']; + const resolved = new URL("a.b#c", document.URL).href; + assert_equals(result, 'url("' + resolved + '")'); +}, 'url values are made absolute'); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/marker-end-invalid.svg b/testing/web-platform/tests/svg/painting/parsing/marker-end-invalid.svg new file mode 100644 index 0000000000..bc8e5fcc8b --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/marker-end-invalid.svg @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing marker-end with invalid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#MarkerEndProperty"/> + <h:meta name="assert" content="marker-end supports only the paint grammar 'none | marker-ref'."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_invalid_value("marker-end", "auto"); +test_invalid_value("marker-end", 'none url("https://example.com/")'); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/marker-end-valid.svg b/testing/web-platform/tests/svg/painting/parsing/marker-end-valid.svg new file mode 100644 index 0000000000..5be036e994 --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/marker-end-valid.svg @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing marker-end with valid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#MarkerEndProperty"/> + <h:meta name="assert" content="marker-end supports the full paint grammar 'none | marker-ref'."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_valid_value("marker-end", "none"); + +test_valid_value("marker-end", 'url("https://example.com/")'); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/marker-invalid.svg b/testing/web-platform/tests/svg/painting/parsing/marker-invalid.svg new file mode 100644 index 0000000000..64112cd6a7 --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/marker-invalid.svg @@ -0,0 +1,19 @@ +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing marker with invalid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#MarkerProperty"/> + <h:meta name="assert" content="marker supports only the paint grammar 'none | marker-ref'."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_invalid_value("marker", "auto"); +test_invalid_value("marker", 'none url("https://example.com/")'); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/marker-mid-computed.svg b/testing/web-platform/tests/svg/painting/parsing/marker-mid-computed.svg new file mode 100644 index 0000000000..eddfd61711 --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/marker-mid-computed.svg @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: getComputedStyle().markerMid</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#MarkerMidProperty"/> + <h:meta name="assert" content="marker-mid computed value is as specified, with url values absolute."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/computed-testcommon.js"/> + <script><![CDATA[ + +test_computed_value("marker-mid", "none"); +test_computed_value("marker-mid", 'url("https://example.com/")'); + +test(() => { + const target = document.getElementById('target'); + target.style['marker-mid'] = 'url("a.b#c")'; + const result = getComputedStyle(target)['marker-mid']; + const resolved = new URL("a.b#c", document.URL).href; + assert_equals(result, 'url("' + resolved + '")'); +}, 'url values are made absolute'); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/marker-mid-invalid.svg b/testing/web-platform/tests/svg/painting/parsing/marker-mid-invalid.svg new file mode 100644 index 0000000000..25cfbba82e --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/marker-mid-invalid.svg @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing marker-mid with invalid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#MarkerMidProperty"/> + <h:meta name="assert" content="marker-mid supports only the paint grammar 'none | marker-ref'."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_invalid_value("marker-mid", "auto"); +test_invalid_value("marker-mid", 'none url("https://example.com/")'); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/marker-mid-valid.svg b/testing/web-platform/tests/svg/painting/parsing/marker-mid-valid.svg new file mode 100644 index 0000000000..119fd706b1 --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/marker-mid-valid.svg @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing marker-mid with valid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#MarkerMidProperty"/> + <h:meta name="assert" content="marker-mid supports the full paint grammar 'none | marker-ref'."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_valid_value("marker-mid", "none"); + +test_valid_value("marker-mid", 'url("https://example.com/")'); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/marker-shorthand.svg b/testing/web-platform/tests/svg/painting/parsing/marker-shorthand.svg new file mode 100644 index 0000000000..930a4e2940 --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/marker-shorthand.svg @@ -0,0 +1,28 @@ +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: marker sets longhands</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#MarkerProperty"/> + <h:meta name="assert" content="marker supports the full paint grammar 'none | marker-ref'."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/shorthand-testcommon.js"/> + <script><![CDATA[ + +test_shorthand_value('marker', 'none', { + 'marker-start': 'none', + 'marker-mid': 'none', + 'marker-end': 'none' +}); + +test_shorthand_value('marker', 'url("https://example.com/")', { + 'marker-start': 'url("https://example.com/")', + 'marker-mid': 'url("https://example.com/")', + 'marker-end': 'url("https://example.com/")' +}); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/marker-start-computed.svg b/testing/web-platform/tests/svg/painting/parsing/marker-start-computed.svg new file mode 100644 index 0000000000..08ef87516f --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/marker-start-computed.svg @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: getComputedStyle().markerStart</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#MarkerStartProperty"/> + <h:meta name="assert" content="marker-start computed value is as specified, with url values absolute."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/computed-testcommon.js"/> + <script><![CDATA[ + +test_computed_value("marker-start", "none"); +test_computed_value("marker-start", 'url("https://example.com/")'); + +test(() => { + const target = document.getElementById('target'); + target.style['marker-start'] = 'url("a.b#c")'; + const result = getComputedStyle(target)['marker-start']; + const resolved = new URL("a.b#c", document.URL).href; + assert_equals(result, 'url("' + resolved + '")'); +}, 'url values are made absolute'); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/marker-start-invalid.svg b/testing/web-platform/tests/svg/painting/parsing/marker-start-invalid.svg new file mode 100644 index 0000000000..6c1fdbcd4b --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/marker-start-invalid.svg @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing marker-start with invalid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#MarkerStartProperty"/> + <h:meta name="assert" content="marker-start supports only the paint grammar 'none | marker-ref'."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_invalid_value("marker-start", "auto"); +test_invalid_value("marker-start", 'none url("https://example.com/")'); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/marker-start-valid.svg b/testing/web-platform/tests/svg/painting/parsing/marker-start-valid.svg new file mode 100644 index 0000000000..fd6f2d6fe4 --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/marker-start-valid.svg @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing marker-start with valid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#MarkerStartProperty"/> + <h:meta name="assert" content="marker-start supports the full paint grammar 'none | marker-ref'."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_valid_value("marker-start", "none"); + +test_valid_value("marker-start", 'url("https://example.com/")'); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/marker-valid.svg b/testing/web-platform/tests/svg/painting/parsing/marker-valid.svg new file mode 100644 index 0000000000..23d3f24f5c --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/marker-valid.svg @@ -0,0 +1,20 @@ +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing marker with valid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#MarkerProperty"/> + <h:meta name="assert" content="marker supports the full paint grammar 'none | marker-ref'."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_valid_value("marker", "none"); + +test_valid_value("marker", 'url("https://example.com/")'); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/paint-order-computed.svg b/testing/web-platform/tests/svg/painting/parsing/paint-order-computed.svg new file mode 100644 index 0000000000..29f5fa91ba --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/paint-order-computed.svg @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: getComputedStyle().paintOrder</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#PaintOrderProperty"/> + <h:meta name="assert" content="paint-order computed value is as specified."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/computed-testcommon.js"/> + <script><![CDATA[ + +test_computed_value("paint-order", "normal"); + +test_computed_value("paint-order", "fill"); +test_computed_value("paint-order", "stroke"); +test_computed_value("paint-order", "markers"); + +test_computed_value("paint-order", "fill stroke", "fill"); +test_computed_value("paint-order", "fill markers"); +test_computed_value("paint-order", "stroke fill", "stroke"); +test_computed_value("paint-order", "stroke markers"); +test_computed_value("paint-order", "markers fill", "markers"); +test_computed_value("paint-order", "markers stroke"); + +test_computed_value("paint-order", "fill stroke markers", "fill"); +test_computed_value("paint-order", "fill markers stroke", "fill markers"); +test_computed_value("paint-order", "stroke fill markers", "stroke"); +test_computed_value("paint-order", "stroke markers fill", "stroke markers"); +test_computed_value("paint-order", "markers fill stroke", "markers"); +test_computed_value("paint-order", "markers stroke fill", "markers stroke"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/paint-order-invalid.svg b/testing/web-platform/tests/svg/painting/parsing/paint-order-invalid.svg new file mode 100644 index 0000000000..5043176dd9 --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/paint-order-invalid.svg @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing paint-order with invalid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#PaintOrderProperty"/> + <h:meta name="assert" content="paint-order supports only the grammar 'normal | [ fill || stroke || markers ]'."/> + <h:meta name="assert" content="paint-order uses the shortest serialization."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_invalid_value("paint-order", "normal stroke"); +test_invalid_value("paint-order", "fill fill"); +test_invalid_value("paint-order", "markers normal"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/paint-order-valid.svg b/testing/web-platform/tests/svg/painting/parsing/paint-order-valid.svg new file mode 100644 index 0000000000..25759d222d --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/paint-order-valid.svg @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing paint-order with valid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#PaintOrderProperty"/> + <h:meta name="assert" content="paint-order supports the full grammar 'normal | [ fill || stroke || markers ]'."/> + <h:meta name="assert" content="paint-order uses the shortest serialization."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_valid_value("paint-order", "normal"); + +test_valid_value("paint-order", "fill"); +test_valid_value("paint-order", "stroke"); +test_valid_value("paint-order", "markers"); + +test_valid_value("paint-order", "fill stroke", "fill"); +test_valid_value("paint-order", "fill markers"); +test_valid_value("paint-order", "stroke fill", "stroke"); +test_valid_value("paint-order", "stroke markers"); +test_valid_value("paint-order", "markers fill", "markers"); +test_valid_value("paint-order", "markers stroke"); + +test_valid_value("paint-order", "fill stroke markers", "fill"); +test_valid_value("paint-order", "fill markers stroke", "fill markers"); +test_valid_value("paint-order", "stroke fill markers", "stroke"); +test_valid_value("paint-order", "stroke markers fill", "stroke markers"); +test_valid_value("paint-order", "markers fill stroke", "markers"); +test_valid_value("paint-order", "markers stroke fill", "markers stroke"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/shape-rendering-computed.svg b/testing/web-platform/tests/svg/painting/parsing/shape-rendering-computed.svg new file mode 100644 index 0000000000..5e8f530d48 --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/shape-rendering-computed.svg @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: getComputedStyle().shapeRendering</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#ShapeRenderingProperty"/> + <h:meta name="assert" content="shape-rendering computed value is as specified."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/computed-testcommon.js"/> + <script><![CDATA[ + +test_computed_value("shape-rendering", "auto"); +test_computed_value("shape-rendering", "optimizespeed"); +test_computed_value("shape-rendering", "crispedges"); +test_computed_value("shape-rendering", "geometricprecision"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/shape-rendering-invalid.svg b/testing/web-platform/tests/svg/painting/parsing/shape-rendering-invalid.svg new file mode 100644 index 0000000000..e20ca879db --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/shape-rendering-invalid.svg @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing shape-rendering with invalid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#ShapeRenderingProperty"/> + <h:meta name="assert" content="shape-rendering supports only the grammar 'auto | optimizeSpeed | crispEdges | geometricPrecision'."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_invalid_value("shape-rendering", "optimizelegibility"); +test_invalid_value("shape-rendering", "auto optimizespeed"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/shape-rendering-valid.svg b/testing/web-platform/tests/svg/painting/parsing/shape-rendering-valid.svg new file mode 100644 index 0000000000..803609476f --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/shape-rendering-valid.svg @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing shape-rendering with valid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#ShapeRenderingProperty"/> + <h:meta name="assert" content="shape-rendering supports the full grammar 'auto | optimizeSpeed | crispEdges | geometricPrecision'."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_valid_value("shape-rendering", "auto"); +test_valid_value("shape-rendering", "optimizespeed"); +test_valid_value("shape-rendering", "crispedges"); +test_valid_value("shape-rendering", "geometricprecision"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/stroke-computed.svg b/testing/web-platform/tests/svg/painting/parsing/stroke-computed.svg new file mode 100644 index 0000000000..48214d140f --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/stroke-computed.svg @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: getComputedStyle().stroke</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#StrokeProperty"/> + <h:meta name="assert" content="stroke computed value is as specified, with url values absolute."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/computed-testcommon.js"/> + <script><![CDATA[ + +test_computed_value("stroke", "none"); +test_computed_value("stroke", "rgb(12, 34, 56)"); + +test_computed_value("stroke", 'url("https://example.com/")'); +test_computed_value("stroke", 'url("https://example.com/") none'); +test_computed_value("stroke", 'url("https://example.com/") rgb(12, 34, 56)'); + +// context-fill and context-stroke are not yet supported by browsers. + +test(() => { + const target = document.getElementById('target'); + target.style['stroke'] = 'url("a.b#c")'; + const result = getComputedStyle(target)['stroke']; + const resolved = new URL("a.b#c", document.URL).href; + assert_equals(result, 'url("' + resolved + '")'); +}, 'url values are made absolute'); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/stroke-dasharray-computed.svg b/testing/web-platform/tests/svg/painting/parsing/stroke-dasharray-computed.svg new file mode 100644 index 0000000000..6253e23c0f --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/stroke-dasharray-computed.svg @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: getComputedStyle().strokeDasharray</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#StrokeDasharrayProperty"/> + <h:meta name="assert" content="stroke-dasharray computed value uses absolute lengths."/> + </metadata> + <g id="target"></g> + <style> + #target { + font-size: 40px; + } + </style> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/computed-testcommon.js"/> + <script><![CDATA[ + +test_computed_value("stroke-dasharray", "none"); + +test_computed_value("stroke-dasharray", "10", "10px"); +test_computed_value("stroke-dasharray", "calc(10px + 0.5em)", "30px"); +test_computed_value("stroke-dasharray", "calc(10px - 0.5em)", "0px"); +test_computed_value("stroke-dasharray", "40%"); +test_computed_value("stroke-dasharray", "calc(50% + 60px)"); + +test_computed_value("stroke-dasharray", "10px 20% 30px", "10px, 20%, 30px"); +test_computed_value("stroke-dasharray", "0, 5", "0px, 5px"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/stroke-dasharray-invalid.svg b/testing/web-platform/tests/svg/painting/parsing/stroke-dasharray-invalid.svg new file mode 100644 index 0000000000..53a9640c8f --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/stroke-dasharray-invalid.svg @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing stroke-dasharray with invalid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#StrokeDasharrayProperty"/> + <h:meta name="assert" content="stroke-dasharray supports only the grammar 'none | dasharray'"/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_invalid_value("stroke-dasharray", "auto"); +test_invalid_value("stroke-dasharray", "none 10px"); +test_invalid_value("stroke-dasharray", "20px / 30px"); +test_invalid_value("stroke-dasharray", "-40px"); +test_invalid_value("stroke-dasharray", "calc(2px + 3)"); +test_invalid_value("stroke-dasharray", "calc(10% + 5)"); +test_invalid_value("stroke-dasharray", "calc(40 + calc(3px + 6%))"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/stroke-dasharray-valid.svg b/testing/web-platform/tests/svg/painting/parsing/stroke-dasharray-valid.svg new file mode 100644 index 0000000000..9326118ceb --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/stroke-dasharray-valid.svg @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing stroke-dasharray with valid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#StrokeDasharrayProperty"/> + <h:meta name="assert" content="stroke-dasharray supports the full grammar 'none | dasharray'"/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_valid_value("stroke-dasharray", "none"); + +// dasharray = [ length-percentage | number ]#* +test_valid_value("stroke-dasharray", "10px"); +test_valid_value("stroke-dasharray", "20%"); +test_valid_value("stroke-dasharray", "calc(2em + 3ex)"); + +test_valid_value("stroke-dasharray", "10pt 20% 30pc 40in", "10pt, 20%, 30pc, 40in"); +test_valid_value("stroke-dasharray", "10vmin, 20vmax, 30em, 40ex"); +test_valid_value("stroke-dasharray", "0, 5", ["0, 5", "0px, 5px"]); // Edge/Safari serialize numbers as lengths. +test_valid_value("stroke-dasharray", "calc(3)"); +test_valid_value("stroke-dasharray", "calc(2 + 1)", "calc(3)"); +test_valid_value("stroke-dasharray", "calc(2 + (7 - 5))", "calc(4)"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/stroke-dashoffset-computed.svg b/testing/web-platform/tests/svg/painting/parsing/stroke-dashoffset-computed.svg new file mode 100644 index 0000000000..561194827e --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/stroke-dashoffset-computed.svg @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: getComputedStyle().strokeDashoffset</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#StrokeDashoffsetProperty"/> + <h:meta name="assert" content="stroke-dashoffset computed value is absolute length."/> + </metadata> + <g id="target"></g> + <style> + #target { + font-size: 40px; + } + </style> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/computed-testcommon.js"/> + <script><![CDATA[ + +test_computed_value("stroke-dashoffset", "10", "10px"); +test_computed_value("stroke-dashoffset", "0.5em", "20px"); +test_computed_value("stroke-dashoffset", "calc(10px + 0.5em)", "30px"); +test_computed_value("stroke-dashoffset", "calc(10px - 0.5em)", "-10px"); +test_computed_value("stroke-dashoffset", "-40%"); +test_computed_value("stroke-dashoffset", "calc(50% + 60px)"); + +// https://www.w3.org/TR/css-values-3/#absolute-lengths +test_computed_value("stroke-dashoffset", "254cm", "9600px"); +test_computed_value("stroke-dashoffset", "2540mm", "9600px"); +test_computed_value("stroke-dashoffset", "10160Q", "9600px"); +test_computed_value("stroke-dashoffset", "1in", "96px"); +test_computed_value("stroke-dashoffset", "6pc", "96px"); +test_computed_value("stroke-dashoffset", "72pt", "96px"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/stroke-dashoffset-invalid.svg b/testing/web-platform/tests/svg/painting/parsing/stroke-dashoffset-invalid.svg new file mode 100644 index 0000000000..2040355e22 --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/stroke-dashoffset-invalid.svg @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing stroke-dashoffset with invalid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#StrokeDashoffsetProperty"/> + <h:meta name="assert" content="stroke-dashoffset supports only the grammar 'length-percentage'"/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_invalid_value("stroke-dashoffset", "auto"); +test_invalid_value("stroke-dashoffset", "-10.px"); +test_invalid_value("stroke-dashoffset", "30deg"); +test_invalid_value("stroke-dashoffset", "40px 50%"); +test_invalid_value("stroke-dashoffset", "calc(2px + 3)"); +test_invalid_value("stroke-dashoffset", "calc(10% + 5)"); +test_invalid_value("stroke-dashoffset", "calc(40 + calc(3px + 6%))"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/stroke-dashoffset-valid.svg b/testing/web-platform/tests/svg/painting/parsing/stroke-dashoffset-valid.svg new file mode 100644 index 0000000000..846b69ccd2 --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/stroke-dashoffset-valid.svg @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing stroke-dashoffset with valid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#StrokeDashoffsetProperty"/> + <h:meta name="assert" content="stroke-dashoffset supports the full grammar 'length-percentage'"/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_valid_value("stroke-dashoffset", "0"); +test_valid_value("stroke-dashoffset", "10px"); +test_valid_value("stroke-dashoffset", "-20%"); +test_valid_value("stroke-dashoffset", "30"); +test_valid_value("stroke-dashoffset", "40Q", "40q"); +test_valid_value("stroke-dashoffset", "calc(2em + 3ex)"); +test_valid_value("stroke-dashoffset", "calc(3)"); +test_valid_value("stroke-dashoffset", "calc(2 + 1)", "calc(3)"); +test_valid_value("stroke-dashoffset", "calc(2 + (7 - 5))", "calc(4)"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/stroke-invalid.svg b/testing/web-platform/tests/svg/painting/parsing/stroke-invalid.svg new file mode 100644 index 0000000000..a976ccb977 --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/stroke-invalid.svg @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing stroke with invalid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#StrokeProperty"/> + <h:meta name="assert" content="stroke supports only the paint grammar 'none | color | url [none | color]? | context-fill | context-stroke'."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_invalid_value("stroke", "auto"); +test_invalid_value("stroke", "none red"); +test_invalid_value("stroke", 'none url("https://example.com/")'); +test_invalid_value("stroke", 'red url("https://example.com/")'); +test_invalid_value("stroke", 'url("https://example.com/") none red'); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/stroke-linecap-computed.svg b/testing/web-platform/tests/svg/painting/parsing/stroke-linecap-computed.svg new file mode 100644 index 0000000000..a99629f7b9 --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/stroke-linecap-computed.svg @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: getComputedStyle().strokeLinecap</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#StrokeLinecapProperty"/> + <h:meta name="assert" content="stroke-linecap computed value is as specified."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/computed-testcommon.js"/> + <script><![CDATA[ + +test_computed_value("stroke-linecap", "butt"); +test_computed_value("stroke-linecap", "round"); +test_computed_value("stroke-linecap", "square"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/stroke-linecap-invalid.svg b/testing/web-platform/tests/svg/painting/parsing/stroke-linecap-invalid.svg new file mode 100644 index 0000000000..ba4bd8640e --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/stroke-linecap-invalid.svg @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing stroke-linecap with invalid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#StrokeLinecapProperty"/> + <h:meta name="assert" content="stroke-linecap supports only the grammar 'butt | round | square'"/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_invalid_value("stroke-linecap", "auto"); +test_invalid_value("stroke-linecap", "butt round"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/stroke-linecap-valid.svg b/testing/web-platform/tests/svg/painting/parsing/stroke-linecap-valid.svg new file mode 100644 index 0000000000..045c4eef7c --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/stroke-linecap-valid.svg @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing stroke-linecap with valid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#StrokeLinecapProperty"/> + <h:meta name="assert" content="stroke-linecap supports the full grammar 'butt | round | square'"/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_valid_value("stroke-linecap", "butt"); +test_valid_value("stroke-linecap", "round"); +test_valid_value("stroke-linecap", "square"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/stroke-linejoin-computed.svg b/testing/web-platform/tests/svg/painting/parsing/stroke-linejoin-computed.svg new file mode 100644 index 0000000000..3e0633fe57 --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/stroke-linejoin-computed.svg @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: getComputedStyle().strokeLinejoin</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#StrokeLinejoinProperty"/> + <h:meta name="assert" content="stroke-linejoin computed value is as specified."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/computed-testcommon.js"/> + <script><![CDATA[ + +test_computed_value("stroke-linejoin", "miter"); +test_computed_value("stroke-linejoin", "round"); +test_computed_value("stroke-linejoin", "bevel"); +// "miter-clip" and "arcs" are not yet supported by browsers. + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/stroke-linejoin-invalid.svg b/testing/web-platform/tests/svg/painting/parsing/stroke-linejoin-invalid.svg new file mode 100644 index 0000000000..6a6c428280 --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/stroke-linejoin-invalid.svg @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing stroke-linejoin with invalid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#StrokeLinejoinProperty"/> + <h:meta name="assert" content="stroke-linejoin supports only the grammar 'miter | miter-clip | round | bevel | arcs'"/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_invalid_value("stroke-linejoin", "auto"); +test_invalid_value("stroke-linejoin", "round bevel"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/stroke-linejoin-valid.svg b/testing/web-platform/tests/svg/painting/parsing/stroke-linejoin-valid.svg new file mode 100644 index 0000000000..876b2f67dd --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/stroke-linejoin-valid.svg @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing stroke-linejoin with valid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#StrokeLinejoinProperty"/> + <h:meta name="assert" content="stroke-linejoin supports the full grammar 'miter | miter-clip | round | bevel | arcs'"/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_valid_value("stroke-linejoin", "miter"); +test_valid_value("stroke-linejoin", "miter-clip"); +test_valid_value("stroke-linejoin", "round"); +test_valid_value("stroke-linejoin", "bevel"); +test_valid_value("stroke-linejoin", "arcs"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/stroke-miterlimit-computed.svg b/testing/web-platform/tests/svg/painting/parsing/stroke-miterlimit-computed.svg new file mode 100644 index 0000000000..33e5d2b81e --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/stroke-miterlimit-computed.svg @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: getComputedStyle().strokeMiterlimit</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#StrokeMiterlimitProperty"/> + <h:meta name="assert" content="stroke-miterlimit computed value is as specified."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/computed-testcommon.js"/> + <script><![CDATA[ + +test_computed_value("stroke-miterlimit", "0"); +test_computed_value("stroke-miterlimit", "0.5"); +test_computed_value("stroke-miterlimit", "1"); +test_computed_value("stroke-miterlimit", "7.5"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/stroke-miterlimit-invalid.svg b/testing/web-platform/tests/svg/painting/parsing/stroke-miterlimit-invalid.svg new file mode 100644 index 0000000000..c1307dab5b --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/stroke-miterlimit-invalid.svg @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing stroke-miterlimit with invalid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#StrokeMiterlimitProperty"/> + <h:meta name="assert" content="stroke-miterlimit supports only the grammar 'number'"/> + <h:meta name="assert" content="A negative value for stroke-miterlimit must be treated as an illegal value."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_invalid_value("stroke-miterlimit", "1."); +test_invalid_value("stroke-miterlimit", "2 3"); +test_invalid_value("stroke-miterlimit", "-4"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/stroke-miterlimit-valid.svg b/testing/web-platform/tests/svg/painting/parsing/stroke-miterlimit-valid.svg new file mode 100644 index 0000000000..36fd81d29c --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/stroke-miterlimit-valid.svg @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing stroke-miterlimit with valid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#StrokeMiterlimitProperty"/> + <h:meta name="assert" content="stroke-miterlimit supports the full grammar 'number'"/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_valid_value("stroke-miterlimit", "0"); +test_valid_value("stroke-miterlimit", "0.5"); +test_valid_value("stroke-miterlimit", "1"); +test_valid_value("stroke-miterlimit", "7.5"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/stroke-opacity-computed.svg b/testing/web-platform/tests/svg/painting/parsing/stroke-opacity-computed.svg new file mode 100644 index 0000000000..df58a213ff --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/stroke-opacity-computed.svg @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: getComputedStyle().strokeOpacity</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#StrokeOpacityProperty"/> + <h:meta name="assert" content="stroke-opacity computed value is clamped to the range [0,1]."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/computed-testcommon.js"/> + <script><![CDATA[ + +test_computed_value("stroke-opacity", "-1", "0"); +test_computed_value("stroke-opacity", "0.5"); +test_computed_value("stroke-opacity", "3", "1"); +test_computed_value("stroke-opacity", "-100%", "0"); +test_computed_value("stroke-opacity", "50%", "0.5"); +test_computed_value("stroke-opacity", "300%", "1"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/stroke-opacity-invalid.svg b/testing/web-platform/tests/svg/painting/parsing/stroke-opacity-invalid.svg new file mode 100644 index 0000000000..af1a954b47 --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/stroke-opacity-invalid.svg @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing stroke-opacity with invalid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#StrokeOpacityProperty"/> + <h:meta name="assert" content="stroke-opacity supports only the grammar 'alpha-value'."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_invalid_value("stroke-opacity", "1."); +test_invalid_value("stroke-opacity", "2 3"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/stroke-opacity-valid.svg b/testing/web-platform/tests/svg/painting/parsing/stroke-opacity-valid.svg new file mode 100644 index 0000000000..a333363e38 --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/stroke-opacity-valid.svg @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing stroke-opacity with valid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#StrokeOpacityProperty"/> + <h:meta name="assert" content="stroke-opacity supports the full grammar 'alpha-value'."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_valid_value("stroke-opacity", "-1"); +test_valid_value("stroke-opacity", "0.5"); +test_valid_value("stroke-opacity", "3"); +test_valid_value("stroke-opacity", "-100%", "-1"); +test_valid_value("stroke-opacity", "50%", "0.5"); +test_valid_value("stroke-opacity", "300%", "3"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/stroke-valid.svg b/testing/web-platform/tests/svg/painting/parsing/stroke-valid.svg new file mode 100644 index 0000000000..ce43c1f633 --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/stroke-valid.svg @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing stroke with valid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#StrokeProperty"/> + <h:meta name="assert" content="stroke supports the full paint grammar 'none | color | url [none | color]? | context-fill | context-stroke'."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_valid_value("stroke", "none"); +test_valid_value("stroke", "context-fill"); +test_valid_value("stroke", "context-stroke"); +test_valid_value("stroke", "rgb(12, 34, 56)"); + +test_valid_value("stroke", 'url("https://example.com/")'); +test_valid_value("stroke", 'url("https://example.com/") none'); +test_valid_value("stroke", 'url("https://example.com/") rgb(12, 34, 56)'); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/stroke-width-computed.svg b/testing/web-platform/tests/svg/painting/parsing/stroke-width-computed.svg new file mode 100644 index 0000000000..5daa9cafba --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/stroke-width-computed.svg @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: getComputedStyle().strokeWidth</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#StrokeWidth"/> + <h:meta name="assert" content="stroke-width computed value is absolute length."/> + </metadata> + <g id="target"></g> + <g id="ref"></g> + <style> + #target, #ref { + font-size: 40px; + } + </style> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/computed-testcommon.js"/> + <script><![CDATA[ + +test_computed_value("stroke-width", "10", "10px"); +test_computed_value("stroke-width", "calc(10px + 0.5em)", "30px"); +test_computed_value("stroke-width", "calc(10px - 0.5em)", "0px"); +test_computed_value("stroke-width", "40%"); +test_computed_value("stroke-width", "calc(50% + 60px)"); + +const lengthUnits = [ + 'em', + 'ex', + 'ch', + 'rem', + 'vw', + 'vh', + 'vmin', + 'vmax', + 'cm', + 'mm', + 'Q', + 'in', + 'pt', + 'pc', + 'px' +]; + +for (let lengthUnit of lengthUnits) { + const length = '987' + lengthUnit; + test(() => { + const target = document.getElementById('target'); + target.style.strokeWidth = length; + + const ref = document.getElementById('ref'); + ref.style.textIndent = length; + + assert_equals(getComputedStyle(target).strokeWidth, getComputedStyle(ref).textIndent); + }, 'stroke-width computes ' + lengthUnit + ' lengths'); +} + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/stroke-width-invalid.svg b/testing/web-platform/tests/svg/painting/parsing/stroke-width-invalid.svg new file mode 100644 index 0000000000..2111e376ac --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/stroke-width-invalid.svg @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="600px"> + <title>SVG Painting: parsing stroke-width with invalid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#StrokeWidth"/> + <h:meta name="assert" content="stroke-width supports only the grammar '<length-percentage>'."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_invalid_value("stroke-width", "auto"); +test_invalid_value("stroke-width", "10px 20px"); +test_invalid_value("stroke-width", "-1px"); +test_invalid_value("stroke-width", "-10%"); +test_invalid_value("stroke-width", "calc(2px + 3)"); +test_invalid_value("stroke-width", "calc(10% + 5)"); +test_invalid_value("stroke-width", "calc(40 + calc(3px + 6%))"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/stroke-width-valid.svg b/testing/web-platform/tests/svg/painting/parsing/stroke-width-valid.svg new file mode 100644 index 0000000000..fa00a9b709 --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/stroke-width-valid.svg @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="600px"> + <title>SVG Painting: parsing stroke-width with valid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#StrokeWidth"/> + <h:meta name="assert" content="stroke-width supports the full grammar '<length-percentage>' and unitless."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_valid_value("stroke-width", "0"); +test_valid_value("stroke-width", "10"); +test_valid_value("stroke-width", "1px"); +test_valid_value("stroke-width", "calc(2em + 3ex)"); +test_valid_value("stroke-width", "4%"); +test_valid_value("stroke-width", "5vmin"); +test_valid_value("stroke-width", "calc(50% + 60px)"); +test_valid_value("stroke-width", "calc(3)"); +test_valid_value("stroke-width", "calc(2 + 1)", "calc(3)"); +test_valid_value("stroke-width", "calc(2 + (7 - 5))", "calc(4)"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/text-rendering-computed.svg b/testing/web-platform/tests/svg/painting/parsing/text-rendering-computed.svg new file mode 100644 index 0000000000..b9758afefd --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/text-rendering-computed.svg @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: getComputedStyle().textRendering</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#TextRenderingProperty"/> + <h:meta name="assert" content="text-rendering computed value is as specified."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/computed-testcommon.js"/> + <script><![CDATA[ + +test_computed_value("text-rendering", "auto"); +test_computed_value("text-rendering", "optimizespeed"); +test_computed_value("text-rendering", "optimizelegibility"); +test_computed_value("text-rendering", "geometricprecision"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/text-rendering-invalid.svg b/testing/web-platform/tests/svg/painting/parsing/text-rendering-invalid.svg new file mode 100644 index 0000000000..92da841cad --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/text-rendering-invalid.svg @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing text-rendering with invalid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#TextRenderingProperty"/> + <h:meta name="assert" content="text-rendering supports only the grammar 'auto | optimizeSpeed | optimizeLegibility | geometricPrecision'."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_invalid_value("text-rendering", "crispedges"); +test_invalid_value("text-rendering", "auto optimizespeed"); + + ]]></script> +</svg> diff --git a/testing/web-platform/tests/svg/painting/parsing/text-rendering-valid.svg b/testing/web-platform/tests/svg/painting/parsing/text-rendering-valid.svg new file mode 100644 index 0000000000..d1a7dbf747 --- /dev/null +++ b/testing/web-platform/tests/svg/painting/parsing/text-rendering-valid.svg @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml" + width="800px" height="800px"> + <title>SVG Painting: parsing text-rendering with valid values</title> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/painting.html#TextRenderingProperty"/> + <h:meta name="assert" content="text-rendering supports the full grammar 'auto | optimizeSpeed | optimizeLegibility | geometricPrecision'."/> + </metadata> + <g id="target"></g> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <h:script src="/css/support/parsing-testcommon.js"/> + <script><![CDATA[ + +test_valid_value("text-rendering", "auto"); +test_valid_value("text-rendering", "optimizespeed"); +test_valid_value("text-rendering", "optimizelegibility"); +test_valid_value("text-rendering", "geometricprecision"); + + ]]></script> +</svg> |