2 <title>Canvas test:
2d.missingargs
</title>
3 <!-- Testing: Missing arguments cause NOT_SUPPORTED_ERR -->
4 <script src=
"/MochiKit/MochiKit.js"></script>
5 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
6 <link rel=
"stylesheet" href=
"/tests/SimpleTest/test.css">
8 <canvas id=
"c" width=
"100" height=
"50"><p class=
"fallback">FAIL (fallback content)
</p></canvas>
11 SimpleTest
.waitForExplicitFinish();
12 MochiKit
.DOM
.addLoadEvent(function () {
14 var canvas
= document
.getElementById('c');
15 var ctx
= canvas
.getContext('2d');
17 var _thrown
= undefined; try {
19 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
20 var _thrown
= undefined; try {
22 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
23 var _thrown
= undefined; try {
25 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
26 var _thrown
= undefined; try {
28 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
29 var _thrown
= undefined; try {
31 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
32 if (ctx
.transform
) { // (avoid spurious failures, since the aim here is not to test that all features are supported)
33 var _thrown
= undefined; try {
35 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
36 var _thrown
= undefined; try {
38 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
39 var _thrown
= undefined; try {
41 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
42 var _thrown
= undefined; try {
43 ctx
.transform(1, 0, 0);
44 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
45 var _thrown
= undefined; try {
46 ctx
.transform(1, 0, 0, 1);
47 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
48 var _thrown
= undefined; try {
49 ctx
.transform(1, 0, 0, 1, 0);
50 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
52 if (ctx
.setTransform
) {
53 var _thrown
= undefined; try {
55 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
56 var _thrown
= undefined; try {
58 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
59 var _thrown
= undefined; try {
60 ctx
.setTransform(1, 0);
61 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
62 var _thrown
= undefined; try {
63 ctx
.setTransform(1, 0, 0);
64 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
65 var _thrown
= undefined; try {
66 ctx
.setTransform(1, 0, 0, 1);
67 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
68 var _thrown
= undefined; try {
69 ctx
.setTransform(1, 0, 0, 1, 0);
70 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
72 var _thrown
= undefined; try {
73 ctx
.createLinearGradient();
74 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
75 var _thrown
= undefined; try {
76 ctx
.createLinearGradient(0);
77 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
78 var _thrown
= undefined; try {
79 ctx
.createLinearGradient(0, 0);
80 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
81 var _thrown
= undefined; try {
82 ctx
.createLinearGradient(0, 0, 1);
83 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
84 var _thrown
= undefined; try {
85 ctx
.createRadialGradient();
86 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
87 var _thrown
= undefined; try {
88 ctx
.createRadialGradient(0);
89 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
90 var _thrown
= undefined; try {
91 ctx
.createRadialGradient(0, 0);
92 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
93 var _thrown
= undefined; try {
94 ctx
.createRadialGradient(0, 0, 1);
95 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
96 var _thrown
= undefined; try {
97 ctx
.createRadialGradient(0, 0, 1, 0);
98 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
99 var _thrown
= undefined; try {
100 ctx
.createRadialGradient(0, 0, 1, 0, 0);
101 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
102 var _thrown
= undefined; try {
103 ctx
.createPattern(canvas
);
104 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
105 var _thrown
= undefined; try {
107 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
108 var _thrown
= undefined; try {
110 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
111 var _thrown
= undefined; try {
113 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
114 var _thrown
= undefined; try {
115 ctx
.clearRect(0, 0, 0);
116 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
117 var _thrown
= undefined; try {
119 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
120 var _thrown
= undefined; try {
122 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
123 var _thrown
= undefined; try {
125 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
126 var _thrown
= undefined; try {
127 ctx
.fillRect(0, 0, 0);
128 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
129 var _thrown
= undefined; try {
131 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
132 var _thrown
= undefined; try {
134 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
135 var _thrown
= undefined; try {
136 ctx
.strokeRect(0, 0);
137 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
138 var _thrown
= undefined; try {
139 ctx
.strokeRect(0, 0, 0);
140 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
141 var _thrown
= undefined; try {
143 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
144 var _thrown
= undefined; try {
146 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
147 var _thrown
= undefined; try {
149 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
150 var _thrown
= undefined; try {
152 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
153 var _thrown
= undefined; try {
154 ctx
.quadraticCurveTo();
155 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
156 var _thrown
= undefined; try {
157 ctx
.quadraticCurveTo(0);
158 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
159 var _thrown
= undefined; try {
160 ctx
.quadraticCurveTo(0, 0);
161 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
162 var _thrown
= undefined; try {
163 ctx
.quadraticCurveTo(0, 0, 0);
164 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
165 var _thrown
= undefined; try {
167 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
168 var _thrown
= undefined; try {
169 ctx
.bezierCurveTo(0);
170 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
171 var _thrown
= undefined; try {
172 ctx
.bezierCurveTo(0, 0);
173 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
174 var _thrown
= undefined; try {
175 ctx
.bezierCurveTo(0, 0, 0);
176 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
177 var _thrown
= undefined; try {
178 ctx
.bezierCurveTo(0, 0, 0, 0);
179 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
180 var _thrown
= undefined; try {
181 ctx
.bezierCurveTo(0, 0, 0, 0, 0);
182 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
183 var _thrown
= undefined; try {
185 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
186 var _thrown
= undefined; try {
188 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
189 var _thrown
= undefined; try {
191 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
192 var _thrown
= undefined; try {
194 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
195 var _thrown
= undefined; try {
196 ctx
.arcTo(0, 0, 0, 0);
197 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
198 var _thrown
= undefined; try {
200 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
201 var _thrown
= undefined; try {
203 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
204 var _thrown
= undefined; try {
206 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
207 var _thrown
= undefined; try {
209 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
210 var _thrown
= undefined; try {
212 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
213 var _thrown
= undefined; try {
215 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
216 var _thrown
= undefined; try {
218 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
219 var _thrown
= undefined; try {
221 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
222 var _thrown
= undefined; try {
224 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
225 var _thrown
= undefined; try {
226 ctx
.arc(0, 0, 1, 0, 0);
227 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
228 if (ctx
.isPointInPath
) {
229 var _thrown
= undefined; try {
231 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
232 var _thrown
= undefined; try {
233 ctx
.isPointInPath(0);
234 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
236 var _thrown
= undefined; try {
238 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
239 var _thrown
= undefined; try {
240 ctx
.drawImage(canvas
);
241 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
242 var _thrown
= undefined; try {
243 ctx
.drawImage(canvas
, 0);
244 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
245 // TODO: n >= 3 args on drawImage could be either a valid overload,
246 // or too few for another overload, or too many for another
247 // overload - what should happen?
248 if (ctx
.createImageData
) {
249 var _thrown
= undefined; try {
250 ctx
.createImageData();
251 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
252 var _thrown
= undefined; try {
253 ctx
.createImageData(1);
254 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
256 if (ctx
.getImageData
) {
257 var _thrown
= undefined; try {
259 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
260 var _thrown
= undefined; try {
262 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
263 var _thrown
= undefined; try {
264 ctx
.getImageData(0, 0);
265 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
266 var _thrown
= undefined; try {
267 ctx
.getImageData(0, 0, 1);
268 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
270 if (ctx
.putImageData
) {
271 var imgdata
= ctx
.getImageData(0, 0, 1, 1);
272 var _thrown
= undefined; try {
274 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
275 var _thrown
= undefined; try {
276 ctx
.putImageData(imgdata
);
277 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
278 var _thrown
= undefined; try {
279 ctx
.putImageData(imgdata
, 0);
280 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
282 var g
= ctx
.createLinearGradient(0, 0, 0, 0);
283 var _thrown
= undefined; try {
285 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");
286 var _thrown
= undefined; try {
288 } catch (e
) { _thrown
= e
}; todo(_thrown
&& _thrown
.code
== DOMException
.NOT_SUPPORTED_ERR
, "should throw NOT_SUPPORTED_ERR");