Bug 1448727 [wpt PR 10172] - [svg 2 text] add scripted tests for length and indexed access, a=testonly
authorChris Lilley <chris@w3.org>
Mon, 09 Apr 2018 21:26:54 +0000
changeset 467239 62d4313609883a3275ee49a6d0311a554f0de478
parent 467238 03fe1ceeb6da887b4d8e2b18e8defafdb51b8d97
child 467240 9c61563fa23d37fb3fc2d7e16bc84d8668632e22
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1448727, 10172
milestone61.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 1448727 [wpt PR 10172] - [svg 2 text] add scripted tests for length and indexed access, a=testonly Automatic update from web-platform-testsMerge pull request #10172 from liamquin/svg-lists-have-length [svg 2 text] add scripted tests for length and indexed access wpt-commits: 3589b85af366d5c53bf03cfeb5e0ccb3ac2a38e9 wpt-pr: 10172 wpt-commits: 3589b85af366d5c53bf03cfeb5e0ccb3ac2a38e9 wpt-pr: 10172
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/svg/scripted/text-attrs-dxdy-have-length.svg
testing/web-platform/tests/svg/scripted/text-attrs-xyrotate-have-length.svg
testing/web-platform/tests/svg/scripted/text-tspan-attrs-have-length.svg
testing/web-platform/tests/svg/scripted/text-tspan-attrs-indexed-access.svg
testing/web-platform/tests/svg/scripted/tspan-attrs-dxdy-have-length.svg
testing/web-platform/tests/svg/scripted/tspan-attrs-xyrotate-have-length.svg
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -364272,16 +364272,52 @@
     ]
    ],
    "svg/path/property/getComputedStyle.svg": [
     [
      "/svg/path/property/getComputedStyle.svg",
      {}
     ]
    ],
+   "svg/scripted/text-attrs-dxdy-have-length.svg": [
+    [
+     "/svg/scripted/text-attrs-dxdy-have-length.svg",
+     {}
+    ]
+   ],
+   "svg/scripted/text-attrs-xyrotate-have-length.svg": [
+    [
+     "/svg/scripted/text-attrs-xyrotate-have-length.svg",
+     {}
+    ]
+   ],
+   "svg/scripted/text-tspan-attrs-have-length.svg": [
+    [
+     "/svg/scripted/text-tspan-attrs-have-length.svg",
+     {}
+    ]
+   ],
+   "svg/scripted/text-tspan-attrs-indexed-access.svg": [
+    [
+     "/svg/scripted/text-tspan-attrs-indexed-access.svg",
+     {}
+    ]
+   ],
+   "svg/scripted/tspan-attrs-dxdy-have-length.svg": [
+    [
+     "/svg/scripted/tspan-attrs-dxdy-have-length.svg",
+     {}
+    ]
+   ],
+   "svg/scripted/tspan-attrs-xyrotate-have-length.svg": [
+    [
+     "/svg/scripted/tspan-attrs-xyrotate-have-length.svg",
+     {}
+    ]
+   ],
    "svg/shapes/line-getPointAtLength.svg": [
     [
      "/svg/shapes/line-getPointAtLength.svg",
      {}
     ]
    ],
    "svg/shapes/line-pathLength.svg": [
     [
@@ -600185,16 +600221,40 @@
   "svg/path/property/priority.svg": [
    "c3f4fa37aaa87fb064a8962656e9ed53df4b1f8c",
    "reftest"
   ],
   "svg/path/property/resources/interpolation-test-common.js": [
    "b85e9086b134478e4c4b468cb19cc4e57aca06ae",
    "support"
   ],
+  "svg/scripted/text-attrs-dxdy-have-length.svg": [
+   "91cd3e09332fa52800b05346d8c183bb599d7f46",
+   "testharness"
+  ],
+  "svg/scripted/text-attrs-xyrotate-have-length.svg": [
+   "d1b14475ba78f55748e7a79384bb008d7d6c8220",
+   "testharness"
+  ],
+  "svg/scripted/text-tspan-attrs-have-length.svg": [
+   "9932e4c5bd9c1d2153dca13f0498bf4c0729aee5",
+   "testharness"
+  ],
+  "svg/scripted/text-tspan-attrs-indexed-access.svg": [
+   "80e12ce0c456a1abd1b520f09af36fde8f6efff4",
+   "testharness"
+  ],
+  "svg/scripted/tspan-attrs-dxdy-have-length.svg": [
+   "66d29c494c41bf575270a777897032425b03618e",
+   "testharness"
+  ],
+  "svg/scripted/tspan-attrs-xyrotate-have-length.svg": [
+   "1660ebba379a218ba1ce74a655df2725d788622c",
+   "testharness"
+  ],
   "svg/shapes/line-dasharray-ref.svg": [
    "1703bd2fa544c3b2a0cd9a2ff3ff329089f19e6a",
    "support"
   ],
   "svg/shapes/line-dasharray.svg": [
    "871c635c20ed0d6fb5466d706488bb0e9b846cf0",
    "reftest"
   ],
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/svg/scripted/text-attrs-dxdy-have-length.svg
@@ -0,0 +1,23 @@
+<?xml version="1.0" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg"
+     xmlns:h="http://www.w3.org/1999/xhtml">
+  <metadata>
+    <h:link rel="help" href="https://svgwg.org/svg2-draft/single-page.html#text-TSpanNotes"/>
+    <h:meta name="assert" content="dx and dy attributes on text elements are lists that support length()"/>
+</metadata>
+  <text id="text" font-family="Verdana" font-size="55" fill="blue"
+    y="150"
+    x="120"
+    dx="60 90 -30 120 60 -257"
+    dy="0 12 24 12 0 -12 -24 -12 0"
+    >His socks are black.</text>
+  <h:script src="/resources/testharness.js"/>
+  <h:script src="/resources/testharnessreport.js"/>
+  <script><![CDATA[
+    test(function() {
+      var text = document.getElementById('text');
+      assert_equals(text.dx.baseVal.length, 6);
+      assert_equals(text.dy.baseVal.length, 9);
+    });
+  ]]></script>
+</svg>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/svg/scripted/text-attrs-xyrotate-have-length.svg
@@ -0,0 +1,24 @@
+<?xml version="1.0" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg"
+     xmlns:h="http://www.w3.org/1999/xhtml">
+  <metadata>
+    <h:link rel="help" href="https://svgwg.org/svg2-draft/single-page.html#text-TSpanNotes"/>
+    <h:meta name="assert" content="x y and rotate attributes on text elements are lists that support length()"/>
+</metadata>
+  <text id="text" font-family="Verdana" font-size="55" fill="blue"
+    y="150 130 160"
+    x="120 160 200 240"
+    rotate="0 0 10, -10, 0"
+    >My socks are blue.</text>
+  <h:script src="/resources/testharness.js"/>
+  <h:script src="/resources/testharnessreport.js"/>
+  <script><![CDATA[
+    /* The SVG spec requires (at least) readonly support for length */
+    test(function() {
+      var text = document.getElementById('text');
+      assert_equals(text.y.baseVal.length, 3);
+      assert_equals(text.x.baseVal.length, 4);
+      assert_equals(text.rotate.baseVal.length, 5);
+    });
+  ]]></script>
+</svg>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/svg/scripted/text-tspan-attrs-have-length.svg
@@ -0,0 +1,44 @@
+<?xml version="1.0" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg"
+     xmlns:h="http://www.w3.org/1999/xhtml">
+  <metadata>
+    <h:link rel="help" href="https://svgwg.org/svg2-draft/single-page.html#text-TSpanNotes"/>
+    <h:meta name="assert" content="x y dx dy and rotate attributes on text and tspan elements are lists that support length()"/>
+</metadata>
+  <text id="text" font-family="Verdana" font-size="55" fill="blue"
+  y="150 130 160" x="120 160 200 240" rotate="0 0 10, -10, 0">
+    My <tspan id="tspan" x="280 325" y="150 155 160 165 170" rotate="-30,0,30">socks</tspan>
+    are blue.
+  </text>
+  <h:script src="/resources/testharness.js"/>
+  <h:script src="/resources/testharnessreport.js"/>
+  <script><![CDATA[
+    test(function() {
+      /* Make sure that text.y is a list, (presumably
+       * SVGAnimatedLengthList) and that the list has a
+       * length() method and that it returns the right thing.
+       *
+       * This test is for a change in SVG for 2.0, since 1.x, to add
+       * a length property.
+       */
+      var text = document.getElementById('text');
+      assert_equals(text.y.baseVal.length, 3);
+      assert_equals(text.x.baseVal.length, 4);
+      assert_equals(text.rotate.baseVal.length, 5);
+
+      /* same for tspan */
+      var tspan = document.getElementById('tspan');
+      assert_equals(tspan.x.baseVal.length, 2);
+      assert_equals(tspan.y.baseVal.length, 5);
+      assert_equals(tspan.rotate.baseVal.length, 3);
+
+      /* Note, we only have to test that the length property
+       * is there (and interoperable) when there is a list given;
+       * in practice it's there with value 0 when the attributes are
+       * absent, but that's not required, the attribute could be implemented
+       * as a plain string in that case, or absent entirely, I think
+       * - Liam Quin 2018
+       */
+     });
+  ]]></script>
+</svg>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/svg/scripted/text-tspan-attrs-indexed-access.svg
@@ -0,0 +1,33 @@
+<?xml version="1.0" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg"
+     xmlns:h="http://www.w3.org/1999/xhtml">
+  <metadata>
+    <h:link rel="help" href="https://svgwg.org/svg2-draft/single-page.html#text-TSpanNotes"/>
+    <h:meta name="assert" content="x y dx dy and rotate attributes on text and tspan elements are lists that support length()"/>
+</metadata>
+  <text id="text" font-family="Verdana" font-size="55" fill="blue"
+  y="150 130 160" x="120 160 200 240" rotate="0 0 10, -10, 0">
+    My <tspan id="tspan" x="280 325" y="150 155 160 165 170" rotate="-30,0,30">socks</tspan>
+    are blue.
+  </text>
+  <h:script src="/resources/testharness.js"/>
+  <h:script src="/resources/testharnessreport.js"/>
+  <script><![CDATA[
+    test(function() {
+      /* Make sure that we can get at list items with indexed access.
+       */
+      var text = document.getElementById('text');
+      assert_equals(text.x.baseVal[0].value, 120);
+      assert_equals(text.y.baseVal[2].value, 160);
+      assert_equals(text.rotate.baseVal[3].value, -10);
+      assert_equals(text.rotate.baseVal[0].value, 0);
+
+      /* same for tspan */
+      var tspan = document.getElementById('tspan');
+      assert_equals(tspan.x.baseVal[1].value, 325);
+      assert_equals(tspan.y.baseVal[4].value, 170);
+      assert_equals(tspan.rotate.baseVal[0].value, -30);
+    });
+
+  ]]></script>
+</svg>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/svg/scripted/tspan-attrs-dxdy-have-length.svg
@@ -0,0 +1,24 @@
+<?xml version="1.0" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg"
+     xmlns:h="http://www.w3.org/1999/xhtml">
+  <metadata>
+    <h:link rel="help" href="https://svgwg.org/svg2-draft/single-page.html#text-TSpanNotes"/>
+    <h:meta name="assert" content="dx, dy attrs on tspan support length()"/>
+</metadata>
+  <text id="text" font-family="Verdana" font-size="55" fill="blue"
+    y="150"
+    x="120"
+    >His socks are <tspan id="tsp"
+    dx="60 90 -30 120 60 -257"
+    dy="0 12 24 12 0 -12 -24 -12 0"
+    >very</tspan> clean.</text>
+  <h:script src="/resources/testharness.js"/>
+  <h:script src="/resources/testharnessreport.js"/>
+  <script><![CDATA[
+    test(function() {
+      var tspan = document.getElementById('tsp');
+      assert_equals(tspan.dx.baseVal.length, 6);
+      assert_equals(tspan.dy.baseVal.length, 9);
+    });
+  ]]></script>
+</svg>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/svg/scripted/tspan-attrs-xyrotate-have-length.svg
@@ -0,0 +1,24 @@
+<?xml version="1.0" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg"
+     xmlns:h="http://www.w3.org/1999/xhtml">
+  <metadata>
+    <h:link rel="help" href="https://svgwg.org/svg2-draft/single-page.html#text-TSpanNotes"/>
+    <h:meta name="assert" content="dx and dy attributes on text elements are lists that support length()"/>
+</metadata>
+  <text id="text" font-family="Verdana" font-size="55" fill="blue"
+    y="150"
+    x="120"
+    >Her socks were <tspan id="tsp"
+    x="280 325" y="150 155 160 165 170" rotate="-30,0,30"
+    >stained</tspan> with blood.</text>
+  <h:script src="/resources/testharness.js"/>
+  <h:script src="/resources/testharnessreport.js"/>
+  <script><![CDATA[
+    test(function() {
+      var tspan = document.getElementById('tsp');
+      assert_equals(tspan.x.baseVal.length, 2);
+      assert_equals(tspan.y.baseVal.length, 5);
+      assert_equals(tspan.rotate.baseVal.length, 3);
+    });
+  ]]></script>
+</svg>