summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-getImageData-invalid.js
blob: 044dba3d16fb2f2a73e9d457166ef0d6628a9241 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
description("Test the handling of invalid arguments in canvas getImageData().");

ctx = document.createElement('canvas').getContext('2d');

shouldThrow("ctx.getImageData(NaN, 10, 10, 10)", '"Error: NOT_SUPPORTED_ERR: DOM Exception 9"');
shouldThrow("ctx.getImageData(10, NaN, 10, 10)", '"Error: NOT_SUPPORTED_ERR: DOM Exception 9"');
shouldThrow("ctx.getImageData(10, 10, NaN, 10)", '"Error: NOT_SUPPORTED_ERR: DOM Exception 9"');
shouldThrow("ctx.getImageData(10, 10, 10, NaN)", '"Error: NOT_SUPPORTED_ERR: DOM Exception 9"');
shouldThrow("ctx.getImageData(Infinity, 10, 10, 10)", '"Error: NOT_SUPPORTED_ERR: DOM Exception 9"');
shouldThrow("ctx.getImageData(10, Infinity, 10, 10)", '"Error: NOT_SUPPORTED_ERR: DOM Exception 9"');
shouldThrow("ctx.getImageData(10, 10, Infinity, 10)", '"Error: NOT_SUPPORTED_ERR: DOM Exception 9"');
shouldThrow("ctx.getImageData(10, 10, 10, Infinity)", '"Error: NOT_SUPPORTED_ERR: DOM Exception 9"');
shouldThrow("ctx.getImageData(undefined, 10, 10, 10)", '"Error: NOT_SUPPORTED_ERR: DOM Exception 9"');
shouldThrow("ctx.getImageData(10, undefined, 10, 10)", '"Error: NOT_SUPPORTED_ERR: DOM Exception 9"');
shouldThrow("ctx.getImageData(10, 10, undefined, 10)", '"Error: NOT_SUPPORTED_ERR: DOM Exception 9"');
shouldThrow("ctx.getImageData(10, 10, 10, undefined)", '"Error: NOT_SUPPORTED_ERR: DOM Exception 9"');
shouldThrow("ctx.getImageData(10, 10, 0, 10)", '"Error: INDEX_SIZE_ERR: DOM Exception 1"');
shouldThrow("ctx.getImageData(10, 10, 10, 0)", '"Error: INDEX_SIZE_ERR: DOM Exception 1"');

successfullyParsed = true;