tor-browser

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

2d.shadow.image.transparent.2.html (1196B)


      1 <!DOCTYPE html>
      2 <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
      3 <meta charset="UTF-8">
      4 <title>OffscreenCanvas test: 2d.shadow.image.transparent.2</title>
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script src="/html/canvas/resources/canvas-tests.js"></script>
      8 
      9 <h1>2d.shadow.image.transparent.2</h1>
     10 <p class="desc">Shadows are not drawn for transparent parts of images</p>
     11 
     12 
     13 <script>
     14 promise_test(async t => {
     15 
     16  var canvas = new OffscreenCanvas(100, 50);
     17  var ctx = canvas.getContext('2d');
     18 
     19  ctx.fillStyle = '#0f0';
     20  ctx.fillRect(0, 0, 50, 50);
     21  ctx.fillStyle = '#f00';
     22  ctx.fillRect(50, 0, 50, 50);
     23  ctx.shadowOffsetY = 50;
     24  ctx.shadowColor = '#0f0';
     25  var response = await fetch('/images/redtransparent.png')
     26  var blob = await response.blob();
     27  var img = await createImageBitmap(blob);
     28  ctx.drawImage(img, 50, -50);
     29  ctx.shadowColor = '#f00';
     30  ctx.drawImage(img, -50, -50);
     31 
     32  _assertPixel(canvas, 25,25, 0,255,0,255);
     33  _assertPixel(canvas, 50,25, 0,255,0,255);
     34  _assertPixel(canvas, 75,25, 0,255,0,255);
     35 
     36 }, "Shadows are not drawn for transparent parts of images");
     37 </script>