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.unaffected |
| 3 // Description:putImageData() is not affected by context state |
| 4 // Note: |
| 5 |
| 6 importScripts("/resources/testharness.js"); |
| 7 importScripts("/common/canvas-tests.js"); |
| 8 |
| 9 var t = async_test("putImageData() is not affected by context state"); |
| 10 t.step(function() { |
| 11 |
| 12 var offscreenCanvas = new OffscreenCanvas(100, 50); |
| 13 var ctx = offscreenCanvas.getContext('2d'); |
| 14 |
| 15 ctx.fillStyle = '#0f0'; |
| 16 ctx.fillRect(0, 0, 100, 50) |
| 17 var imgdata = ctx.getImageData(0, 0, 100, 50); |
| 18 ctx.fillStyle = '#f00'; |
| 19 ctx.fillRect(0, 0, 100, 50) |
| 20 ctx.globalAlpha = 0.1; |
| 21 ctx.globalCompositeOperation = 'destination-atop'; |
| 22 ctx.shadowColor = '#f00'; |
| 23 ctx.shadowBlur = 1; |
| 24 ctx.translate(100, 50); |
| 25 ctx.scale(0.1, 0.1); |
| 26 ctx.putImageData(imgdata, 0, 0); |
| 27 _assertPixelApprox(offscreenCanvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255",
2); |
| 28 |
| 29 t.done(); |
| 30 |
| 31 }); |
| 32 done(); |
OLD | NEW |