OLD | NEW |
1 <html> | 1 <script src="../../resources/testharness.js"></script> |
2 <head> | 2 <script src="../../resources/testharnessreport.js"></script> |
3 <style> | 3 |
4 .fail { color: red; font-weight: bold;} | 4 <script> |
5 .pass { color: green; font-weight: bold;} | 5 test(function () { |
6 </style> | 6 var canvas = document.createElement('canvas'); |
7 <script type="text/javascript"> | 7 var context = canvas.getContext('2d'); |
8 failed = false; | |
9 | |
10 function debug(msg) { | |
11 var span = document.createElement("span"); | |
12 span.innerHTML = msg + '<br>'; | |
13 document.getElementById("console").appendChild(span); | |
14 } | |
15 | |
16 function pass(msg) { | |
17 debug('<span class="pass">PASS</span> ' + msg + '</span>'); | |
18 } | |
19 | |
20 function fail(msg) { | |
21 debug('<span class="fail">FAIL</span> ' + msg + '</span>'); | |
22 failed = true; | |
23 } | |
24 | |
25 function runTest() { | |
26 var canvas = document.getElementById("test"); | |
27 var context = canvas.getContext("2d"); | |
28 context.fillStyle = '#f00'; | 8 context.fillStyle = '#f00'; |
| 9 |
29 context.fillRect(0, 0, canvas.width, canvas.height); | 10 context.fillRect(0, 0, canvas.width, canvas.height); |
30 try { | 11 context.fillRect(0, 0, 0, 0); |
31 context.fillRect(0, 0, 0, 0); | 12 context.fillRect(0, 0, 0.0/1.0, 0.0/1.0); |
32 pass("called fillRect 0*0 fillRect without throwing an exception."); | 13 context.fillRect(0, 0, NaN, NaN); |
33 } catch (e) { | 14 |
34 fail("threw exception code " + e.code + " with 0*0 fillRect"); | 15 context.clearRect(0, 0, 0, 0); |
35 } | 16 context.clearRect(0, 0, 0.0/1.0, 0.0/1.0); |
36 try { | 17 context.clearRect(0, 0, NaN, NaN); |
37 context.fillRect(0, 0, 0.0/1.0, 0.0/1.0); | 18 |
38 pass("called fillRect with Infinity*Infinity fillRect without throwing a
n exception."); | 19 context.rect(0, 0, 0, 0); |
39 } catch (e) { | 20 context.rect(0, 0, 0.0/1.0, 0.0/1.0); |
40 fail("threw exception code " + e.code + " with Infinity*Infinity fillRec
t"); | 21 context.rect(0, 0, NaN, NaN); |
41 } | 22 |
42 try { | 23 context.fill(); |
43 context.fillRect(0, 0, NaN, NaN); | 24 context.arc(2, 2, 0, 0, 90, true); |
44 pass("did not throw exception with NaN*NaN fillRect."); | 25 assert_throws(null, function() {context.arc(2, 2, -10, 0, 90, true);}); |
45 } catch (e) { | 26 context.arc(2, 2, Infinity, 0, 90, true); |
46 fail("threw exception code " + e.code + " on NaN*NaN fillRect."); | 27 context.arc(2, 2, NaN, 0, 90, true); |
47 } | 28 |
48 try { | 29 context.beginPath(); |
49 context.clearRect(0, 0, 0, 0); | 30 context.moveTo(10, 10); |
50 pass("called clearRect 0*0 clearRect without throwing an exception."); | 31 context.arcTo(2, 2, 4, 4, 0); |
51 } catch (e) { | 32 context.closePath(); |
52 fail("threw exception code " + e.code + " with 0*0 clearRect."); | 33 |
53 } | 34 context.beginPath(); |
54 try { | 35 context.moveTo(10, 10); |
55 context.clearRect(0, 0, 0.0/1.0, 0.0/1.0); | 36 assert_throws(null, function() {context.arcTo(2, 2, 4, 4, -10);}); |
56 pass("called clearRect with Infinity*Infinity clearRect without throwing
an exception."); | 37 context.closePath(); |
57 } catch (e) { | 38 |
58 fail("threw exception code " + e.code + " with Infinity*Infinity clearRe
ct."); | 39 context.beginPath(); |
59 } | 40 context.moveTo(10, 10); |
60 try { | 41 context.arcTo(2, 2, 4, 4, Infinity); |
61 context.clearRect(0, 0, NaN, NaN); | 42 context.closePath(); |
62 pass("did not throw exception with NaN*NaN clearRect."); | 43 |
63 } catch (e) { | 44 context.beginPath(); |
64 fail("threw exception code " + e.code + " on NaN*NaN clearRect.");
| 45 context.moveTo(10, 10); |
65 } | 46 context.arcTo(2, 2, 4, 4, NaN); |
66 try { | 47 context.closePath(); |
67 context.rect(0, 0, 0, 0); | 48 |
68 pass("called rect 0*0 rect without throwing an exception."); | 49 context.beginPath(); |
69 } catch (e) { | 50 context.moveTo(10, 10); |
70 fail("threw exception code " + e.code + " with 0*0 rect."); | 51 context.lineTo(Infinity, Infinity); |
71 } | 52 context.closePath(); |
72 try { | 53 |
73 context.rect(0, 0, 0.0/1.0, 0.0/1.0); | 54 context.beginPath(); |
74 pass("called rect with Infinity*Infinity rect without throwing an except
ion."); | 55 context.moveTo(10, 10); |
75 } catch (e) { | 56 context.lineTo(Infinity, 20); |
76 fail("threw exception code " + e.code + " with Infinity*Infinity rect.")
; | 57 context.closePath(); |
77 } | 58 |
78 try { | 59 context.beginPath(); |
79 context.rect(0, 0, NaN, NaN); | 60 context.moveTo(10, 10); |
80 pass("did not throw exception with NaN*NaN rect."); | 61 context.lineTo(20, Infinity); |
81 } catch (e) { | 62 context.closePath(); |
82 fail("threw exception code " + e.code + " on NaN*NaN rect."); | 63 |
83 } | 64 context.beginPath(); |
84 try { | 65 context.moveTo(10, 10); |
85 context.fill(); | 66 context.lineTo(NaN, NaN); |
86 pass("called fill with an empty path without throwing an exception."); | 67 context.closePath(); |
87 } catch (e) { | 68 |
88 fail("threw exception code " + e.code + " on fill with no path.");
| 69 context.beginPath(); |
89 } | 70 context.moveTo(10, 10); |
90 try { | 71 context.lineTo(20, NaN); |
91 context.arc(2, 2, 0, 0, 90, true); | 72 context.closePath(); |
92 pass("did not throw exception on arc with zero-length radius"); | 73 |
93 } catch (e) { | 74 context.beginPath(); |
94 fail("threw exception code " + e.code + " on arc with zero-length radius
"); | 75 context.moveTo(10, 10); |
95 } | 76 context.lineTo(NaN, 20); |
96 try { | 77 context.closePath(); |
97 context.arc(2, 2, -10, 0, 90, true); | 78 |
98 fail("did not throw exception on arc with negative-length radius"); | 79 context.beginPath(); |
99 } catch (e) { | 80 context.moveTo(10, 10); |
100 pass("threw exception code " + e.code + " on arc with negative-length ra
dius"); | 81 context.quadraticCurveTo(20, 20, Infinity, Infinity); |
101 } | 82 context.closePath(); |
102 try { | 83 |
103 context.arc(2, 2, Infinity, 0, 90, true); | 84 context.beginPath(); |
104 pass("did not throw exception on arc with infinite radius"); | 85 context.moveTo(10, 10); |
105 } catch (e) { | 86 context.quadraticCurveTo(Infinity, Infinity, 20, 20); |
106 fail("threw exception code " + e.code + " on arc with infinite radius");
| 87 context.closePath(); |
107 } | 88 |
108 try { | 89 context.beginPath(); |
109 context.arc(2, 2, NaN, 0, 90, true); | 90 context.moveTo(10, 10); |
110 pass("did not throw exception on arc with NaN-length radius"); | 91 context.quadraticCurveTo(Infinity, 20, 20, 20); |
111 } catch (e) { | 92 context.closePath(); |
112 fail("threw exception code " + e.code + " on arc with NaN-length radius"
); | 93 |
113 } | 94 context.beginPath(); |
114 context.beginPath(); | 95 context.moveTo(10, 10); |
115 try { | 96 context.quadraticCurveTo(20, Infinity, 20, 20); |
116 context.moveTo(10, 10); | 97 context.closePath(); |
117 context.arcTo(2, 2, 4, 4, 0); | 98 |
118 pass("did not throw exception on arcTo with zero-length radius"); | 99 context.beginPath(); |
119 } catch (e) { | 100 context.moveTo(10, 10); |
120 fail("threw exception code " + e.code + " on arcTo with zero-length radi
us"); | 101 context.quadraticCurveTo(20, 20, Infinity, 20); |
121 } | 102 context.closePath(); |
122 context.closePath(); | 103 |
123 context.beginPath(); | 104 context.beginPath(); |
124 try { | 105 context.moveTo(10, 10); |
125 context.moveTo(10, 10); | 106 context.quadraticCurveTo(20, 20, 20, Infinity); |
126 context.arcTo(2, 2, 4, 4, -10); | 107 context.closePath(); |
127 fail("did not throw exception on arcTo with negative-length radius"); | 108 |
128 } catch (e) { | 109 context.beginPath(); |
129 pass("threw exception code " + e.code + " on arcTo with negative-length
radius"); | 110 context.moveTo(10, 10); |
130 } | 111 context.quadraticCurveTo(20, 20, NaN, NaN); |
131 context.closePath(); | 112 context.closePath(); |
132 context.beginPath(); | 113 |
133 try { | 114 context.beginPath(); |
134 context.moveTo(10, 10); | 115 context.moveTo(10, 10); |
135 context.arcTo(2, 2, 4, 4, Infinity); | 116 context.quadraticCurveTo(NaN, NaN, 20, 20); |
136 pass("did not throw exception on arcTo with infinite radius"); | 117 context.closePath(); |
137 } catch (e) { | 118 |
138 fail("threw exception code " + e.code + " on arcTo with infinite radius"
); | 119 context.beginPath(); |
139 } | 120 context.moveTo(10, 10); |
140 context.closePath(); | 121 context.quadraticCurveTo(NaN, 20, 20, 20); |
141 context.beginPath(); | 122 context.closePath(); |
142 try { | 123 |
143 context.moveTo(10, 10); | 124 context.beginPath(); |
144 context.arcTo(2, 2, 4, 4, NaN); | 125 context.moveTo(10, 10); |
145 pass("did not throw exception on arcTo with NaN-length radius"); | 126 context.quadraticCurveTo(20, NaN, 20, 20); |
146 } catch (e) { | 127 context.closePath(); |
147 fail("threw exception code " + e.code + " on arcTo with NaN-length radiu
s"); | 128 |
148 } | 129 context.beginPath(); |
149 context.closePath(); | 130 context.moveTo(10, 10); |
150 context.beginPath(); | 131 context.quadraticCurveTo(20, 20, NaN, 20); |
151 try { | 132 context.closePath(); |
152 context.moveTo(10, 10); | 133 |
153 context.lineTo(Infinity, Infinity); | 134 context.beginPath(); |
154 pass("did not throw exception on lineTo(Infinity, Infinity)."); | 135 context.moveTo(10, 10); |
155 } catch (e) { | 136 context.quadraticCurveTo(20, 20, 20, NaN); |
156 fail("threw exception code " + e.code + " on lineTo(Infinity, Infinity).
"); | 137 context.closePath(); |
157 } | 138 |
158 context.closePath(); | 139 context.beginPath(); |
159 context.beginPath(); | 140 context.moveTo(10, 10); |
160 try { | 141 context.bezierCurveTo(20, 20, 30, 30, Infinity, Infinity); |
161 context.moveTo(10, 10); | 142 context.closePath(); |
162 context.lineTo(Infinity, 20); | 143 |
163 pass("did not throw exception on lineTo(Infinity, 20)."); | 144 context.beginPath(); |
164 } catch (e) { | 145 context.moveTo(10, 10); |
165 fail("threw exception code " + e.code + " on lineTo(Infinity, 20).");
| 146 context.bezierCurveTo(20, 20, 30, 30, 30, Infinity); |
166 } | 147 context.closePath(); |
167 context.closePath(); | 148 |
168 context.beginPath(); | 149 context.beginPath(); |
169 try { | 150 context.moveTo(10, 10); |
170 context.moveTo(10, 10); | 151 context.bezierCurveTo(20, 20, 30, 30, Infinity, 30); |
171 context.lineTo(20, Infinity); | 152 context.closePath(); |
172 pass("did not throw exception on lineTo(20, Infinity)."); | 153 |
173 } catch (e) { | 154 context.beginPath(); |
174 fail("threw exception code " + e.code + " on lineTo(20, Infinity).");
| 155 context.moveTo(10, 10); |
175 } | 156 context.bezierCurveTo(20, 20, Infinity, Infinity, 30, 30); |
176 context.closePath(); | 157 context.closePath(); |
177 context.beginPath(); | 158 |
178 try { | 159 context.beginPath(); |
179 context.moveTo(10, 10); | 160 context.moveTo(10, 10); |
180 context.lineTo(NaN, NaN); | 161 context.bezierCurveTo(20, 20, 30, Infinity, 30, 30); |
181 pass("did not throw exception on lineTo(NaN, NaN)."); | 162 context.closePath(); |
182 } catch (e) { | 163 |
183 fail("threw exception code " + e.code + " on lineTo(NaN, NaN)."); | 164 context.beginPath(); |
184 } | 165 context.moveTo(10, 10); |
185 context.closePath(); | 166 context.bezierCurveTo(20, 20, Infinity, 30, 30, 30); |
186 context.beginPath(); | 167 context.closePath(); |
187 try { | 168 |
188 context.moveTo(10, 10); | 169 context.beginPath(); |
189 context.lineTo(20, NaN); | 170 context.moveTo(10, 10); |
190 pass("did not throw exception on lineTo(20, NaN)."); | 171 context.bezierCurveTo(Infinity, Infinity, 20, 20, 30, 30); |
191 } catch (e) { | 172 context.closePath(); |
192 fail("threw exception code " + e.code + " on lineTo(20, NaN)."); | 173 |
193 } | 174 context.beginPath(); |
194 context.closePath(); | 175 context.moveTo(10, 10); |
195 context.beginPath(); | 176 context.bezierCurveTo(30, Infinity, 20, 20, 30, 30); |
196 try { | 177 context.closePath(); |
197 context.moveTo(10, 10); | 178 |
198 context.lineTo(NaN, 20); | 179 context.beginPath(); |
199 pass("did not throw exception on lineTo(NaN, 20)."); | 180 context.moveTo(10, 10); |
200 } catch (e) { | 181 context.bezierCurveTo(Infinity, 30, 20, 20, 30, 30); |
201 fail("threw exception code " + e.code + " on lineTo(NaN, 20)."); | 182 context.closePath(); |
202 } | 183 |
203 context.closePath(); | 184 context.beginPath(); |
204 context.beginPath(); | 185 context.moveTo(10, 10); |
205 try { | 186 context.bezierCurveTo(20, 20, 30, 30, NaN, NaN); |
206 context.moveTo(10, 10); | 187 context.closePath(); |
207 context.quadraticCurveTo(20, 20, Infinity, Infinity); | 188 |
208 pass("did not throw exception on quadraticCurveTo(20, 20, Infinity, Infi
nity)."); | 189 context.beginPath(); |
209 } catch (e) { | 190 context.moveTo(10, 10); |
210 fail("threw exception code " + e.code + " on quadraticCurveTo(20, 20, In
finity, Infinity)."); | 191 context.bezierCurveTo(20, 20, 30, 30, 0, NaN); |
211 } | 192 context.closePath(); |
212 context.closePath(); | 193 |
213 context.beginPath(); | 194 context.beginPath(); |
214 try { | 195 context.moveTo(10, 10); |
215 context.moveTo(10, 10); | 196 context.bezierCurveTo(20, 20, 30, 30, NaN, 0); |
216 context.quadraticCurveTo(Infinity, Infinity, 20, 20); | 197 context.closePath(); |
217 pass("did not throw exception on quadraticCurveTo(Infinity, Infinity, 20
, 20)."); | 198 |
218 } catch (e) { | 199 context.beginPath(); |
219 fail("threw exception code " + e.code + " on quadraticCurveTo(Infinity,
Infinity, 20, 20)."); | 200 context.moveTo(10, 10); |
220 } | 201 context.bezierCurveTo(20, 20, NaN, NaN, 30, 30); |
221 context.closePath(); | 202 context.closePath(); |
222 context.beginPath(); | 203 |
223 try { | 204 context.beginPath(); |
224 context.moveTo(10, 10); | 205 context.moveTo(10, 10); |
225 context.quadraticCurveTo(Infinity, 20, 20, 20); | 206 context.bezierCurveTo(20, 20, 30, NaN, 30, 30); |
226 pass("did not throw exception on quadraticCurveTo(Infinity, 20, 20, 20).
"); | 207 context.closePath(); |
227 } catch (e) { | 208 |
228 fail("threw exception code " + e.code + " on quadraticCurveTo(Infinity,
20, 20, 20)."); | 209 context.beginPath(); |
229 } | 210 context.moveTo(10, 10); |
230 context.closePath(); | 211 context.bezierCurveTo(20, 20, NaN, 30, 30, 30); |
231 context.beginPath(); | 212 context.closePath(); |
232 try { | 213 |
233 context.moveTo(10, 10); | 214 context.beginPath(); |
234 context.quadraticCurveTo(20, Infinity, 20, 20); | 215 context.moveTo(10, 10); |
235 pass("did not throw exception on quadraticCurveTo(20, Infinity, 20, 20).
"); | 216 context.bezierCurveTo(NaN, NaN, 20, 20, 30, 30); |
236 } catch (e) { | 217 context.closePath(); |
237 fail("threw exception code " + e.code + " on quadraticCurveTo(20, Infini
ty, 20, 20)."); | 218 |
238 } | 219 context.beginPath(); |
239 context.closePath(); | 220 context.moveTo(10, 10); |
240 context.beginPath(); | 221 context.bezierCurveTo(20, NaN, 20, 20, 30, 30); |
241 try { | 222 context.closePath(); |
242 context.moveTo(10, 10); | 223 |
243 context.quadraticCurveTo(20, 20, Infinity, 20); | 224 context.beginPath(); |
244 pass("did not throw exception on quadraticCurveTo(20, 20, Infinity, 20).
"); | 225 context.moveTo(10, 10); |
245 } catch (e) { | 226 context.bezierCurveTo(NaN, 20, 20, 20, 30, 30); |
246 fail("threw exception code " + e.code + " on quadraticCurveTo(20, 20, In
finity, 20)."); | |
247 } | |
248 context.closePath(); | |
249 context.beginPath(); | |
250 try { | |
251 context.moveTo(10, 10); | |
252 context.quadraticCurveTo(20, 20, 20, Infinity); | |
253 pass("did not throw exception on quadraticCurveTo(20, 20, 20, Infinity).
"); | |
254 } catch (e) { | |
255 fail("threw exception code " + e.code + " on quadraticCurveTo(20, 20, 20
, Infinity)."); | |
256 } | |
257 context.closePath(); | |
258 context.beginPath(); | |
259 try { | |
260 context.moveTo(10, 10); | |
261 context.quadraticCurveTo(20, 20, NaN, NaN); | |
262 pass("did not throw exception on quadraticCurveTo(20, 20, NaN, NaN)."); | |
263 } catch (e) { | |
264 fail("threw exception code " + e.code + " on quadraticCurveTo(20, 20, Na
N, NaN)."); | |
265 } | |
266 context.closePath(); | |
267 context.beginPath(); | |
268 try { | |
269 context.moveTo(10, 10); | |
270 context.quadraticCurveTo(NaN, NaN, 20, 20); | |
271 pass("did not throw exception on quadraticCurveTo(NaN, NaN, 20, 20)."); | |
272 } catch (e) { | |
273 fail("threw exception code " + e.code + " on quadraticCurveTo(NaN, NaN,
20, 20)."); | |
274 } | |
275 context.closePath(); | |
276 context.beginPath(); | |
277 try { | |
278 context.moveTo(10, 10); | |
279 context.quadraticCurveTo(NaN, 20, 20, 20); | |
280 pass("did not throw exception on quadraticCurveTo(NaN, 20, 20, 20)."); | |
281 } catch (e) { | |
282 fail("threw exception code " + e.code + " on quadraticCurveTo(NaN, 20, 2
0, 20)."); | |
283 } | |
284 context.closePath(); | |
285 context.beginPath(); | |
286 try { | |
287 context.moveTo(10, 10); | |
288 context.quadraticCurveTo(20, NaN, 20, 20); | |
289 pass("did not throw exception on quadraticCurveTo(20, NaN, 20, 20)."); | |
290 } catch (e) { | |
291 fail("threw exception code " + e.code + " on quadraticCurveTo(20, NaN, 2
0, 20)."); | |
292 } | |
293 context.closePath(); | |
294 context.beginPath(); | |
295 try { | |
296 context.moveTo(10, 10); | |
297 context.quadraticCurveTo(20, 20, NaN, 20); | |
298 pass("did not throw exception on quadraticCurveTo(20, 20, Nan, 20)."); | |
299 } catch (e) { | |
300 fail("threw exception code " + e.code + " on quadraticCurveTo(20, 20, Na
N, 20)."); | |
301 } | |
302 context.closePath(); | |
303 context.beginPath(); | |
304 try { | |
305 context.moveTo(10, 10); | |
306 context.quadraticCurveTo(20, 20, 20, NaN); | |
307 pass("did not throw exception on quadraticCurveTo(20, 20, 20, NaN)."); | |
308 } catch (e) { | |
309 fail("threw exception code " + e.code + " on quadraticCurveTo(20, 20, 20
, NaN)."); | |
310 } | |
311 context.closePath(); | |
312 context.beginPath(); | |
313 try { | |
314 context.moveTo(10, 10); | |
315 context.bezierCurveTo(20, 20, 30, 30, Infinity, Infinity); | |
316 pass("did not throw exception on bezierCurveTo(20, 20, 30, 30, Infinity,
Infinity)."); | |
317 } catch (e) { | |
318 fail("threw exception code " + e.code + " on bezierCurveTo(20, 20, 30, 3
0, Infinity, Infinity)."); | |
319 } | |
320 context.closePath(); | |
321 context.beginPath(); | |
322 try { | |
323 context.moveTo(10, 10); | |
324 context.bezierCurveTo(20, 20, 30, 30, 30, Infinity); | |
325 pass("did not throw exception on bezierCurveTo(20, 20, 30, 30, 30, Infin
ity)."); | |
326 } catch (e) { | |
327 fail("threw exception code " + e.code + " on bezierCurveTo(20, 20, 30, 3
0, 30, Infinity)."); | |
328 } | |
329 context.closePath(); | |
330 context.beginPath(); | |
331 try { | |
332 context.moveTo(10, 10); | |
333 context.bezierCurveTo(20, 20, 30, 30, Infinity, 30); | |
334 pass("did not throw exception on bezierCurveTo(20, 20, 30, 30, Infinity,
30)."); | |
335 } catch (e) { | |
336 fail("threw exception code " + e.code + " on bezierCurveTo(20, 20, 30, 3
0, Infinity, 30)."); | |
337 } | |
338 context.closePath(); | |
339 context.beginPath(); | |
340 try { | |
341 context.moveTo(10, 10); | |
342 context.bezierCurveTo(20, 20, Infinity, Infinity, 30, 30); | |
343 pass("did not throw exception on bezierCurveTo(20, 20, Infinity, Infinit
y, 30, 30)."); | |
344 } catch (e) { | |
345 fail("threw exception code " + e.code + " on bezierCurveTo(20, 20, Infin
ity, Infinity, 30, 30)."); | |
346 } | |
347 context.closePath(); | |
348 context.beginPath(); | |
349 try { | |
350 context.moveTo(10, 10); | |
351 context.bezierCurveTo(20, 20, 30, Infinity, 30, 30); | |
352 pass("did not throw exception on bezierCurveTo(20, 20, 30, Infinity, 30,
30)."); | |
353 } catch (e) { | |
354 fail("threw exception code " + e.code + " on bezierCurveTo(20, 20, 30, I
nfinity, 30, 30)."); | |
355 } | |
356 context.closePath(); | |
357 context.beginPath(); | |
358 try { | |
359 context.moveTo(10, 10); | |
360 context.bezierCurveTo(20, 20, Infinity, 30, 30, 30); | |
361 pass("did not throw exception on bezierCurveTo(20, 20, Infinity, 30, 30,
30)."); | |
362 } catch (e) { | |
363 fail("threw exception code " + e.code + " on bezierCurveTo(20, 20, Infin
ity, 30, 30, 30)."); | |
364 } | |
365 context.closePath(); | |
366 context.beginPath(); | |
367 try { | |
368 context.moveTo(10, 10); | |
369 context.bezierCurveTo(Infinity, Infinity, 20, 20, 30, 30); | |
370 pass("did not throw exception on bezierCurveTo(Infinity, Infinity, 20, 2
0, 30, 30)."); | |
371 } catch (e) { | |
372 fail("threw exception code " + e.code + " on bezierCurveTo(Infinity, Inf
inity, 20, 20, 30, 30)."); | |
373 } | |
374 context.closePath(); | |
375 context.beginPath(); | |
376 try { | |
377 context.moveTo(10, 10); | |
378 context.bezierCurveTo(30, Infinity, 20, 20, 30, 30); | |
379 pass("did not throw exception on bezierCurveTo(30, Infinity, 20, 20, 30,
30)."); | |
380 } catch (e) { | |
381 fail("threw exception code " + e.code + " on bezierCurveTo(30, Infinity,
20, 20, 30, 30)."); | |
382 } | |
383 context.closePath(); | |
384 context.beginPath(); | |
385 try { | |
386 context.moveTo(10, 10); | |
387 context.bezierCurveTo(Infinity, 30, 20, 20, 30, 30); | |
388 pass("did not throw exception on bezierCurveTo(Infinity, 30, 20, 20, 30,
30)."); | |
389 } catch (e) { | |
390 fail("threw exception code " + e.code + " on bezierCurveTo(Infinity, 30,
20, 20, 30, 30)."); | |
391 } | |
392 context.closePath(); | |
393 context.beginPath(); | |
394 try { | |
395 context.moveTo(10, 10); | |
396 context.bezierCurveTo(20, 20, 30, 30, NaN, NaN); | |
397 pass("did not throw exception on bezierCurveTo(20, 20, 30, 30, NaN, NaN)
."); | |
398 } catch (e) { | |
399 fail("threw exception code " + e.code + " on bezierCurveTo(20, 20, 30, 3
0, NaN, NaN)."); | |
400 } | |
401 context.closePath(); | |
402 context.beginPath(); | |
403 try { | |
404 context.moveTo(10, 10); | |
405 context.bezierCurveTo(20, 20, 30, 30, 0, NaN); | |
406 pass("did not throw exception on bezierCurveTo(20, 20, 30, 30, 0, NaN)."
); | |
407 } catch (e) { | |
408 fail("threw exception code " + e.code + " on bezierCurveTo(20, 20, 30, 3
0, 0, NaN)."); | |
409 } | |
410 context.closePath(); | |
411 context.beginPath(); | |
412 try { | |
413 context.moveTo(10, 10); | |
414 context.bezierCurveTo(20, 20, 30, 30, NaN, 0); | |
415 pass("did not throw exception on bezierCurveTo(20, 20, 30, 30, NaN, 0)."
); | |
416 } catch (e) { | |
417 fail("threw exception code " + e.code + " on bezierCurveTo(20, 20, 30, 3
0, NaN, 0)."); | |
418 } | |
419 context.closePath(); | |
420 context.beginPath(); | |
421 try { | |
422 context.moveTo(10, 10); | |
423 context.bezierCurveTo(20, 20, NaN, NaN, 30, 30); | |
424 pass("did not throw exception on bezierCurveTo(20, 20, NaN, NaN, 30, 30)
."); | |
425 } catch (e) { | |
426 fail("threw exception code " + e.code + " on bezierCurveTo(20, 20, NaN,
NaN, 30, 30)."); | |
427 } | |
428 context.closePath(); | |
429 context.beginPath(); | |
430 try { | |
431 context.moveTo(10, 10); | |
432 context.bezierCurveTo(20, 20, 30, NaN, 30, 30); | |
433 pass("did not throw exception on bezierCurveTo(20, 20, 30, NaN, 30, 30).
"); | |
434 } catch (e) { | |
435 fail("threw exception code " + e.code + " on bezierCurveTo(20, 20, 30, N
aN, 30, 30)."); | |
436 } | |
437 context.closePath(); | |
438 context.beginPath(); | |
439 try { | |
440 context.moveTo(10, 10); | |
441 context.bezierCurveTo(20, 20, NaN, 30, 30, 30); | |
442 pass("did not throw exception on bezierCurveTo(20, 20, NaN, 30, 30, 30).
"); | |
443 } catch (e) { | |
444 fail("threw exception code " + e.code + " on bezierCurveTo(20, 20, NaN,
30, 30, 30)."); | |
445 } | |
446 context.closePath(); | |
447 context.beginPath(); | |
448 try { | |
449 context.moveTo(10, 10); | |
450 context.bezierCurveTo(NaN, NaN, 20, 20, 30, 30); | |
451 pass("did not throw exception on bezierCurveTo(NaN, NaN, 20, 20, 30, 30)
."); | |
452 } catch (e) { | |
453 fail("threw exception code " + e.code + " on bezierCurveTo(NaN, NaN, 20,
20, 30, 30)."); | |
454 } | |
455 context.closePath(); | |
456 context.beginPath(); | |
457 try { | |
458 context.moveTo(10, 10); | |
459 context.bezierCurveTo(20, NaN, 20, 20, 30, 30); | |
460 pass("did not throw exception on bezierCurveTo(20, NaN, 20, 20, 30, 30).
"); | |
461 } catch (e) { | |
462 fail("threw exception code " + e.code + " on bezierCurveTo(20, NaN, 20,
20, 30, 30)."); | |
463 } | |
464 context.closePath(); | |
465 context.beginPath(); | |
466 try { | |
467 context.moveTo(10, 10); | |
468 context.bezierCurveTo(NaN, 20, 20, 20, 30, 30); | |
469 pass("did not throw exception on bezierCurveTo(NaN, 20, 20, 20, 30, 30).
"); | |
470 } catch (e) { | |
471 fail("threw exception code " + e.code + " on bezierCurveTo(NaN, 20, 20,
20, 30, 30)."); | |
472 } | |
473 context.closePath(); | 227 context.closePath(); |
474 | 228 |
475 var canvas2 = document.createElement('canvas'); | 229 var canvas2 = document.createElement('canvas'); |
476 canvas2.width = 0; | 230 canvas2.width = canvas2.height = 0; |
477 canvas2.height = 0; | 231 assert_throws(null, function() {var pattern = ctx.createPattern(canvas2, 're
peat');}); |
478 try { | 232 context.fillStyle = '#0f0'; |
479 var pattern = ctx.createPattern(canvas2, 'repeat'); | 233 context.fillRect(0, 0, canvas.width, canvas.height); |
480 fail("did not throw exception on createPattern with 0x0 canvas.") | 234 |
481 } catch (e) { | 235 }, "Verify the behavior of a number of the DOM Canvas drawing methods when given
0, Infinity, or NaN as parameters. Test should not crash."); |
482 pass("threw exception code " + e.code + " on createPattern with 0x0 canv
as.") | |
483 } | |
484 if (!failed) { | |
485 context.fillStyle = '#0f0'; | |
486 context.fillRect(0, 0, canvas.width, canvas.height); | |
487 } | |
488 if (window.testRunner) | |
489 testRunner.dumpAsText(); | |
490 } | |
491 </script> | 236 </script> |
492 <title>Canvas test of doom</title> | |
493 </head> | |
494 <body onload="runTest()"> | |
495 <canvas id="test" width="100" height="100"></canvas><br /> | |
496 <pre id="console"> | |
497 This tests the behaviour of a number of the DOM Canvas drawing methods when | |
498 given 0, Infinity, or NaN as parameters. | |
499 | |
500 </pre> | |
501 | |
502 </body> | |
503 </html> | |
OLD | NEW |