OLD | NEW |
1 <html xmlns="http://www.w3.org/1999/xhtml"> | 1 <html xmlns="http://www.w3.org/1999/xhtml"> |
2 <head> | 2 <head> |
3 <script>window.enablePixelTesting = true;</script> | 3 <script>window.enablePixelTesting = true;</script> |
4 <script src="../../fast/js/resources/js-test-pre.js"></script> | 4 <script src="../../fast/js/resources/js-test-pre.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200"> | 7 <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200"> |
8 <polyline id="poly1" stroke="green" points="0 0 100 0 100 100 0 100"/> | 8 <polyline id="poly1" stroke="green" points="0 0 100 0 100 100 0 100"/> |
9 </svg> | 9 </svg> |
10 | 10 |
11 <p id="description"></p> | 11 <p id="description"></p> |
12 <div id="console"></div> | 12 <div id="console"></div> |
13 <script type="text/javascript"> | 13 <script type="text/javascript"> |
14 <![CDATA[ | 14 <![CDATA[ |
15 description("This is a test of the simple SVGPointList API parts."); | 15 description("This is a test of the simple SVGPointList API parts."); |
16 | 16 |
| 17 if (window.testRunner) |
| 18 testRunner.dumpAsText(); |
| 19 |
17 // Extend String prototype, to offer a function, that formats the points att
ribute in the same way across browsers | 20 // Extend String prototype, to offer a function, that formats the points att
ribute in the same way across browsers |
18 String.prototype.formatPointsAttribute = function() { | 21 String.prototype.formatPointsAttribute = function() { |
19 return this.replace(/,/g, " "); // Remove Firefox commas | 22 return this.replace(/,/g, " "); // Remove Firefox commas |
20 } | 23 } |
21 | 24 |
22 function dumpPoint(point) { | 25 function dumpPoint(point) { |
23 return "x=" + point.x.toFixed(0) + " y=" + point.y.toFixed(0); | 26 return "x=" + point.x.toFixed(0) + " y=" + point.y.toFixed(0); |
24 } | 27 } |
25 | 28 |
26 var svg = document.getElementById("svg"); | 29 var svg = document.getElementById("svg"); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 debug(""); | 125 debug(""); |
123 debug("Test uncommon arguments for replaceItem() and xml-dom synchronization
"); | 126 debug("Test uncommon arguments for replaceItem() and xml-dom synchronization
"); |
124 shouldBe("poly1.points.numberOfItems", "4"); | 127 shouldBe("poly1.points.numberOfItems", "4"); |
125 shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=0 y=0"); | 128 shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=0 y=0"); |
126 shouldBeEqualToString("dumpPoint(poly1.points.getItem(1))", "x=100 y=0"); | 129 shouldBeEqualToString("dumpPoint(poly1.points.getItem(1))", "x=100 y=0"); |
127 shouldBeEqualToString("dumpPoint(poly1.points.getItem(2))", "x=100 y=100"); | 130 shouldBeEqualToString("dumpPoint(poly1.points.getItem(2))", "x=100 y=100"); |
128 shouldBeEqualToString("dumpPoint(poly1.points.getItem(3))", "x=0 y=100"); | 131 shouldBeEqualToString("dumpPoint(poly1.points.getItem(3))", "x=0 y=100"); |
129 shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()"
, "0 0 100 0 100 100 0 100"); | 132 shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()"
, "0 0 100 0 100 100 0 100"); |
130 | 133 |
131 shouldBeEqualToString("dumpPoint(poly1.points.replaceItem(poly1.points.getIt
em(0), 0))", "x=0 y=0"); | 134 shouldBeEqualToString("dumpPoint(poly1.points.replaceItem(poly1.points.getIt
em(0), 0))", "x=0 y=0"); |
132 shouldBe("poly1.points.numberOfItems", "3"); | 135 shouldBe("poly1.points.numberOfItems", "4"); |
133 shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=0 y=0"); | 136 shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=0 y=0"); |
134 shouldBeEqualToString("dumpPoint(poly1.points.getItem(1))", "x=100 y=100"); | 137 shouldBeEqualToString("dumpPoint(poly1.points.getItem(1))", "x=100 y=0"); |
135 shouldBeEqualToString("dumpPoint(poly1.points.getItem(2))", "x=0 y=100"); | 138 shouldBeEqualToString("dumpPoint(poly1.points.getItem(2))", "x=100 y=100"); |
136 shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()"
, "0 0 100 100 0 100"); | 139 shouldBeEqualToString("dumpPoint(poly1.points.getItem(3))", "x=0 y=100"); |
| 140 shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()"
, "0 0 100 0 100 100 0 100"); |
137 | 141 |
138 shouldBeEqualToString("dumpPoint(poly1.points.replaceItem(poly1.points.getIt
em(0), 'aString'))", "x=0 y=0"); | 142 shouldBeEqualToString("dumpPoint(poly1.points.replaceItem(poly1.points.getIt
em(0), 'aString'))", "x=0 y=0"); |
139 shouldBe("poly1.points.numberOfItems", "2"); | 143 shouldBe("poly1.points.numberOfItems", "4"); |
140 shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=0 y=0"); | 144 shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=0 y=0"); |
141 shouldBeEqualToString("dumpPoint(poly1.points.getItem(1))", "x=0 y=100"); | 145 shouldBeEqualToString("dumpPoint(poly1.points.getItem(1))", "x=100 y=0"); |
142 shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()"
, "0 0 0 100"); | 146 shouldBeEqualToString("dumpPoint(poly1.points.getItem(2))", "x=100 y=100"); |
| 147 shouldBeEqualToString("dumpPoint(poly1.points.getItem(3))", "x=0 y=100"); |
| 148 shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()"
, "0 0 100 0 100 100 0 100"); |
143 | 149 |
144 shouldBeEqualToString("dumpPoint(poly1.points.replaceItem(poly1.points.getIt
em(0), poly1))", "x=0 y=0"); | 150 shouldBeEqualToString("dumpPoint(poly1.points.replaceItem(poly1.points.getIt
em(0), poly1))", "x=0 y=0"); |
145 shouldBe("poly1.points.numberOfItems", "1"); | 151 shouldBe("poly1.points.numberOfItems", "4"); |
146 shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=0 y=0"); | 152 shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=0 y=0"); |
147 shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()"
, "0 0"); | 153 shouldBeEqualToString("dumpPoint(poly1.points.getItem(1))", "x=100 y=0"); |
| 154 shouldBeEqualToString("dumpPoint(poly1.points.getItem(2))", "x=100 y=100"); |
| 155 shouldBeEqualToString("dumpPoint(poly1.points.getItem(3))", "x=0 y=100"); |
| 156 shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()"
, "0 0 100 0 100 100 0 100"); |
148 | 157 |
149 shouldThrow("poly1.points.replaceItem(poly1.points.getItem(0), null)"); | 158 shouldBeEqualToString("dumpPoint(poly1.points.replaceItem(poly1.points.getIt
em(0), null))", "x=0 y=0"); |
150 shouldBe("poly1.points.numberOfItems", "0"); | 159 shouldBe("poly1.points.numberOfItems", "4"); |
151 shouldBeEqualToString("poly1.getAttribute('points')", ""); | 160 shouldBeEqualToString("poly1.getAttribute('points')", "0 0 100 0 100 100 0 1
00"); |
152 | 161 |
153 debug(""); | 162 debug(""); |
154 debug("Reset points attribute to 0 0 100 0 100 100 0 100"); | 163 debug("Reset points attribute to 0 0 100 0 100 100 0 100"); |
155 shouldBeUndefined("poly1.setAttribute('points', '0 0 100 0 100 100 0 100')")
; | 164 shouldBeUndefined("poly1.setAttribute('points', '0 0 100 0 100 100 0 100')")
; |
156 | 165 |
157 debug(""); | 166 debug(""); |
158 debug("Test uncommon arguments for removeItem()"); | 167 debug("Test uncommon arguments for removeItem()"); |
159 shouldThrow("poly1.points.removeItem(30)"); | 168 shouldThrow("poly1.points.removeItem(30)"); |
160 | 169 |
161 shouldBeEqualToString("dumpPoint(poly1.points.removeItem('aString'))", "x=0
y=0"); | 170 shouldBeEqualToString("dumpPoint(poly1.points.removeItem('aString'))", "x=0
y=0"); |
(...skipping 25 matching lines...) Expand all Loading... |
187 shouldBe("poly1.points.numberOfItems", "2"); | 196 shouldBe("poly1.points.numberOfItems", "2"); |
188 shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=0 y=100"); | 197 shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=0 y=100"); |
189 shouldBeEqualToString("dumpPoint(poly1.points.getItem(1))", "x=200 y=100"); | 198 shouldBeEqualToString("dumpPoint(poly1.points.getItem(1))", "x=200 y=100"); |
190 shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()"
, "0 100 200 100"); | 199 shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()"
, "0 100 200 100"); |
191 | 200 |
192 ]]> | 201 ]]> |
193 </script> | 202 </script> |
194 <script src="../../fast/js/resources/js-test-post.js"></script> | 203 <script src="../../fast/js/resources/js-test-post.js"></script> |
195 </body> | 204 </body> |
196 </html> | 205 </html> |
OLD | NEW |