| 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 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 shouldThrow("new ImageData(10)"); | 35 shouldThrow("new ImageData(10)"); |
| 36 shouldThrow("new ImageData(0, 10)"); | 36 shouldThrow("new ImageData(0, 10)"); |
| 37 shouldThrow("new ImageData(10, 0)"); | 37 shouldThrow("new ImageData(10, 0)"); |
| 38 shouldThrow("new ImageData('width', 'height')"); | 38 shouldThrow("new ImageData('width', 'height')"); |
| 39 shouldThrow("new ImageData(1 << 31, 1 << 31)"); | 39 shouldThrow("new ImageData(1 << 31, 1 << 31)"); |
| 40 | 40 |
| 41 shouldThrow("new ImageData(new Uint8ClampedArray(0))"); | 41 shouldThrow("new ImageData(new Uint8ClampedArray(0))"); |
| 42 shouldThrow("new ImageData(new Uint8Array(100), 25)"); | 42 shouldThrow("new ImageData(new Uint8Array(100), 25)"); |
| 43 shouldThrow("new ImageData(new Uint8ClampedArray(27), 2)"); | 43 shouldThrow("new ImageData(new Uint8ClampedArray(27), 2)"); |
| 44 shouldThrow("new ImageData(new Uint8ClampedArray(28), 7, 0)"); |
| 44 shouldThrow("new ImageData(new Uint8ClampedArray(104), 14)"); | 45 shouldThrow("new ImageData(new Uint8ClampedArray(104), 14)"); |
| 46 shouldThrow("new ImageData(self, 4, 4)"); |
| 47 shouldThrow("new ImageData(null, 4, 4)"); |
| 45 shouldThrow("new ImageData(imageData.data, 0)"); | 48 shouldThrow("new ImageData(imageData.data, 0)"); |
| 46 shouldThrow("new ImageData(imageData.data, 13)"); | 49 shouldThrow("new ImageData(imageData.data, 13)"); |
| 47 shouldThrow("new ImageData(imageData.data, 1 << 31)"); | 50 shouldThrow("new ImageData(imageData.data, 1 << 31)"); |
| 48 shouldThrow("new ImageData(imageData.data, 'biggish')"); | 51 shouldThrow("new ImageData(imageData.data, 'biggish')"); |
| 49 shouldThrow("new ImageData(imageData.data, 1 << 24, 1 << 31)"); | 52 shouldThrow("new ImageData(imageData.data, 1 << 24, 1 << 31)"); |
| 53 shouldBe("(new ImageData(new Uint8ClampedArray(28), 7)).height", "1"); |
| 50 | 54 |
| 51 imageDataFromData = new ImageData(imageData.data, 100); | 55 imageDataFromData = new ImageData(imageData.data, 100); |
| 52 shouldBe("imageDataFromData.width", "100"); | 56 shouldBe("imageDataFromData.width", "100"); |
| 53 shouldBe("imageDataFromData.height", "50"); | 57 shouldBe("imageDataFromData.height", "50"); |
| 54 shouldBe("imageDataFromData.data", "imageData.data"); | 58 shouldBe("imageDataFromData.data", "imageData.data"); |
| 55 shouldBe("getRGBA(imageDataFromData.data, 10)", "getRGBA(imageData.data, 10)"); | 59 shouldBe("getRGBA(imageDataFromData.data, 10)", "getRGBA(imageData.data, 10)"); |
| 56 setRGBA(imageData.data, 10, testColor); | 60 setRGBA(imageData.data, 10, testColor); |
| 57 shouldBe("getRGBA(imageDataFromData.data, 10)", "getRGBA(imageData.data, 10)"); | 61 shouldBe("getRGBA(imageDataFromData.data, 10)", "getRGBA(imageData.data, 10)"); |
| 58 | 62 |
| 59 var data = new Uint8ClampedArray(400); | 63 var data = new Uint8ClampedArray(400); |
| 60 data[22] = 129; | 64 data[22] = 129; |
| 61 imageDataFromData = new ImageData(data, 20, 5); | 65 imageDataFromData = new ImageData(data, 20, 5); |
| 62 shouldBe("imageDataFromData.width", "20"); | 66 shouldBe("imageDataFromData.width", "20"); |
| 63 shouldBe("imageDataFromData.height", "5"); | 67 shouldBe("imageDataFromData.height", "5"); |
| 64 shouldBe("imageDataFromData.data", "data"); | 68 shouldBe("imageDataFromData.data", "data"); |
| 65 shouldBe("getRGBA(imageDataFromData.data, 2)", "getRGBA(data, 2)"); | 69 shouldBe("getRGBA(imageDataFromData.data, 2)", "getRGBA(data, 2)"); |
| 66 setRGBA(imageDataFromData.data, 2, testColor); | 70 setRGBA(imageDataFromData.data, 2, testColor); |
| 67 shouldBe("getRGBA(imageDataFromData.data, 2)", "getRGBA(data, 2)"); | 71 shouldBe("getRGBA(imageDataFromData.data, 2)", "getRGBA(data, 2)"); |
| OLD | NEW |