tor-browser

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

2d.path.isPointInPath.winding.worker.js (1676B)


      1 // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
      2 // OffscreenCanvas test in a worker:2d.path.isPointInPath.winding
      3 // Description:isPointInPath() uses the non-zero winding number rule
      4 // Note:
      5 
      6 importScripts("/resources/testharness.js");
      7 importScripts("/html/canvas/resources/canvas-tests.js");
      8 
      9 var t = async_test("isPointInPath() uses the non-zero winding number rule");
     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  // Create a square ring, using opposite windings to make a hole in the centre
     20  ctx.moveTo(0, 0);
     21  ctx.lineTo(50, 0);
     22  ctx.lineTo(50, 50);
     23  ctx.lineTo(0, 50);
     24  ctx.lineTo(0, 0);
     25  ctx.lineTo(10, 10);
     26  ctx.lineTo(10, 40);
     27  ctx.lineTo(40, 40);
     28  ctx.lineTo(40, 10);
     29  ctx.lineTo(10, 10);
     30 
     31  _assertSame(ctx.isPointInPath(5, 5), true, "ctx.isPointInPath(5, 5)", "true");
     32  _assertSame(ctx.isPointInPath(25, 5), true, "ctx.isPointInPath(25, 5)", "true");
     33  _assertSame(ctx.isPointInPath(45, 5), true, "ctx.isPointInPath(45, 5)", "true");
     34  _assertSame(ctx.isPointInPath(5, 25), true, "ctx.isPointInPath(5, 25)", "true");
     35  _assertSame(ctx.isPointInPath(25, 25), false, "ctx.isPointInPath(25, 25)", "false");
     36  _assertSame(ctx.isPointInPath(45, 25), true, "ctx.isPointInPath(45, 25)", "true");
     37  _assertSame(ctx.isPointInPath(5, 45), true, "ctx.isPointInPath(5, 45)", "true");
     38  _assertSame(ctx.isPointInPath(25, 45), true, "ctx.isPointInPath(25, 45)", "true");
     39  _assertSame(ctx.isPointInPath(45, 45), true, "ctx.isPointInPath(45, 45)", "true");
     40  t.done();
     41 });
     42 done();