1 description("Test the handling of negative sourceRect offset in getImageData().");
3 ctx = document.createElement('canvas').getContext('2d');
6 ctx.fillRect(0, 0, 100, 100);
7 ctx.fillStyle = 'green';
8 ctx.fillRect(0, 0, 6, 6);
10 var imageData = ctx.getImageData(-10, 0, 100, 1);
11 var imgdata = imageData.data;
13 // Fully transparent black
14 shouldBe("imgdata[0]", "0");
15 shouldBe("imgdata[1]", "0");
16 shouldBe("imgdata[2]", "0");
17 shouldBe("imgdata[3]", "0");
20 shouldBe("imgdata[60]", "0");
21 shouldBe("imgdata[61]", "128");
22 shouldBe("imgdata[62]", "0");
23 shouldBe("imgdata[63]", "255");
26 shouldBe("imgdata[64]", "255");
27 shouldBe("imgdata[65]", "0");
28 shouldBe("imgdata[66]", "0");
29 shouldBe("imgdata[67]", "255");