2d.drawImage.zerosource.worker.js (949B)
1 // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. 2 // OffscreenCanvas test in a worker:2d.drawImage.zerosource 3 // Description:drawImage with zero-sized source rectangle draws nothing without exception 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 = '#0f0'; 14 ctx.fillRect(0, 0, 100, 50); 15 const response = await fetch('/images/red.png'); 16 const blob = await response.blob(); 17 const bitmap = await createImageBitmap(blob); 18 ctx.drawImage(bitmap, 10, 10, 0, 1, 0, 0, 100, 50); 19 ctx.drawImage(bitmap, 10, 10, 1, 0, 0, 0, 100, 50); 20 ctx.drawImage(bitmap, 10, 10, 0, 0, 0, 0, 100, 50); 21 _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); 22 }, "drawImage with zero-sized source rectangle draws nothing without exception"); 23 done();