2d.composite.uncovered.fill.destination-in.worker.js (1041B)
1 // META: timeout=long 2 // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. 3 // OffscreenCanvas test in a worker:2d.composite.uncovered.fill.destination-in 4 // Description:fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. 5 // Note: 6 7 importScripts("/resources/testharness.js"); 8 importScripts("/html/canvas/resources/canvas-tests.js"); 9 10 var t = async_test("fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); 11 var t_pass = t.done.bind(t); 12 var t_fail = t.step_func(function(reason) { 13 throw reason; 14 }); 15 t.step(function() { 16 17 var canvas = new OffscreenCanvas(100, 50); 18 var ctx = canvas.getContext('2d'); 19 20 ctx.fillStyle = 'rgba(0, 255, 0, 0.5)'; 21 ctx.fillRect(0, 0, 100, 50); 22 ctx.globalCompositeOperation = 'destination-in'; 23 ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; 24 ctx.translate(0, 25); 25 ctx.fillRect(0, 50, 100, 50); 26 _assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); 27 t.done(); 28 }); 29 done();