tor-browser

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

2d.shadow.pattern.transparent.2.worker.js (1068B)


      1 // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
      2 // OffscreenCanvas test in a worker:2d.shadow.pattern.transparent.2
      3 // Description:Shadows are not drawn for transparent parts of fill patterns
      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  var response = await fetch('/images/redtransparent.png')
     14  var blob = await response.blob();
     15  var img = await createImageBitmap(blob);
     16  var pattern = ctx.createPattern(img, 'repeat');
     17  ctx.fillStyle = '#f00';
     18  ctx.fillRect(0, 0, 50, 50);
     19  ctx.fillStyle = '#0f0';
     20  ctx.fillRect(50, 0, 50, 50);
     21  ctx.shadowOffsetY = 50;
     22  ctx.shadowColor = '#0f0';
     23  ctx.fillStyle = pattern;
     24  ctx.fillRect(0, -50, 100, 50);
     25 
     26  _assertPixel(canvas, 25,25, 0,255,0,255);
     27  _assertPixel(canvas, 50,25, 0,255,0,255);
     28  _assertPixel(canvas, 75,25, 0,255,0,255);
     29 }, "Shadows are not drawn for transparent parts of fill patterns");
     30 done();