Bug 1507519 [wpt PR 14075] - SVG Geometry: computed value of properties, a=testonly
authorEric Willigers <ewilligers@users.noreply.github.com>
Mon, 19 Nov 2018 18:46:24 +0000
changeset 504003 57852d01c27c59067cf31eb10ae42f96d6e47549
parent 504002 e3aa644a327a03e4fef610d31bbb10fc4fbaeef5
child 504004 cc07066a3542d272fe0eac5339b825c3792757c0
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1507519, 14075
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
testing/web-platform/tests/css/support/computed-testcommon.js
testing/web-platform/tests/svg/geometry/parsing/cx-computed.svg
testing/web-platform/tests/svg/geometry/parsing/cy-computed.svg
testing/web-platform/tests/svg/geometry/parsing/r-computed.svg
testing/web-platform/tests/svg/geometry/parsing/rx-computed.svg
testing/web-platform/tests/svg/geometry/parsing/ry-computed.svg
testing/web-platform/tests/svg/geometry/parsing/x-computed.svg
testing/web-platform/tests/svg/geometry/parsing/y-computed.svg
--- a/testing/web-platform/tests/css/support/computed-testcommon.js
+++ b/testing/web-platform/tests/css/support/computed-testcommon.js
@@ -8,15 +8,21 @@
  * @param {string} specified A specified value for the property.
  * @param {string} computed  The expected computed value. If omitted,
                              defaults to specified.
  */
 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 + "'");
 }
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/svg/geometry/parsing/cx-computed.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="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>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/svg/geometry/parsing/cy-computed.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="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>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/svg/geometry/parsing/r-computed.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="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>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/svg/geometry/parsing/rx-computed.svg
@@ -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>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/svg/geometry/parsing/ry-computed.svg
@@ -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>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/svg/geometry/parsing/x-computed.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="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>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/svg/geometry/parsing/y-computed.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="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>