blob: 8b0248fabf89e5a086f48cf0c185cf190b3f442e [file] [log] [blame]
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
test(function(t) {
var canvas = document.createElement('canvas');
canvas.width = 40000;
var context = canvas.getContext('2d');
context.fillStyle = '#0f0';
context.fillRect(0, 0, 1, 1);
var dstCanvas = document.createElement('canvas');
var dstContext = dstCanvas.getContext('2d');
var pattern = dstContext.createPattern(canvas, 'repeat');
dstContext.fillStyle = pattern;
dstContext.fillRect(0, 0, dstCanvas.width, dstCanvas.height);
// This test does not currently succeed because skia does not handle
// canvases more than 32k pixels wide. For now, this test serves the
// purpose of verifying that this use case does not crash the browser.
// Crasher bug: crbug.com/281504.
// The result, if Skia handled large canvases, would be [0, 255, 0, 255]
assert_array_equals(dstContext.getImageData(0, 0, 1, 1).data, [0, 0, 0, 0]);
assert_array_equals(dstContext.getImageData(1, 0, 1, 1).data, [0, 0, 0, 0]);
assert_array_equals(dstContext.getImageData(0, 1, 1, 1).data, [0, 0, 0, 0]);
}, 'Tests createPattern using a source image that is a canvas 40k pixels wide.');
</script>