Bug 1794662 [wpt PR 36401] - Batch-remove unused arguments in _assertPixel and _asser...
[gecko.git] / testing / web-platform / tests / html / canvas / offscreen / pixel-manipulation / 2d.imageData.put.dirty.outside.worker.js
blob9f537135dac2ba30b88ae060fd85d488da04de5c
1 // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
2 // OffscreenCanvas test in a worker:2d.imageData.put.dirty.outside
3 // Description:putImageData() handles dirty rectangles outside the canvas correctly
4 // Note:
6 importScripts("/resources/testharness.js");
7 importScripts("/html/canvas/resources/canvas-tests.js");
9 var t = async_test("putImageData() handles dirty rectangles outside the canvas correctly");
10 var t_pass = t.done.bind(t);
11 var t_fail = t.step_func(function(reason) {
12     throw reason;
13 });
14 t.step(function() {
16 var canvas = new OffscreenCanvas(100, 50);
17 var ctx = canvas.getContext('2d');
19 ctx.fillStyle = '#f00';
20 ctx.fillRect(0, 0, 100, 50)
21 var imgdata = ctx.getImageData(0, 0, 100, 50);
22 ctx.fillStyle = '#0f0';
23 ctx.fillRect(0, 0, 100, 50)
24 ctx.putImageData(imgdata, 100, 20, 20, 20, -20, -20);
25 ctx.putImageData(imgdata, 200, 200, 0, 0, 100, 50);
26 ctx.putImageData(imgdata, 40, 20, -30, -20, 30, 20);
27 ctx.putImageData(imgdata, -30, 20, 0, 0, 30, 20);
28 _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2);
29 _assertPixelApprox(canvas, 98,15, 0,255,0,255, 2);
30 _assertPixelApprox(canvas, 98,25, 0,255,0,255, 2);
31 _assertPixelApprox(canvas, 98,45, 0,255,0,255, 2);
32 _assertPixelApprox(canvas, 1,5, 0,255,0,255, 2);
33 _assertPixelApprox(canvas, 1,25, 0,255,0,255, 2);
34 _assertPixelApprox(canvas, 1,45, 0,255,0,255, 2);
35 t.done();
37 });
38 done();