tor-browser

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

2d.shadow.clip.1.worker.js (1021B)


      1 // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
      2 // OffscreenCanvas test in a worker:2d.shadow.clip.1
      3 // Description:Shadows of clipped shapes are still drawn within the clipping region
      4 // Note:
      5 
      6 importScripts("/resources/testharness.js");
      7 importScripts("/html/canvas/resources/canvas-tests.js");
      8 
      9 var t = async_test("Shadows of clipped shapes are still drawn within the clipping region");
     10 var t_pass = t.done.bind(t);
     11 var t_fail = t.step_func(function(reason) {
     12    throw reason;
     13 });
     14 t.step(function() {
     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 
     24  ctx.save();
     25  ctx.beginPath();
     26  ctx.rect(50, 0, 50, 50);
     27  ctx.clip();
     28  ctx.shadowColor = '#0f0';
     29  ctx.shadowOffsetX = 50;
     30  ctx.fillRect(0, 0, 50, 50);
     31  ctx.restore();
     32 
     33  _assertPixel(canvas, 25,25, 0,255,0,255);
     34  _assertPixel(canvas, 75,25, 0,255,0,255);
     35  t.done();
     36 });
     37 done();