tor-browser

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

2d.path.isPointInpath.multi.path.worker.js (1702B)


      1 // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
      2 // OffscreenCanvas test in a worker:2d.path.isPointInpath.multi.path
      3 // Description:Verify the winding rule in isPointInPath works for path object.
      4 // Note:
      5 
      6 importScripts("/resources/testharness.js");
      7 importScripts("/html/canvas/resources/canvas-tests.js");
      8 
      9 var t = async_test("Verify the winding rule in isPointInPath works for path object.");
     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  canvas.width = 200;
     20  canvas.height = 200;
     21 
     22  // Testing default isPointInPath with Path object');
     23  path = new Path2D();
     24  path.rect(0, 0, 100, 100);
     25  path.rect(25, 25, 50, 50);
     26  _assertSame(ctx.isPointInPath(path, 50, 50), true, "ctx.isPointInPath(path, 50, 50)", "true");
     27  _assertSame(ctx.isPointInPath(path, 50, 50, undefined), true, "ctx.isPointInPath(path, 50, 50, undefined)", "true");
     28  _assertSame(ctx.isPointInPath(path, NaN, 50), false, "ctx.isPointInPath(path, NaN, 50)", "false");
     29  _assertSame(ctx.isPointInPath(path, 50, NaN), false, "ctx.isPointInPath(path, 50, NaN)", "false");
     30 
     31  // Testing nonzero isPointInPath with Path object');
     32  path = new Path2D();
     33  path.rect(0, 0, 100, 100);
     34  path.rect(25, 25, 50, 50);
     35  _assertSame(ctx.isPointInPath(path, 50, 50, 'nonzero'), true, "ctx.isPointInPath(path, 50, 50, 'nonzero')", "true");
     36 
     37  // Testing evenodd isPointInPath with Path object');
     38  path = new Path2D();
     39  path.rect(0, 0, 100, 100);
     40  path.rect(25, 25, 50, 50);
     41  assert_false(ctx.isPointInPath(path, 50, 50, 'evenodd'));
     42  t.done();
     43 });
     44 done();