<script src='../../resources/testharness.js'></script>
<script src='../../resources/testharnessreport.js'></script>
<canvas id='c' width='100' height='50'></canvas>
<script>
// Tests that using reasonably large values for canvas.height and canvas.height do not cause a crash
var canvas = document.getElementById('c');
var x, y, w = 1, h = 1;
function testLargeDimension(size, isWidth) {
canvas.width = (isWidth ? size : 50);
canvas.height = (isWidth ? 50 : size);
var ctx = canvas.getContext('2d', {willReadFrequently: true});
ctx.fillStyle = 'rgba(255, 255, 255, 1)';
assert_equals((isWidth ? canvas.width : canvas.height), size);
x = canvas.width - 2;
y = canvas.height - 2;
ctx.fillRect(x, y, w, h);
var data = ctx.getImageData(x, y, w, h).data;
for (var i = 0; i < 4; i++)
assert_equals(data[i], 255);
}
testScenarios = [['Test Width = 1000', 1000, true],
['Test Height = 1000', 1000, false],
['Test Width = 10000', 10000, true],
['Test Height = 10000', 10000, false],
['Test Width = 32000', 32000, true],
['Test Height = 32000', 32000, false]];
generate_tests(testLargeDimension, testScenarios);
</script>