Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / content / canvas / test / test_2d.imageData.put.wrongtype.html
blob61b71295bf3dc2b77851f31edb1a4df51cc066be
1 <!DOCTYPE HTML>
2 <title>Canvas test: 2d.imageData.put.wrongtype</title>
3 <!-- Testing: putImageData() does not accept non-ImageData objects -->
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 imgdata = { width: 1, height: 1, data: [255, 0, 0, 255] };
18 var _thrown = undefined; try {
19 ctx.putImageData(imgdata, 0, 0);
20 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.TYPE_MISMATCH_ERR, "should throw TYPE_MISMATCH_ERR");
21 var _thrown = undefined; try {
22 ctx.putImageData("cheese", 0, 0);
23 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.TYPE_MISMATCH_ERR, "should throw TYPE_MISMATCH_ERR");
24 var _thrown = undefined; try {
25 ctx.putImageData(42, 0, 0);
26 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.TYPE_MISMATCH_ERR, "should throw TYPE_MISMATCH_ERR");
28 SimpleTest.finish();
30 });
31 </script>