tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

2d.drawImage.clip.worker.js (806B)


      1 // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
      2 // OffscreenCanvas test in a worker:2d.drawImage.clip
      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 = '#0f0';
     14  ctx.fillRect(0, 0, 100, 50);
     15  ctx.rect(-10, -10, 1, 1);
     16  ctx.clip();
     17  const response = await fetch('/images/red.png');
     18  const blob = await response.blob();
     19  const bitmap = await createImageBitmap(blob);
     20 
     21  ctx.fillStyle = '#0f0';
     22  ctx.fillRect(0, 0, 100, 50);
     23  ctx.rect(-10, -10, 1, 1);
     24  ctx.clip();
     25  ctx.drawImage(bitmap, 0, 0);
     26  _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2);
     27 }, "");
     28 done();