2d.pattern.repeat.empty.worker.js (857B)
1 // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. 2 // OffscreenCanvas test in a worker:2d.pattern.repeat.empty 3 // Description: 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 = '#f00'; 14 ctx.fillRect(0, 0, 100, 50); 15 var response = await fetch('/images/green-1x1.png') 16 var blob = await response.blob(); 17 var img = await createImageBitmap(blob); 18 var pattern = ctx.createPattern(img, ""); 19 ctx.fillStyle = pattern; 20 ctx.fillRect(0, 0, 200, 50); 21 22 _assertPixel(canvas, 1,1, 0,255,0,255); 23 _assertPixel(canvas, 98,1, 0,255,0,255); 24 _assertPixel(canvas, 1,48, 0,255,0,255); 25 _assertPixel(canvas, 98,48, 0,255,0,255); 26 }, ""); 27 done();