summaryrefslogtreecommitdiffstats
path: root/dom/svg/test/test_SVGxxxListIndexing.xhtml
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/svg/test/test_SVGxxxListIndexing.xhtml
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/svg/test/test_SVGxxxListIndexing.xhtml')
-rw-r--r--dom/svg/test/test_SVGxxxListIndexing.xhtml100
1 files changed, 100 insertions, 0 deletions
diff --git a/dom/svg/test/test_SVGxxxListIndexing.xhtml b/dom/svg/test/test_SVGxxxListIndexing.xhtml
new file mode 100644
index 000000000..31544b23d
--- /dev/null
+++ b/dom/svg/test/test_SVGxxxListIndexing.xhtml
@@ -0,0 +1,100 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=631437
+-->
+<head>
+ <title>Tests the array indexing and .length on SVGXXXList objects</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=631437">Mozilla Bug 631437</a>
+<svg xmlns="http://www.w3.org/2000/svg" id="svg">
+ <text id="text" x="10 20 30" rotate="40 50 60">abcde</text>
+ <path id="path" d="M0,0 L100,100"/>
+ <polygon id="poly" points="50,50 70,70 90,50"/>
+ <g id="g" transform="translate(20 30) rotate(50 60 70) scale(2)"
+ requiredFeatures="foo bar baz"/>
+</svg>
+<script type="text/javascript;version=1.8"><![CDATA[
+var text = document.getElementById("text"),
+ path = document.getElementById("path"),
+ poly = document.getElementById("poly");
+ g = document.getElementById("g");
+
+function CheckList(aListObject, aExpectedListLength, aListDescription)
+{
+ is(aListObject.numberOfItems, aExpectedListLength, aListDescription + ".numberOfItems");
+ is(aListObject.length, aExpectedListLength, aListDescription + ".length");
+ for (let i = 0; i < aListObject.length; i++) {
+ let item = aListObject.getItem(i);
+ ok(aListObject[i] === item, aListDescription + "[" + i + "]");
+ }
+ is(typeof(aListObject[aListObject.length]), "undefined", aListDescription + "[outOfBounds]");
+}
+
+var tests = [
+ { element: text,
+ attribute: "x",
+ listProperty: "x.baseVal",
+ type: "SVGLengthList",
+ subtests: [ { values: null, length: 3 },
+ { values: "40", length: 1 },
+ { values: "1em 2em 3em 4em 5em", length: 5 } ] },
+ { element: text,
+ attribute: "rotate",
+ listProperty: "rotate.baseVal",
+ type: "SVGNumberList",
+ subtests: [ { values: null, length: 3 },
+ { values: "10", length: 1 },
+ { values: "1 2 3 4 5", length: 5 } ] },
+ { element: path,
+ attribute: "d",
+ listProperty: "pathSegList",
+ type: "SVGPathSegList",
+ subtests: [ { values: null, length: 2 },
+ { values: "M50,50", length: 1 },
+ { values: "M0,0 h10 v20 h30 v40", length: 5 } ] },
+ { element: poly,
+ attribute: "points",
+ listProperty: "animatedPoints",
+ type: "SVGPointList",
+ subtests: [ { values: null, length: 3 },
+ { values: "100,100", length: 1 },
+ { values: "0,0 10,10 20,0 30,10 40,0", length: 5 } ] },
+ { element: g,
+ attribute: "transform",
+ listProperty: "transform.baseVal",
+ type: "SVGTransformList",
+ subtests: [ { values: null, length: 3 },
+ { values: "skewX(45)", length: 1 },
+ { values: "translate(1 2) rotate(3) scale(4) skewY(5) skewX(6)",
+ length: 5 } ] },
+ { element: g,
+ attribute: "requiredFeatures",
+ listProperty: "requiredFeatures",
+ type: "SVGStringList",
+ subtests: [ { values: null, length: 3 },
+ { values: "foo", length: 1 },
+ { values: "foo bar baz qux", length: 4 } ] }
+];
+
+for (let test of tests) {
+ let list = test.element;
+ for (let property of test.listProperty.split(".")) {
+ list = list[property];
+ }
+
+ for (let subtest of test.subtests) {
+ if (subtest.values) {
+ test.element.setAttribute(test.attribute, subtest.values);
+ }
+
+ CheckList(list, subtest.length,
+ test.type + ": " + test.element.localName + "." +
+ test.listProperty);
+ }
+}
+]]></script>
+</body>
+</html>