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">
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 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");