2d.composite.uncovered.pattern.source-in.worker.js (1038B)
1 // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. 2 // OffscreenCanvas test in a worker:2d.composite.uncovered.pattern.source-in 3 // Description:Pattern fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. 4 // Note: 5 6 importScripts("/resources/testharness.js"); 7 importScripts("/html/canvas/resources/canvas-tests.js"); 8 9 promise_test(async t => { 10 var canvas = new OffscreenCanvas(100, 50); 11 var ctx = canvas.getContext('2d'); 12 13 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)'; 14 ctx.fillRect(0, 0, 100, 50); 15 ctx.globalCompositeOperation = 'source-in'; 16 const response = await fetch('/images/yellow.png') 17 const blob = await response.blob(); 18 const bitmap = await createImageBitmap(blob); 19 ctx.fillStyle = ctx.createPattern(bitmap, 'no-repeat'); 20 ctx.fillRect(0, 50, 100, 50); 21 _assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); 22 }, "Pattern fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); 23 done();