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.rect1 | |
3 // Description:putImageData() only modifies areas inside the dirty rectangle, us
ing width and height | |
4 // Note: | |
5 | |
6 importScripts("/resources/testharness.js"); | |
7 importScripts("/common/canvas-tests.js"); | |
8 | |
9 var t = async_test("putImageData() only modifies areas inside the dirty rectangl
e, using width and height"); | |
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 ctx.fillStyle = '#0f0'; | |
18 ctx.fillRect(0, 0, 20, 20) | |
19 var imgdata = ctx.getImageData(0, 0, 100, 50); | |
20 ctx.fillStyle = '#0f0'; | |
21 ctx.fillRect(0, 0, 100, 50) | |
22 ctx.fillStyle = '#f00'; | |
23 ctx.fillRect(40, 20, 20, 20) | |
24 ctx.putImageData(imgdata, 40, 20, 0, 0, 20, 20); | |
25 _assertPixelApprox(offscreenCanvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255",
2); | |
26 _assertPixelApprox(offscreenCanvas, 35,25, 0,255,0,255, "35,25", "0,255,0,255",
2); | |
27 _assertPixelApprox(offscreenCanvas, 65,25, 0,255,0,255, "65,25", "0,255,0,255",
2); | |
28 _assertPixelApprox(offscreenCanvas, 50,15, 0,255,0,255, "50,15", "0,255,0,255",
2); | |
29 _assertPixelApprox(offscreenCanvas, 50,45, 0,255,0,255, "50,45", "0,255,0,255",
2); | |
30 | |
31 t.done(); | |
32 | |
33 }); | |
34 done(); | |
OLD | NEW |