4 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
5 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
7 <body onload=
"doTest()">
9 <canvas id=
"c" width=
"1" height=
"1"></canvas>
10 <img id=
"img" src=
"image_green-1x1.png">
12 <div id=
"content" style=
"display: none">
16 <script type=
"application/javascript">
18 var c = document.getElementById(
"c");
19 var ctx = c.getContext(
"2d");
20 var img = document.getElementById(
"img");
22 SimpleTest.waitForExplicitFinish();
25 ctx.fillStyle =
"red";
26 ctx.fillRect(
0,
0,
1,
1);
27 ctx.drawImage(img, -
1,
0);
28 ctx.clearRect(
0,
0,
1,
1);
30 var data = ctx.getImageData(
0,
0,
1,
1).data;
31 is(data[
0],
0,
"Red channel should be 0");
32 is(data[
1],
0,
"Green channel should be 0");
33 is(data[
2],
0,
"Blue channel should be 0")
34 is(data[
3],
0,
"Alpha channel should be 0");