2 <title>Canvas test:
2d.imageData.get.nonpremul
</title>
3 <!-- Testing: getImageData() returns non-premultiplied colours -->
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 ctx
.fillStyle
= 'rgba(255, 255, 255, 0.5)';
18 ctx
.fillRect(0, 0, 100, 50);
19 var imgdata
= ctx
.getImageData(10, 10, 10, 10);
20 ok(imgdata
.data
[0] > 200, "imgdata.data[\""+(0)+"\"] > 200");
21 ok(imgdata
.data
[1] > 200, "imgdata.data[\""+(1)+"\"] > 200");
22 ok(imgdata
.data
[2] > 200, "imgdata.data[\""+(2)+"\"] > 200");
23 ok(imgdata
.data
[3] > 100, "imgdata.data[\""+(3)+"\"] > 100");
24 ok(imgdata
.data
[3] < 200, "imgdata.data[\""+(3)+"\"] < 200");