| OLD | NEW |
| (Empty) |
| 1 description("Series of tests to ensure correct behaviour of getImageData and put
ImageData when alpha is involved"); | |
| 2 var ctx = document.getElementById('canvas').getContext('2d'); | |
| 3 ctx.fillStyle = 'rgba(255, 0, 0, 0.01)'; | |
| 4 ctx.fillRect(0, 0, 1, 200); | |
| 5 ctx.fillStyle = 'rgba(0, 255, 0, 0.995)'; | |
| 6 ctx.fillRect(1, 0, 199, 200); | |
| 7 var imageData = ctx.getImageData(0, 0, 200, 200); | |
| 8 var imgdata = imageData.data; | |
| 9 shouldBe("imgdata[4]", "0"); | |
| 10 shouldBe("imgdata[5]", "255"); | |
| 11 shouldBe("imgdata[6]", "0"); | |
| 12 shouldBe("imgdata[7]", "254"); | |
| 13 | |
| 14 ctx.putImageData(imageData, 0, 0); | |
| 15 | |
| 16 imgdata = ctx.getImageData(0, 0, 200, 200).data; | |
| 17 | |
| 18 shouldBe("imgdata[4]", "0"); | |
| 19 shouldBe("imgdata[5]", "255"); | |
| 20 shouldBe("imgdata[6]", "0"); | |
| 21 shouldBe("imgdata[7]", "254"); | |
| OLD | NEW |