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

Side by Side Diff: third_party/WebKit/LayoutTests/svg/dom/SVGLengthList-basics.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 1000 1500" y="50"> ABC </text>
9 </svg>
10
11 <p id="description"></p>
12 <div id="console"></div>
13 <script type="text/javascript">
14 <![CDATA[
15 description("This is a test of the simple SVGLengthList API parts.");
16
17 if (window.testRunner)
18 testRunner.dumpAsText();
19
20 var text1 = document.getElementById("text1");
21
22 // Spec: The object referenced by animVal will always be distinct from the o ne referenced by baseVal, even when the attribute is not animated.
23 shouldBeTrue("text1.x.baseVal != text1.x.animVal");
24
25 shouldBe("text1.x.baseVal.numberOfItems", "3");
26 shouldBe("text1.x.animVal.numberOfItems", "3");
27 shouldBe("text1.x.baseVal.getItem(0).value", "500");
28 shouldBe("text1.x.baseVal.getItem(1).value", "1000");
29 shouldBe("text1.x.baseVal.getItem(2).value", "1500");
30
31 debug("");
32 debug("Test uncommon arguments for initialize()");
33 shouldThrow("text1.x.baseVal.initialize(30)");
34 shouldThrow("text1.x.baseVal.initialize('aString')");
35 shouldThrow("text1.x.baseVal.initialize(text1)");
36 shouldThrow("text1.x.baseVal.initialize(null)");
37
38 debug("");
39 debug("Test uncommon arguments for getItem()");
40 shouldThrow("text1.x.baseVal.getItem(30)");
41 shouldBe("text1.x.baseVal.getItem('aString')", "text1.x.baseVal.getItem(0)") ;
42 shouldBe("text1.x.baseVal.getItem(text1)", "text1.x.baseVal.getItem(0)");
43 shouldBe("text1.x.baseVal.getItem(null)", "text1.x.baseVal.getItem(0)");
44
45 debug("");
46 debug("Test uncommon arguments for insertItemBefore()");
47 shouldThrow("text1.x.baseVal.insertItemBefore(30)");
48 shouldThrow("text1.x.baseVal.insertItemBefore('aString')");
49 shouldThrow("text1.x.baseVal.insertItemBefore(text1)");
50 shouldThrow("text1.x.baseVal.insertItemBefore(null)");
51
52 shouldBe("text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), 'aStr ing')", "text1.x.baseVal.getItem(0)");
53 shouldBe("text1.x.baseVal.numberOfItems", "4");
54 shouldBe("text1.x.baseVal.getItem(0).value", "1000");
55 shouldBe("text1.x.baseVal.getItem(1).value", "500");
56 shouldBe("text1.x.baseVal.getItem(2).value", "1000");
57 shouldBe("text1.x.baseVal.getItem(3).value", "1500");
58 shouldBeEqualToString("text1.getAttribute('x')", "1000 500 1000 1500");
59
60 shouldBe("text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), text1 )", "text1.x.baseVal.getItem(0)");
61 shouldBe("text1.x.baseVal.numberOfItems", "5");
62 shouldBe("text1.x.baseVal.getItem(0).value", "500");
63 shouldBe("text1.x.baseVal.getItem(1).value", "1000");
64 shouldBe("text1.x.baseVal.getItem(2).value", "500");
65 shouldBe("text1.x.baseVal.getItem(3).value", "1000");
66 shouldBe("text1.x.baseVal.getItem(4).value", "1500");
67
68 shouldBeEqualToString("text1.getAttribute('x')", "500 1000 500 1000 1500");
69
70 shouldBe("text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), null) ", "text1.x.baseVal.getItem(0)");
71 shouldBe("text1.x.baseVal.numberOfItems", "6");
72 shouldBe("text1.x.baseVal.getItem(0).value", "1000");
73 shouldBe("text1.x.baseVal.getItem(1).value", "500");
74 shouldBe("text1.x.baseVal.getItem(2).value", "1000");
75 shouldBe("text1.x.baseVal.getItem(3).value", "500");
76 shouldBe("text1.x.baseVal.getItem(4).value", "1000");
77 shouldBe("text1.x.baseVal.getItem(5).value", "1500");
78 shouldBeEqualToString("text1.getAttribute('x')", "1000 500 1000 500 1000 150 0");
79
80 shouldBe("text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), 0)", "text1.x.baseVal.getItem(0)");
81 shouldBe("text1.x.baseVal.numberOfItems", "7");
82 shouldBe("text1.x.baseVal.getItem(0).value", "500");
83 shouldBe("text1.x.baseVal.getItem(1).value", "1000");
84 shouldBe("text1.x.baseVal.getItem(2).value", "500");
85 shouldBe("text1.x.baseVal.getItem(3).value", "1000");
86 shouldBe("text1.x.baseVal.getItem(4).value", "500");
87 shouldBe("text1.x.baseVal.getItem(5).value", "1000");
88 shouldBe("text1.x.baseVal.getItem(6).value", "1500");
89 shouldBeEqualToString("text1.getAttribute('x')", "500 1000 500 1000 500 1000 1500");
90
91 shouldThrow("text1.x.baseVal.insertItemBefore(30, 0)");
92 shouldThrow("text1.x.baseVal.insertItemBefore('aString', 0)");
93 shouldThrow("text1.x.baseVal.insertItemBefore(text1, 0)");
94 shouldThrow("text1.x.baseVal.insertItemBefore(null, 0)");
95
96 debug("");
97 debug("Set x='1 2 3 4' for text1");
98 shouldBeUndefined("text1.setAttribute('x', '1 2 3 4')");
99
100 debug("");
101 debug("Test edge cases for insertItemBefore()");
102 shouldBe("text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(3), 3)", "text1.x.baseVal.getItem(3)");
103 shouldBeEqualToString("text1.getAttribute('x')", "1 2 3 4 4");
104 shouldBe("text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), 5)", "text1.x.baseVal.getItem(5)");
105 shouldBeEqualToString("text1.getAttribute('x')", "1 2 3 4 4 2");
106 shouldBe("text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), 0)", "text1.x.baseVal.getItem(0)");
107 shouldBeEqualToString("text1.getAttribute('x')", "2 1 2 3 4 4 2");
108
109 debug("");
110 debug("Set x='1 2 3 4' for text1");
111 shouldBeUndefined("text1.setAttribute('x', '1 2 3 4')");
112 shouldBe("text1.x.baseVal.numberOfItems", "4");
113 shouldBe("text1.x.baseVal.getItem(0).value", "1");
114 shouldBe("text1.x.baseVal.getItem(1).value", "2");
115 shouldBe("text1.x.baseVal.getItem(2).value", "3");
116 shouldBe("text1.x.baseVal.getItem(3).value", "4");
117 shouldBeEqualToString("text1.getAttribute('x')", "1 2 3 4");
118
119 debug("");
120 debug("Test uncommon arguments for replaceItem()");
121 shouldThrow("text1.x.baseVal.replaceItem(30)");
122 shouldThrow("text1.x.baseVal.replaceItem('aString')");
123 shouldThrow("text1.x.baseVal.replaceItem(text1)");
124 shouldThrow("text1.x.baseVal.replaceItem(null)");
125 shouldThrow("text1.x.baseVal.replaceItem(30, 0)");
126 shouldThrow("text1.x.baseVal.replaceItem('aString', 0)");
127 shouldThrow("text1.x.baseVal.replaceItem(text1, 0)");
128 shouldThrow("text1.x.baseVal.replaceItem(null, 0)");
129
130 debug("");
131 debug("Test uncommon values for indexed setter");
132 shouldThrow("text1.x.baseVal[0] = 30");
133 shouldThrow("text1.x.baseVal[0] = 'aString'");
134 shouldThrow("text1.x.baseVal[0] = text1");
135 shouldThrow("text1.x.baseVal[0] = null");
136
137 shouldBe("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), 0)", "text 1.x.baseVal.getItem(0)");
138 shouldBe("text1.x.baseVal.numberOfItems", "4");
139 shouldBe("text1.x.baseVal.getItem(0).value", "1");
140 shouldBe("text1.x.baseVal.getItem(1).value", "2");
141 shouldBe("text1.x.baseVal.getItem(2).value", "3");
142 shouldBe("text1.x.baseVal.getItem(3).value", "4");
143 shouldBeEqualToString("text1.getAttribute('x')", "1 2 3 4");
144
145 shouldBe("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), 'aString') ", "text1.x.baseVal.getItem(0)");
146 shouldBe("text1.x.baseVal.numberOfItems", "4");
147 shouldBe("text1.x.baseVal.getItem(0).value", "1");
148 shouldBe("text1.x.baseVal.getItem(1).value", "2");
149 shouldBe("text1.x.baseVal.getItem(2).value", "3");
150 shouldBe("text1.x.baseVal.getItem(3).value", "4");
151 shouldBeEqualToString("text1.getAttribute('x')", "1 2 3 4");
152
153 shouldBe("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), text1)", " text1.x.baseVal.getItem(0)");
154 shouldBe("text1.x.baseVal.numberOfItems", "4");
155 shouldBeEqualToString("text1.getAttribute('x')", "1 2 3 4");
156
157 debug("");
158 debug("Set x='1 2 3 4' for text1");
159 shouldBeUndefined("text1.setAttribute('x', '1 2 3 4')");
160
161 debug("");
162 debug("Test edge cases for replaceItem()");
163 shouldBe("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(3), 3)", "text 1.x.baseVal.getItem(3)");
164 shouldBe("text1.x.baseVal.numberOfItems", "4");
165 shouldBeEqualToString("text1.getAttribute('x')", "1 2 3 4");
166 shouldBe("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(1), 3)", "text 1.x.baseVal.getItem(3)");
167 shouldBe("text1.x.baseVal.numberOfItems", "4");
168 shouldBeEqualToString("text1.getAttribute('x')", "1 2 3 2");
169 shouldThrow("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(3), 4)");
170
171 debug("");
172 debug("Set x='1 2 3 4' for text1");
173 shouldBeUndefined("text1.setAttribute('x', '1 2 3 4')");
174
175 debug("");
176 debug("Test uncommon arguments for removeItem()");
177 shouldThrow("text1.x.baseVal.removeItem(30)");
178
179 shouldBe("text1.x.baseVal.removeItem(0).value", "1");
180 shouldBe("text1.x.baseVal.numberOfItems", "3");
181 shouldBe("text1.x.baseVal.getItem(0).value", "2");
182 shouldBe("text1.x.baseVal.getItem(1).value", "3");
183 shouldBe("text1.x.baseVal.getItem(2).value", "4");
184 shouldBeEqualToString("text1.getAttribute('x')", "2 3 4");
185
186 shouldBe("text1.x.baseVal.removeItem(text1).value", "2");
187 shouldBe("text1.x.baseVal.numberOfItems", "2");
188 shouldBe("text1.x.baseVal.getItem(0).value", "3");
189 shouldBe("text1.x.baseVal.getItem(1).value", "4");
190 shouldBeEqualToString("text1.getAttribute('x')", "3 4");
191
192 debug("");
193 debug("Test uncommon arguments for appendItem()");
194 shouldThrow("text1.x.baseVal.appendItem(30)");
195 shouldThrow("text1.x.baseVal.appendItem('aString')");
196 shouldThrow("text1.x.baseVal.appendItem(text1)");
197 shouldThrow("text1.x.baseVal.appendItem(null)");
198
199 debug("");
200 debug("Testing animVal clear throws");
201 shouldThrow("text1.x.animVal.clear()");
202 shouldBeUndefined("text1.x.baseVal.clear()");
203
204 gc();
205 ]]>
206 </script>
207 </body>
208 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698