Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / content / canvas / test / test_2d.missingargs.html
blobaedb22dfcec4ed68a68bfc5e867edd9bfefb64a4
1 <!DOCTYPE HTML>
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">
7 <body>
8 <canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
9 <script>
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 {
18 ctx.scale();
19 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
20 var _thrown = undefined; try {
21 ctx.scale(1);
22 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
23 var _thrown = undefined; try {
24 ctx.rotate();
25 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
26 var _thrown = undefined; try {
27 ctx.translate();
28 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
29 var _thrown = undefined; try {
30 ctx.translate(0);
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 {
34 ctx.transform();
35 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
36 var _thrown = undefined; try {
37 ctx.transform(1);
38 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
39 var _thrown = undefined; try {
40 ctx.transform(1, 0);
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 {
54 ctx.setTransform();
55 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
56 var _thrown = undefined; try {
57 ctx.setTransform(1);
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 {
106 ctx.clearRect();
107 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
108 var _thrown = undefined; try {
109 ctx.clearRect(0);
110 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
111 var _thrown = undefined; try {
112 ctx.clearRect(0, 0);
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 {
118 ctx.fillRect();
119 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
120 var _thrown = undefined; try {
121 ctx.fillRect(0);
122 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
123 var _thrown = undefined; try {
124 ctx.fillRect(0, 0);
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 {
130 ctx.strokeRect();
131 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
132 var _thrown = undefined; try {
133 ctx.strokeRect(0);
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 {
142 ctx.moveTo();
143 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
144 var _thrown = undefined; try {
145 ctx.moveTo(0);
146 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
147 var _thrown = undefined; try {
148 ctx.lineTo();
149 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
150 var _thrown = undefined; try {
151 ctx.lineTo(0);
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 {
166 ctx.bezierCurveTo();
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 {
184 ctx.arcTo();
185 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
186 var _thrown = undefined; try {
187 ctx.arcTo(0);
188 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
189 var _thrown = undefined; try {
190 ctx.arcTo(0, 0);
191 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
192 var _thrown = undefined; try {
193 ctx.arcTo(0, 0, 0);
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 {
199 ctx.rect();
200 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
201 var _thrown = undefined; try {
202 ctx.rect(0);
203 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
204 var _thrown = undefined; try {
205 ctx.rect(0, 0);
206 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
207 var _thrown = undefined; try {
208 ctx.rect(0, 0, 0);
209 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
210 var _thrown = undefined; try {
211 ctx.arc();
212 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
213 var _thrown = undefined; try {
214 ctx.arc(0);
215 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
216 var _thrown = undefined; try {
217 ctx.arc(0, 0);
218 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
219 var _thrown = undefined; try {
220 ctx.arc(0, 0, 1);
221 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
222 var _thrown = undefined; try {
223 ctx.arc(0, 0, 1, 0);
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 {
230 ctx.isPointInPath();
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 {
237 ctx.drawImage();
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 {
258 ctx.getImageData();
259 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
260 var _thrown = undefined; try {
261 ctx.getImageData(0);
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 {
273 ctx.putImageData();
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 {
284 g.addColorStop();
285 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
286 var _thrown = undefined; try {
287 g.addColorStop(0);
288 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.NOT_SUPPORTED_ERR, "should throw NOT_SUPPORTED_ERR");
290 SimpleTest.finish();
293 </script>