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/stroke-width-computed.svg | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.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/stroke-width-computed.svg')
-rw-r--r-- | testing/web-platform/tests/svg/painting/parsing/stroke-width-computed.svg | 60 |
1 files changed, 60 insertions, 0 deletions
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> |