| OLD | NEW |
| 1 <script src="../../resources/testharness.js"></script> | 1 <script src="../../resources/testharness.js"></script> |
| 2 <script src="../../resources/testharnessreport.js"></script> | 2 <script src="../../resources/testharnessreport.js"></script> |
| 3 <script> | 3 <script> |
| 4 | 4 |
| 5 test(function(t) { | 5 test(function(t) { |
| 6 var canvas = document.createElement('canvas'); | 6 var canvas = document.createElement('canvas'); |
| 7 canvas.width = 40000; | 7 canvas.width = 40000; |
| 8 var context = canvas.getContext('2d'); | 8 var context = canvas.getContext('2d'); |
| 9 context.fillStyle = '#0f0'; | 9 context.fillStyle = '#0f0'; |
| 10 context.fillRect(0, 0, 1, 1); | 10 context.fillRect(0, 0, 1, 1); |
| 11 | 11 |
| 12 var dstCanvas = document.createElement('canvas'); | 12 var dstCanvas = document.createElement('canvas'); |
| 13 var dstContext = dstCanvas.getContext('2d'); | 13 var dstContext = dstCanvas.getContext('2d'); |
| 14 var pattern = dstContext.createPattern(canvas, 'repeat'); | 14 var pattern = dstContext.createPattern(canvas, 'repeat'); |
| 15 dstContext.fillStyle = pattern; | 15 dstContext.fillStyle = pattern; |
| 16 dstContext.fillRect(0, 0, dstCanvas.width, dstCanvas.height); | 16 dstContext.fillRect(0, 0, dstCanvas.width, dstCanvas.height); |
| 17 | 17 |
| 18 // This test does not currently succeed because skia does not handle | 18 // This test does not currently succeed because skia does not handle |
| 19 // canvases more than 32k pixels wide. For now, this test serves the | 19 // canvases more than 32k pixels wide. For now, this test serves the |
| 20 // purpose of verifying that this use case does not crash the browser. | 20 // purpose of verifying that this use case does not crash the browser. |
| 21 // Crasher bug: crbug.com/281504. | 21 // Crasher bug: crbug.com/281504. |
| 22 assert_array_equals(dstContext.getImageData(0, 0, 1, 1).data, [0, 255, 0, 25
5]); | 22 // The result, if Skia handled large canvases, would be [0, 255, 0, 255] |
| 23 assert_array_equals(dstContext.getImageData(0, 0, 1, 1).data, [0, 0, 0, 0]); |
| 23 | 24 |
| 24 assert_array_equals(dstContext.getImageData(1, 0, 1, 1).data, [0, 0, 0, 0]); | 25 assert_array_equals(dstContext.getImageData(1, 0, 1, 1).data, [0, 0, 0, 0]); |
| 25 assert_array_equals(dstContext.getImageData(0, 1, 1, 1).data, [0, 0, 0, 0]); | 26 assert_array_equals(dstContext.getImageData(0, 1, 1, 1).data, [0, 0, 0, 0]); |
| 26 | 27 |
| 27 }, 'Tests createPattern using a source image that is a canvas 40k pixels wide.')
; | 28 }, 'Tests createPattern using a source image that is a canvas 40k pixels wide.')
; |
| 28 </script> | 29 </script> |
| OLD | NEW |