2 <title>Canvas test:
2d.imageData.create.initial - bug
433004</title>
3 <!-- Testing: createImageData() returns transparent black data of the right size -->
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
= ctx
.createImageData(10, 20);
18 ok(imgdata
.data
.length
== imgdata
.width
*imgdata
.height
*4, "imgdata.data.length == imgdata.width*imgdata.height*4");
19 ok(imgdata
.width
< imgdata
.height
, "imgdata.width < imgdata.height");
20 ok(imgdata
.width
> 0, "imgdata.width > 0");
21 var isTransparentBlack
= true;
22 for (var i
= 0; i
< imgdata
.data
.length
; ++i
)
23 if (imgdata
.data
[i
] !== 0)
24 isTransparentBlack
= false;
25 ok(isTransparentBlack
, "isTransparentBlack");