tor-browser

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

2d.path.isPointInStroke.basic.worker.js (1153B)


      1 // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
      2 // OffscreenCanvas test in a worker:2d.path.isPointInStroke.basic
      3 // Description:detects whether point is in the area contained by the stroke of the path
      4 // Note:
      5 
      6 importScripts("/resources/testharness.js");
      7 importScripts("/html/canvas/resources/canvas-tests.js");
      8 
      9 var t = async_test("detects whether point is in the area contained by the stroke of the path");
     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.strokeStyle = '#0f0';
     20 ctx.beginPath();
     21 ctx.rect(0, 0, 20, 20);
     22 _assertSame(ctx.isPointInStroke(0, 0), true, "ctx.isPointInStroke(0, 0)", "true");
     23 _assertSame(ctx.isPointInStroke(30, 10), false, "ctx.isPointInStroke(30, 10)", "false");
     24 
     25 var path = new Path2D();
     26 path.rect(20, 20, 100, 100);
     27 _assertSame(ctx.isPointInStroke(path, 20, 20), true, "ctx.isPointInStroke(path, 20, 20)", "true");
     28 _assertSame(ctx.isPointInStroke(path, 120, 20), true, "ctx.isPointInStroke(path, 120, 20)", "true");
     29 t.done();
     30 
     31 });
     32 done();