OLD | NEW |
1 description("Test ImageData constructor"); | 1 description("Test ImageData constructor"); |
2 | 2 |
3 function setRGBA(imageData, i, rgba) { | 3 function setRGBA(imageData, i, rgba) { |
4 var s = i * 4; | 4 var s = i * 4; |
5 imageData[s] = rgba[0]; | 5 imageData[s] = rgba[0]; |
6 imageData[s + 1] = rgba[1]; | 6 imageData[s + 1] = rgba[1]; |
7 imageData[s + 2] = rgba[2]; | 7 imageData[s + 2] = rgba[2]; |
8 imageData[s + 3] = rgba[3]; | 8 imageData[s + 3] = rgba[3]; |
9 } | 9 } |
10 | 10 |
(...skipping 47 matching lines...) Loading... |
58 | 58 |
59 var data = new Uint8ClampedArray(400); | 59 var data = new Uint8ClampedArray(400); |
60 data[22] = 129; | 60 data[22] = 129; |
61 imageDataFromData = new ImageData(data, 20, 5); | 61 imageDataFromData = new ImageData(data, 20, 5); |
62 shouldBe("imageDataFromData.width", "20"); | 62 shouldBe("imageDataFromData.width", "20"); |
63 shouldBe("imageDataFromData.height", "5"); | 63 shouldBe("imageDataFromData.height", "5"); |
64 shouldBe("imageDataFromData.data", "data"); | 64 shouldBe("imageDataFromData.data", "data"); |
65 shouldBe("getRGBA(imageDataFromData.data, 2)", "getRGBA(data, 2)"); | 65 shouldBe("getRGBA(imageDataFromData.data, 2)", "getRGBA(data, 2)"); |
66 setRGBA(imageDataFromData.data, 2, testColor); | 66 setRGBA(imageDataFromData.data, 2, testColor); |
67 shouldBe("getRGBA(imageDataFromData.data, 2)", "getRGBA(data, 2)"); | 67 shouldBe("getRGBA(imageDataFromData.data, 2)", "getRGBA(data, 2)"); |
OLD | NEW |