Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: third_party/WebKit/LayoutTests/svg/dom/SVGLengthList-appendItem.xhtml

Issue 2340733002: Convert LayoutTests/svg/dom/SVGLengthList*.html js-tests.js to testharness.js based tests (Closed)
Patch Set: Align with review comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <html xmlns="http://www.w3.org/1999/xhtml">
2 <head>
3 <script>window.enablePixelTesting = true;</script>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200">
8 <text id="text1" x="500 50 100 900 1000" y="50">ABC</text>
9 <text id="text2" x="50 100 1000" y="100">ABC</text>
10 <text id="reference" x="50 100 150" y="150">ABC</text>
11 </svg>
12
13 <p id="description"></p>
14 <div id="console"></div>
15 <script type="text/javascript">
16 <![CDATA[
17 description("This is a test of the SVGLengthList::appendItem() API.");
18
19 var svg = document.getElementById("svg");
20 var text1 = document.getElementById("text1");
21 var text2 = document.getElementById("text2");
22
23 debug("");
24 debug("Create a new SVGLength object, with value=150");
25 var newLength1 = svg.createSVGLength();
26 newLength1.value = 150;
27 shouldBe("newLength1.value", "150");
28
29 debug("");
30 debug("Check initial list state of text1");
31 shouldBe("text1.x.baseVal.numberOfItems", "5");
32 shouldBe("text1.x.baseVal.getItem(0).value", "500");
33 shouldBe("text1.x.baseVal.getItem(1).value", "50");
34 shouldBe("text1.x.baseVal.getItem(2).value", "100");
35 shouldBe("text1.x.baseVal.getItem(3).value", "900");
36 shouldBe("text1.x.baseVal.getItem(4).value", "1000");
37 shouldThrow("text1.x.baseVal.getItem(5)");
38
39 debug("");
40 debug("Check initial list state of text2");
41 shouldBe("text2.x.baseVal.numberOfItems", "3");
42 shouldBe("text2.x.baseVal.getItem(0).value", "50");
43 shouldBe("text2.x.baseVal.getItem(1).value", "100");
44 shouldBe("text2.x.baseVal.getItem(2).value", "1000");
45 shouldThrow("text2.x.baseVal.getItem(3)");
46
47 debug("");
48 debug("Append fourth item x=900 to the text1 x list");
49 shouldBe("text1.x.baseVal.appendItem(text1.x.baseVal.getItem(3))", "text1.x. baseVal.getItem(5)");
50 shouldBe("text1.x.baseVal.numberOfItems", "6");
51 shouldBe("text1.x.baseVal.getItem(0).value", "500");
52 shouldBe("text1.x.baseVal.getItem(1).value", "50");
53 shouldBe("text1.x.baseVal.getItem(2).value", "100");
54 shouldBe("text1.x.baseVal.getItem(3).value", "900");
55 shouldBe("text1.x.baseVal.getItem(4).value", "1000");
56 shouldBe("text1.x.baseVal.getItem(5).value", "900");
57 shouldThrow("text1.x.baseVal.getItem(6)");
58
59 debug("");
60 debug("Append first item x=500 to the text1 x list");
61 shouldBe("text1.x.baseVal.appendItem(text1.x.baseVal.getItem(0))", "text1.x. baseVal.getItem(6)");
62 shouldBe("text1.x.baseVal.numberOfItems", "7");
63 shouldBe("text1.x.baseVal.getItem(0).value", "500");
64 shouldBe("text1.x.baseVal.getItem(1).value", "50");
65 shouldBe("text1.x.baseVal.getItem(2).value", "100");
66 shouldBe("text1.x.baseVal.getItem(3).value", "900");
67 shouldBe("text1.x.baseVal.getItem(4).value", "1000");
68 shouldBe("text1.x.baseVal.getItem(5).value", "900");
69 shouldBe("text1.x.baseVal.getItem(6).value", "500");
70 shouldThrow("text1.x.baseVal.getItem(7)");
71
72 debug("");
73 debug("Append 'newLength1' to the text1 x list");
74 shouldBe("text1.x.baseVal.appendItem(newLength1)", "text1.x.baseVal.getItem( 7)");
75 shouldBe("text1.x.baseVal.numberOfItems", "8");
76 shouldBe("text1.x.baseVal.getItem(0).value", "500");
77 shouldBe("text1.x.baseVal.getItem(1).value", "50");
78 shouldBe("text1.x.baseVal.getItem(2).value", "100");
79 shouldBe("text1.x.baseVal.getItem(3).value", "900");
80 shouldBe("text1.x.baseVal.getItem(4).value", "1000");
81 shouldBe("text1.x.baseVal.getItem(5).value", "900");
82 shouldBe("text1.x.baseVal.getItem(6).value", "500");
83 shouldBe("text1.x.baseVal.getItem(7).value", "150");
84 shouldThrow("text1.x.baseVal.getItem(8)");
85
86 debug("");
87 debug("Append third and fourth item of the text1 x list to the text2 x list" );
88 shouldBe("text2.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value", "10 0");
89 shouldBe("text2.x.baseVal.appendItem(text1.x.baseVal.getItem(3)).value", "90 0");
90 shouldBe("text1.x.baseVal.numberOfItems", "8");
91 shouldBe("text1.x.baseVal.getItem(0).value", "500");
92 shouldBe("text1.x.baseVal.getItem(1).value", "50");
93 shouldBe("text1.x.baseVal.getItem(2).value", "100");
94 shouldBe("text1.x.baseVal.getItem(3).value", "900");
95 shouldBe("text1.x.baseVal.getItem(4).value", "1000");
96 shouldBe("text1.x.baseVal.getItem(5).value", "900");
97 shouldBe("text1.x.baseVal.getItem(6).value", "500");
98 shouldBe("text1.x.baseVal.getItem(7).value", "150");
99 shouldThrow("text1.x.baseVal.getItem(8)");
100 shouldBe("text2.x.baseVal.numberOfItems", "5");
101 shouldBe("text2.x.baseVal.getItem(0).value", "50");
102 shouldBe("text2.x.baseVal.getItem(1).value", "100");
103 shouldBe("text2.x.baseVal.getItem(2).value", "1000");
104 shouldBe("text2.x.baseVal.getItem(3).value", "100");
105 shouldBe("text2.x.baseVal.getItem(4).value", "900");
106 shouldThrow("text2.x.baseVal.getItem(5)");
107
108 var newLength2 = svg.createSVGLength();
109 newLength2.value = 150;
110 shouldBe("newLength2.value", "150");
111 shouldBeUndefined("text1.x.baseVal.clear()");
112
113 debug("");
114 debug("Shuffle around items in text1 and text2 list using appendItem, to get x=50,100,150,... in both lists");
115 shouldBe("text1.x.baseVal.appendItem(text2.x.baseVal.getItem(0)).value", "50 ");
116 shouldBe("text1.x.baseVal.appendItem(text2.x.baseVal.getItem(1)).value", "10 0");
117 shouldBe("text1.x.baseVal.appendItem(newLength2).value", "150");
118 shouldBeUndefined("text2.x.baseVal.clear()");
119 shouldBe("text2.x.baseVal.appendItem(text1.x.baseVal.getItem(0)).value", "50 ");
120 shouldBe("text2.x.baseVal.appendItem(text1.x.baseVal.getItem(1)).value", "10 0");
121 shouldBe("text2.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value", "15 0");
122 shouldBe("text1.x.baseVal.numberOfItems", "3");
123 shouldBe("text1.x.baseVal.getItem(0).value", "50");
124 shouldBe("text1.x.baseVal.getItem(1).value", "100");
125 shouldBe("text1.x.baseVal.getItem(2).value", "150");
126 shouldThrow("text1.x.baseVal.getItem(4)");
127 shouldBe("text2.x.baseVal.numberOfItems", "3");
128 shouldBe("text2.x.baseVal.getItem(0).value", "50");
129 shouldBe("text2.x.baseVal.getItem(1).value", "100");
130 shouldBe("text2.x.baseVal.getItem(2).value", "150");
131 shouldThrow("text2.x.baseVal.getItem(6)");
132
133 debug("");
134 debug("The test passes if you only see 'PASS' messages, and all three text e lements on top look the same");
135 debug("");
136
137 ]]>
138 </script>
139 </body>
140 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698