| OLD | NEW |
| (Empty) | |
| 1 // DO NOT EDIT! This test has been generated by tools/gentest.py. |
| 2 // OffscreenCanvas test in a worker:2d.imageData.put.dirty.outside |
| 3 // Description:putImageData() handles dirty rectangles outside the canvas correc
tly |
| 4 // Note: |
| 5 |
| 6 importScripts("/resources/testharness.js"); |
| 7 importScripts("/common/canvas-tests.js"); |
| 8 |
| 9 var t = async_test("putImageData() handles dirty rectangles outside the canvas c
orrectly"); |
| 10 t.step(function() { |
| 11 |
| 12 var offscreenCanvas = new OffscreenCanvas(100, 50); |
| 13 var ctx = offscreenCanvas.getContext('2d'); |
| 14 |
| 15 ctx.fillStyle = '#f00'; |
| 16 ctx.fillRect(0, 0, 100, 50) |
| 17 var imgdata = ctx.getImageData(0, 0, 100, 50); |
| 18 ctx.fillStyle = '#0f0'; |
| 19 ctx.fillRect(0, 0, 100, 50) |
| 20 ctx.putImageData(imgdata, 100, 20, 20, 20, -20, -20); |
| 21 ctx.putImageData(imgdata, 200, 200, 0, 0, 100, 50); |
| 22 ctx.putImageData(imgdata, 40, 20, -30, -20, 30, 20); |
| 23 ctx.putImageData(imgdata, -30, 20, 0, 0, 30, 20); |
| 24 _assertPixelApprox(offscreenCanvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255",
2); |
| 25 _assertPixelApprox(offscreenCanvas, 98,15, 0,255,0,255, "98,15", "0,255,0,255",
2); |
| 26 _assertPixelApprox(offscreenCanvas, 98,25, 0,255,0,255, "98,25", "0,255,0,255",
2); |
| 27 _assertPixelApprox(offscreenCanvas, 98,45, 0,255,0,255, "98,45", "0,255,0,255",
2); |
| 28 _assertPixelApprox(offscreenCanvas, 1,5, 0,255,0,255, "1,5", "0,255,0,255", 2); |
| 29 _assertPixelApprox(offscreenCanvas, 1,25, 0,255,0,255, "1,25", "0,255,0,255", 2)
; |
| 30 _assertPixelApprox(offscreenCanvas, 1,45, 0,255,0,255, "1,45", "0,255,0,255", 2)
; |
| 31 |
| 32 t.done(); |
| 33 |
| 34 }); |
| 35 done(); |
| OLD | NEW |