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

Side by Side Diff: LayoutTests/svg/dom/SVGPointList-basics.xhtml

Issue 1177303004: Updated SVGListPropertyHelper as per SVG2 Spec (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fixed presubmit error Created 5 years, 6 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
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="../../resources/js-test.js"></script> 4 <script src="../../resources/js-test.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
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 shouldBe("poly1.points.getItem(null)", "poly1.points.getItem(0)"); 70 shouldBe("poly1.points.getItem(null)", "poly1.points.getItem(0)");
71 71
72 debug(""); 72 debug("");
73 debug("Test uncommon arguments for insertItemBefore()"); 73 debug("Test uncommon arguments for insertItemBefore()");
74 shouldThrow("poly1.points.insertItemBefore(30)"); 74 shouldThrow("poly1.points.insertItemBefore(30)");
75 shouldThrow("poly1.points.insertItemBefore('aString')"); 75 shouldThrow("poly1.points.insertItemBefore('aString')");
76 shouldThrow("poly1.points.insertItemBefore(poly1)"); 76 shouldThrow("poly1.points.insertItemBefore(poly1)");
77 shouldThrow("poly1.points.insertItemBefore(null)"); 77 shouldThrow("poly1.points.insertItemBefore(null)");
78 78
79 shouldBeEqualToString("dumpPoint(poly1.points.insertItemBefore(poly1.points. getItem(1), 'aString'))", "x=100 y=0"); 79 shouldBeEqualToString("dumpPoint(poly1.points.insertItemBefore(poly1.points. getItem(1), 'aString'))", "x=100 y=0");
80 shouldBe("poly1.points.numberOfItems", "4"); 80 shouldBe("poly1.points.numberOfItems", "5");
81 shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=100 y=0"); 81 shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=100 y=0");
82 shouldBeEqualToString("dumpPoint(poly1.points.getItem(1))", "x=0 y=0"); 82 shouldBeEqualToString("dumpPoint(poly1.points.getItem(1))", "x=0 y=0");
83 shouldBeEqualToString("dumpPoint(poly1.points.getItem(2))", "x=100 y=100"); 83 shouldBeEqualToString("dumpPoint(poly1.points.getItem(2))", "x=100 y=0");
84 shouldBeEqualToString("dumpPoint(poly1.points.getItem(3))", "x=0 y=100"); 84 shouldBeEqualToString("dumpPoint(poly1.points.getItem(3))", "x=100 y=100");
85 shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()" , "100 0 0 0 100 100 0 100"); 85 shouldBeEqualToString("dumpPoint(poly1.points.getItem(4))", "x=0 y=100");
86 shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()" , "100 0 0 0 100 0 100 100 0 100");
86 87
87 shouldBeEqualToString("dumpPoint(poly1.points.insertItemBefore(poly1.points. getItem(1), poly1))", "x=0 y=0"); 88 shouldBeEqualToString("dumpPoint(poly1.points.insertItemBefore(poly1.points. getItem(1), poly1))", "x=0 y=0");
88 shouldBe("poly1.points.numberOfItems", "4"); 89 shouldBe("poly1.points.numberOfItems", "6");
89 shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=0 y=0"); 90 shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=0 y=0");
90 shouldBeEqualToString("dumpPoint(poly1.points.getItem(1))", "x=100 y=0"); 91 shouldBeEqualToString("dumpPoint(poly1.points.getItem(1))", "x=100 y=0");
91 shouldBeEqualToString("dumpPoint(poly1.points.getItem(2))", "x=100 y=100"); 92 shouldBeEqualToString("dumpPoint(poly1.points.getItem(2))", "x=0 y=0");
92 shouldBeEqualToString("dumpPoint(poly1.points.getItem(3))", "x=0 y=100"); 93 shouldBeEqualToString("dumpPoint(poly1.points.getItem(3))", "x=100 y=0");
93 shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()" , "0 0 100 0 100 100 0 100"); 94 shouldBeEqualToString("dumpPoint(poly1.points.getItem(4))", "x=100 y=100");
95 shouldBeEqualToString("dumpPoint(poly1.points.getItem(5))", "x=0 y=100");
96 shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()" , "0 0 100 0 0 0 100 0 100 100 0 100");
94 97
95 shouldBeEqualToString("dumpPoint(poly1.points.insertItemBefore(poly1.points. getItem(1), null))", "x=100 y=0"); 98 shouldBeEqualToString("dumpPoint(poly1.points.insertItemBefore(poly1.points. getItem(1), null))", "x=100 y=0");
96 shouldBe("poly1.points.numberOfItems", "4"); 99 shouldBe("poly1.points.numberOfItems", "7");
97 shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=100 y=0"); 100 shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=100 y=0");
98 shouldBeEqualToString("dumpPoint(poly1.points.getItem(1))", "x=0 y=0"); 101 shouldBeEqualToString("dumpPoint(poly1.points.getItem(1))", "x=0 y=0");
99 shouldBeEqualToString("dumpPoint(poly1.points.getItem(2))", "x=100 y=100"); 102 shouldBeEqualToString("dumpPoint(poly1.points.getItem(2))", "x=100 y=0");
100 shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()" , "100 0 0 0 100 100 0 100"); 103 shouldBeEqualToString("dumpPoint(poly1.points.getItem(3))", "x=0 y=0");
104 shouldBeEqualToString("dumpPoint(poly1.points.getItem(4))", "x=100 y=0");
105 shouldBeEqualToString("dumpPoint(poly1.points.getItem(5))", "x=100 y=100");
106 shouldBeEqualToString("dumpPoint(poly1.points.getItem(6))", "x=0 y=100");
107 shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()" , "100 0 0 0 100 0 0 0 100 0 100 100 0 100");
101 108
102 shouldBeEqualToString("dumpPoint(poly1.points.insertItemBefore(poly1.points. getItem(1), 0))", "x=0 y=0"); 109 shouldBeEqualToString("dumpPoint(poly1.points.insertItemBefore(poly1.points. getItem(1), 0))", "x=0 y=0");
103 shouldBe("poly1.points.numberOfItems", "4"); 110 shouldBe("poly1.points.numberOfItems", "8");
104 shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=0 y=0"); 111 shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=0 y=0");
105 shouldBeEqualToString("dumpPoint(poly1.points.getItem(1))", "x=100 y=0"); 112 shouldBeEqualToString("dumpPoint(poly1.points.getItem(1))", "x=100 y=0");
106 shouldBeEqualToString("dumpPoint(poly1.points.getItem(2))", "x=100 y=100"); 113 shouldBeEqualToString("dumpPoint(poly1.points.getItem(2))", "x=0 y=0");
107 shouldBeEqualToString("dumpPoint(poly1.points.getItem(3))", "x=0 y=100"); 114 shouldBeEqualToString("dumpPoint(poly1.points.getItem(3))", "x=100 y=0");
108 shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()" , "0 0 100 0 100 100 0 100"); 115 shouldBeEqualToString("dumpPoint(poly1.points.getItem(4))", "x=0 y=0");
116 shouldBeEqualToString("dumpPoint(poly1.points.getItem(5))", "x=100 y=0");
117 shouldBeEqualToString("dumpPoint(poly1.points.getItem(6))", "x=100 y=100");
118 shouldBeEqualToString("dumpPoint(poly1.points.getItem(7))", "x=0 y=100");
119 shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()" , "0 0 100 0 0 0 100 0 0 0 100 0 100 100 0 100");
109 120
110 shouldThrow("poly1.points.insertItemBefore(30, 0)"); 121 shouldThrow("poly1.points.insertItemBefore(30, 0)");
111 shouldThrow("poly1.points.insertItemBefore('aString', 0)"); 122 shouldThrow("poly1.points.insertItemBefore('aString', 0)");
112 shouldThrow("poly1.points.insertItemBefore(poly1, 0)"); 123 shouldThrow("poly1.points.insertItemBefore(poly1, 0)");
113 shouldThrow("poly1.points.insertItemBefore(null, 0)"); 124 shouldThrow("poly1.points.insertItemBefore(null, 0)");
114 125
115 debug(""); 126 debug("");
116 debug("Test uncommon arguments for replaceItem()"); 127 debug("Test uncommon arguments for replaceItem()");
117 shouldThrow("poly1.points.replaceItem(30)"); 128 shouldThrow("poly1.points.replaceItem(30)");
118 shouldThrow("poly1.points.replaceItem('aString')"); 129 shouldThrow("poly1.points.replaceItem('aString')");
119 shouldThrow("poly1.points.replaceItem(poly1)"); 130 shouldThrow("poly1.points.replaceItem(poly1)");
120 shouldThrow("poly1.points.replaceItem(null, 0)"); 131 shouldThrow("poly1.points.replaceItem(null, 0)");
121 shouldThrow("poly1.points.replaceItem('aString', 0)"); 132 shouldThrow("poly1.points.replaceItem('aString', 0)");
122 shouldThrow("poly1.points.replaceItem(poly1, 0)"); 133 shouldThrow("poly1.points.replaceItem(poly1, 0)");
123 shouldThrow("poly1.points.replaceItem(1, 0)"); 134 shouldThrow("poly1.points.replaceItem(1, 0)");
124 135
125 debug(""); 136 debug("");
126 debug("Test uncommon values for indexed setter"); 137 debug("Test uncommon values for indexed setter");
127 shouldThrow("poly1.points[0] = 30"); 138 shouldThrow("poly1.points[0] = 30");
128 shouldThrow("poly1.points[0] = 'aString'"); 139 shouldThrow("poly1.points[0] = 'aString'");
129 shouldThrow("poly1.points[0] = poly1"); 140 shouldThrow("poly1.points[0] = poly1");
130 shouldThrow("poly1.points[0] = null"); 141 shouldThrow("poly1.points[0] = null");
131 142
132 debug(""); 143 debug("");
133 debug("Test uncommon arguments for replaceItem() and xml-dom synchronization "); 144 debug("Test uncommon arguments for replaceItem() and xml-dom synchronization ");
134 shouldBe("poly1.points.numberOfItems", "4"); 145 shouldBe("poly1.points.numberOfItems", "8");
135 shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=0 y=0"); 146 shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=0 y=0");
136 shouldBeEqualToString("dumpPoint(poly1.points.getItem(1))", "x=100 y=0"); 147 shouldBeEqualToString("dumpPoint(poly1.points.getItem(1))", "x=100 y=0");
137 shouldBeEqualToString("dumpPoint(poly1.points.getItem(2))", "x=100 y=100"); 148 shouldBeEqualToString("dumpPoint(poly1.points.getItem(2))", "x=0 y=0");
138 shouldBeEqualToString("dumpPoint(poly1.points.getItem(3))", "x=0 y=100"); 149 shouldBeEqualToString("dumpPoint(poly1.points.getItem(3))", "x=100 y=0");
139 shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()" , "0 0 100 0 100 100 0 100"); 150 shouldBeEqualToString("dumpPoint(poly1.points.getItem(4))", "x=0 y=0");
151 shouldBeEqualToString("dumpPoint(poly1.points.getItem(5))", "x=100 y=0");
152 shouldBeEqualToString("dumpPoint(poly1.points.getItem(6))", "x=100 y=100");
153 shouldBeEqualToString("dumpPoint(poly1.points.getItem(7))", "x=0 y=100");
154 shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()" , "0 0 100 0 0 0 100 0 0 0 100 0 100 100 0 100");
140 155
141 shouldBeEqualToString("dumpPoint(poly1.points.replaceItem(poly1.points.getIt em(0), 0))", "x=0 y=0"); 156 shouldBeEqualToString("dumpPoint(poly1.points.replaceItem(poly1.points.getIt em(0), 0))", "x=0 y=0");
142 shouldBe("poly1.points.numberOfItems", "4"); 157 shouldBe("poly1.points.numberOfItems", "8");
143 shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=0 y=0"); 158 shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=0 y=0");
144 shouldBeEqualToString("dumpPoint(poly1.points.getItem(1))", "x=100 y=0"); 159 shouldBeEqualToString("dumpPoint(poly1.points.getItem(1))", "x=100 y=0");
145 shouldBeEqualToString("dumpPoint(poly1.points.getItem(2))", "x=100 y=100"); 160 shouldBeEqualToString("dumpPoint(poly1.points.getItem(2))", "x=0 y=0");
146 shouldBeEqualToString("dumpPoint(poly1.points.getItem(3))", "x=0 y=100"); 161 shouldBeEqualToString("dumpPoint(poly1.points.getItem(3))", "x=100 y=0");
147 shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()" , "0 0 100 0 100 100 0 100"); 162 shouldBeEqualToString("dumpPoint(poly1.points.getItem(4))", "x=0 y=0");
163 shouldBeEqualToString("dumpPoint(poly1.points.getItem(5))", "x=100 y=0");
164 shouldBeEqualToString("dumpPoint(poly1.points.getItem(6))", "x=100 y=100");
165 shouldBeEqualToString("dumpPoint(poly1.points.getItem(7))", "x=0 y=100");
166 shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()" , "0 0 100 0 0 0 100 0 0 0 100 0 100 100 0 100");
148 167
149 shouldBeEqualToString("dumpPoint(poly1.points.replaceItem(poly1.points.getIt em(0), 'aString'))", "x=0 y=0"); 168 shouldBeEqualToString("dumpPoint(poly1.points.replaceItem(poly1.points.getIt em(0), 'aString'))", "x=0 y=0");
150 shouldBe("poly1.points.numberOfItems", "4"); 169 shouldBe("poly1.points.numberOfItems", "8");
151 shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=0 y=0"); 170 shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=0 y=0");
152 shouldBeEqualToString("dumpPoint(poly1.points.getItem(1))", "x=100 y=0"); 171 shouldBeEqualToString("dumpPoint(poly1.points.getItem(1))", "x=100 y=0");
153 shouldBeEqualToString("dumpPoint(poly1.points.getItem(2))", "x=100 y=100"); 172 shouldBeEqualToString("dumpPoint(poly1.points.getItem(2))", "x=0 y=0");
154 shouldBeEqualToString("dumpPoint(poly1.points.getItem(3))", "x=0 y=100"); 173 shouldBeEqualToString("dumpPoint(poly1.points.getItem(3))", "x=100 y=0");
155 shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()" , "0 0 100 0 100 100 0 100"); 174 shouldBeEqualToString("dumpPoint(poly1.points.getItem(4))", "x=0 y=0");
175 shouldBeEqualToString("dumpPoint(poly1.points.getItem(5))", "x=100 y=0");
176 shouldBeEqualToString("dumpPoint(poly1.points.getItem(6))", "x=100 y=100");
177 shouldBeEqualToString("dumpPoint(poly1.points.getItem(7))", "x=0 y=100");
178 shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()" , "0 0 100 0 0 0 100 0 0 0 100 0 100 100 0 100");
156 179
157 shouldBeEqualToString("dumpPoint(poly1.points.replaceItem(poly1.points.getIt em(0), poly1))", "x=0 y=0"); 180 shouldBeEqualToString("dumpPoint(poly1.points.replaceItem(poly1.points.getIt em(0), poly1))", "x=0 y=0");
158 shouldBe("poly1.points.numberOfItems", "4"); 181 shouldBe("poly1.points.numberOfItems", "8");
159 shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=0 y=0"); 182 shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=0 y=0");
160 shouldBeEqualToString("dumpPoint(poly1.points.getItem(1))", "x=100 y=0"); 183 shouldBeEqualToString("dumpPoint(poly1.points.getItem(1))", "x=100 y=0");
161 shouldBeEqualToString("dumpPoint(poly1.points.getItem(2))", "x=100 y=100"); 184 shouldBeEqualToString("dumpPoint(poly1.points.getItem(2))", "x=0 y=0");
162 shouldBeEqualToString("dumpPoint(poly1.points.getItem(3))", "x=0 y=100"); 185 shouldBeEqualToString("dumpPoint(poly1.points.getItem(3))", "x=100 y=0");
163 shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()" , "0 0 100 0 100 100 0 100"); 186 shouldBeEqualToString("dumpPoint(poly1.points.getItem(4))", "x=0 y=0");
187 shouldBeEqualToString("dumpPoint(poly1.points.getItem(5))", "x=100 y=0");
188 shouldBeEqualToString("dumpPoint(poly1.points.getItem(6))", "x=100 y=100");
189 shouldBeEqualToString("dumpPoint(poly1.points.getItem(7))", "x=0 y=100");
190 shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()" , "0 0 100 0 0 0 100 0 0 0 100 0 100 100 0 100");
164 191
165 shouldBeEqualToString("dumpPoint(poly1.points.replaceItem(poly1.points.getIt em(0), null))", "x=0 y=0"); 192 shouldBeEqualToString("dumpPoint(poly1.points.replaceItem(poly1.points.getIt em(0), null))", "x=0 y=0");
166 shouldBe("poly1.points.numberOfItems", "4"); 193 shouldBe("poly1.points.numberOfItems", "8");
167 shouldBeEqualToString("poly1.getAttribute('points')", "0 0 100 0 100 100 0 1 00"); 194 shouldBeEqualToString("poly1.getAttribute('points')", "0 0 100 0 0 0 100 0 0 0 100 0 100 100 0 100");
168 195
169 debug(""); 196 debug("");
170 debug("Reset points attribute to 0 0 100 0 100 100 0 100"); 197 debug("Reset points attribute to 0 0 100 0 100 100 0 100");
171 shouldBeUndefined("poly1.setAttribute('points', '0 0 100 0 100 100 0 100')") ; 198 shouldBeUndefined("poly1.setAttribute('points', '0 0 100 0 100 100 0 100')") ;
172 199
173 debug(""); 200 debug("");
174 debug("Test uncommon arguments for removeItem()"); 201 debug("Test uncommon arguments for removeItem()");
175 shouldThrow("poly1.points.removeItem(30)"); 202 shouldThrow("poly1.points.removeItem(30)");
176 203
177 shouldBeEqualToString("dumpPoint(poly1.points.removeItem('aString'))", "x=0 y=0"); 204 shouldBeEqualToString("dumpPoint(poly1.points.removeItem('aString'))", "x=0 y=0");
(...skipping 24 matching lines...) Expand all
202 shouldBeEqualToString("dumpPoint(poly1.points.appendItem(point))", "x=200 y= 100"); 229 shouldBeEqualToString("dumpPoint(poly1.points.appendItem(point))", "x=200 y= 100");
203 shouldBe("poly1.points.numberOfItems", "2"); 230 shouldBe("poly1.points.numberOfItems", "2");
204 shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=0 y=100"); 231 shouldBeEqualToString("dumpPoint(poly1.points.getItem(0))", "x=0 y=100");
205 shouldBeEqualToString("dumpPoint(poly1.points.getItem(1))", "x=200 y=100"); 232 shouldBeEqualToString("dumpPoint(poly1.points.getItem(1))", "x=200 y=100");
206 shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()" , "0 100 200 100"); 233 shouldBeEqualToString("poly1.getAttribute('points').formatPointsAttribute()" , "0 100 200 100");
207 234
208 ]]> 235 ]]>
209 </script> 236 </script>
210 </body> 237 </body>
211 </html> 238 </html>
OLDNEW
« no previous file with comments | « LayoutTests/svg/dom/SVGPathSegList-replaceItem-expected.txt ('k') | LayoutTests/svg/dom/SVGPointList-basics-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698