blob: 0bad9d56fac9710170a706f54af1817d1a6e1fe4 [file] [log] [blame]
Test constructors of ImageData.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Test invalid ImageData constructor arguments.
PASS new ImageData() threw exception TypeError: Not enough arguments.
PASS new ImageData(1) threw exception TypeError: Not enough arguments.
PASS new ImageData(new Uint8ClampedArray([1,2,3,4])); threw exception TypeError: Not enough arguments.
PASS new ImageData(0, 0) threw exception IndexSizeError: The index is not in the allowed range..
PASS new ImageData(20, 0) threw exception IndexSizeError: The index is not in the allowed range..
PASS new ImageData(0, 20) threw exception IndexSizeError: The index is not in the allowed range..
PASS new ImageData(-20, 20) threw exception RangeError: Cannot allocate a buffer of this size.
PASS new ImageData(20, -20) threw exception RangeError: Cannot allocate a buffer of this size.
PASS new ImageData(null, 20) threw exception IndexSizeError: The index is not in the allowed range..
PASS new ImageData(32768, 32768) threw exception RangeError: Cannot allocate a buffer of this size.
PASS new ImageData(null, 20, 20) threw exception TypeError: Argument 1 ('data') to the ImageData constructor must be an instance of Uint8ClampedArray.
PASS new ImageData(imageData, 20, 20) threw exception TypeError: Argument 1 ('data') to the ImageData constructor must be an instance of Uint8ClampedArray.
PASS new ImageData(imageData, 0) threw exception IndexSizeError: The index is not in the allowed range..
PASS new ImageData(imageData, 20, 0) threw exception TypeError: Argument 1 ('data') to the ImageData constructor must be an instance of Uint8ClampedArray.
PASS new ImageData(imageData, 0, 20) threw exception TypeError: Argument 1 ('data') to the ImageData constructor must be an instance of Uint8ClampedArray.
PASS new ImageData(imageData, 10, 5) threw exception TypeError: Argument 1 ('data') to the ImageData constructor must be an instance of Uint8ClampedArray.
PASS new ImageData(imageData.data, 10, 5) threw exception IndexSizeError: sh value is not equal to height.
PASS new ImageData(imageData.data, -10, 5) threw exception IndexSizeError: Length is not a multiple of sw.
PASS new ImageData(imageData.data, 10, -10) threw exception IndexSizeError: sh value is not equal to height.
PASS new ImageData(new Uint8ClampedArray([1,2,3,4,5,6,7,8]),536870913,2); threw exception IndexSizeError: Length is not a multiple of sw.
PASS new ImageData({},2,2); threw exception TypeError: Argument 1 ('data') to the ImageData constructor must be an instance of Uint8ClampedArray.
PASS new ImageData(undefined,2,2); threw exception TypeError: Argument 1 ('data') to the ImageData constructor must be an instance of Uint8ClampedArray.
PASS new ImageData("none",2,2); threw exception TypeError: Argument 1 ('data') to the ImageData constructor must be an instance of Uint8ClampedArray.
PASS new ImageData(0,2,2); threw exception TypeError: Argument 1 ('data') to the ImageData constructor must be an instance of Uint8ClampedArray.
PASS new ImageData(imageData.data, 32768, 32768) threw exception IndexSizeError: Length is not a multiple of sw.
PASS new ImageData(imageData.data, Infinity, Infinity) threw exception IndexSizeError: Length is not a multiple of sw.
PASS new ImageData(imageData.data, NaN, NaN) threw exception IndexSizeError: Length is not a multiple of sw.
PASS new ImageData(imageData.data, 10, 0) threw exception IndexSizeError: sh value is not equal to height.
Test valid ImageData constructors.
Test that we got the pixel array from imageData.
PASS imageData.data[1] is 128
Test that we got a reference rather than a copy.
PASS imageData.data[1] is 100
PASS testTransparentBlack(imageData2.data) is true
PASS imageData2.data is data
PASS successfullyParsed is true
TEST COMPLETE