Bug 1507519 [wpt PR 14075] - SVG Geometry: computed value of properties, a=testonly

Automatic update from web-platform-testsSVG Geometry: computed value of properties (#14075)

cx cy r rx ry x y computed values are lengths or percentages.
https://svgwg.org/svg2-draft/geometry.html
--

wpt-commits: 39c2331ea623e23849d2f6fc99f804e5e2d374d2
wpt-pr: 14075
This commit is contained in:
Eric Willigers 2018-11-19 18:46:24 +00:00 committed by moz-wptsync-bot
parent 2c2bacc0f0
commit 0309ed1ced
8 changed files with 199 additions and 0 deletions

View File

@ -13,10 +13,16 @@ function test_computed_value(property, specified, computed) {
if (!computed)
computed = specified;
test(() => {
const target = document.getElementById('target');
if (!getComputedStyle(target)[property])
return;
target.style[property] = '';
target.style[property] = specified;
assert_equals(getComputedStyle(target)[property], computed);
if (computed !== specified) {
target.style[property] = '';
target.style[property] = computed;
assert_equals(getComputedStyle(target)[property], computed, 'computed value should round-trip');
}
}, "Property " + property + " value '" + specified + "' computes to '" + computed + "'");
}

View File

@ -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="8000px">
<title>SVG Geometry Properties: getComputedValue().cx</title>
<metadata>
<h:link rel="help" href="https://svgwg.org/svg2-draft/geometry.html#CX"/>
</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("cx", "-10px");
test_computed_value("cx", "0.5em", "20px");
test_computed_value("cx", "calc(10px + 0.5em)", "30px");
test_computed_value("cx", "40%");
test_computed_value("cx", "calc(50% + 60x)");
]]></script>
</svg>

After

Width:  |  Height:  |  Size: 829 B

View File

@ -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="8000px">
<title>SVG Geometry Properties: getComputedValue().cy</title>
<metadata>
<h:link rel="help" href="https://svgwg.org/svg2-draft/geometry.html#CY"/>
</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("cy", "-10px");
test_computed_value("cy", "0.5em", "20px");
test_computed_value("cy", "calc(10px + 0.5em)", "30px");
test_computed_value("cy", "40%");
test_computed_value("cy", "calc(50% + 60x)");
]]></script>
</svg>

After

Width:  |  Height:  |  Size: 829 B

View File

@ -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="8000px">
<title>SVG Geometry Properties: getComputedValue().r</title>
<metadata>
<h:link rel="help" href="https://svgwg.org/svg2-draft/geometry.html#R"/>
</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("r", "10px");
test_computed_value("r", "0.5em", "20px");
test_computed_value("r", "calc(10px + 0.5em)", "30px");
test_computed_value("r", "40%");
test_computed_value("r", "calc(50% + 60x)");
]]></script>
</svg>

After

Width:  |  Height:  |  Size: 821 B

View File

@ -0,0 +1,29 @@
<?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="8000px">
<title>SVG Geometry Properties: getComputedValue().rx</title>
<metadata>
<h:link rel="help" href="https://svgwg.org/svg2-draft/geometry.html#RX"/>
</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("rx", "auto");
test_computed_value("rx", "10px");
test_computed_value("rx", "0.5em", "20px");
test_computed_value("rx", "calc(10px + 0.5em)", "30px");
test_computed_value("rx", "40%");
test_computed_value("rx", "calc(50% + 60x)");
]]></script>
</svg>

After

Width:  |  Height:  |  Size: 864 B

View File

@ -0,0 +1,29 @@
<?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="8000px">
<title>SVG Geometry Properties: getComputedValue().ry</title>
<metadata>
<h:link rel="help" href="https://svgwg.org/svg2-draft/geometry.html#RY"/>
</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("ry", "auto");
test_computed_value("ry", "10px");
test_computed_value("ry", "0.5em", "20px");
test_computed_value("ry", "calc(10px + 0.5em)", "30px");
test_computed_value("ry", "40%");
test_computed_value("ry", "calc(50% + 60x)");
]]></script>
</svg>

After

Width:  |  Height:  |  Size: 864 B

View File

@ -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="8000px">
<title>SVG Geometry Properties: getComputedValue().x</title>
<metadata>
<h:link rel="help" href="https://svgwg.org/svg2-draft/geometry.html#X"/>
</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("x", "-10px");
test_computed_value("x", "0.5em", "20px");
test_computed_value("x", "calc(10px + 0.5em)", "30px");
test_computed_value("x", "40%");
test_computed_value("x", "calc(50% + 60x)");
]]></script>
</svg>

After

Width:  |  Height:  |  Size: 822 B

View File

@ -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="8000px">
<title>SVG Geometry Properties: getComputedValue().y</title>
<metadata>
<h:link rel="help" href="https://svgwg.org/svg2-draft/geometry.html#Y"/>
</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("y", "-10px");
test_computed_value("y", "0.5em", "20px");
test_computed_value("y", "calc(10px + 0.5em)", "30px");
test_computed_value("y", "40%");
test_computed_value("y", "calc(50% + 60x)");
]]></script>
</svg>

After

Width:  |  Height:  |  Size: 822 B