blob: 4e78420120ef17dde458e0698fe1f002d9255f56 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<script>
description("Test the handling of invalid arguments in canvas getImageData().");
ctx = document.createElement('canvas').getContext('2d');
shouldThrow("ctx.getImageData(NaN, 10, 10, 10)", '"TypeError: Value NaN is outside the range [-2147483648, 2147483647]"');
shouldThrow("ctx.getImageData(10, NaN, 10, 10)", '"TypeError: Value NaN is outside the range [-2147483648, 2147483647]"');
shouldThrow("ctx.getImageData(10, 10, NaN, 10)", '"TypeError: Value NaN is outside the range [-2147483648, 2147483647]"');
shouldThrow("ctx.getImageData(10, 10, 10, NaN)", '"TypeError: Value NaN is outside the range [-2147483648, 2147483647]"');
shouldThrow("ctx.getImageData(Infinity, 10, 10, 10)", '"TypeError: Value Infinity is outside the range [-2147483648, 2147483647]"');
shouldThrow("ctx.getImageData(10, Infinity, 10, 10)", '"TypeError: Value Infinity is outside the range [-2147483648, 2147483647]"');
shouldThrow("ctx.getImageData(10, 10, Infinity, 10)", '"TypeError: Value Infinity is outside the range [-2147483648, 2147483647]"');
shouldThrow("ctx.getImageData(10, 10, 10, Infinity)", '"TypeError: Value Infinity is outside the range [-2147483648, 2147483647]"');
shouldThrow("ctx.getImageData(undefined, 10, 10, 10)", '"TypeError: Value NaN is outside the range [-2147483648, 2147483647]"');
shouldThrow("ctx.getImageData(10, undefined, 10, 10)", '"TypeError: Value NaN is outside the range [-2147483648, 2147483647]"');
shouldThrow("ctx.getImageData(10, 10, undefined, 10)", '"TypeError: Value NaN is outside the range [-2147483648, 2147483647]"');
shouldThrow("ctx.getImageData(10, 10, 10, undefined)", '"TypeError: Value NaN is outside the range [-2147483648, 2147483647]"');
shouldThrow("ctx.getImageData(10, 10, 0, 10)", '"IndexSizeError: The index is not in the allowed range."');
shouldThrow("ctx.getImageData(10, 10, 10, 0)", '"IndexSizeError: The index is not in the allowed range."');
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>