tor-browser

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

2d.path.isPointInStroke.basic.html (1291B)


      1 <!DOCTYPE html>
      2 <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
      3 <title>OffscreenCanvas test: 2d.path.isPointInStroke.basic</title>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="/html/canvas/resources/canvas-tests.js"></script>
      7 
      8 <h1>2d.path.isPointInStroke.basic</h1>
      9 <p class="desc">detects whether point is in the area contained by the stroke of the path</p>
     10 
     11 
     12 <script>
     13 var t = async_test("detects whether point is in the area contained by the stroke of the path");
     14 var t_pass = t.done.bind(t);
     15 var t_fail = t.step_func(function(reason) {
     16    throw reason;
     17 });
     18 t.step(function() {
     19 
     20 var canvas = new OffscreenCanvas(100, 50);
     21 var ctx = canvas.getContext('2d');
     22 
     23 ctx.strokeStyle = '#0f0';
     24 ctx.beginPath();
     25 ctx.rect(0, 0, 20, 20);
     26 _assertSame(ctx.isPointInStroke(0, 0), true, "ctx.isPointInStroke(0, 0)", "true");
     27 _assertSame(ctx.isPointInStroke(30, 10), false, "ctx.isPointInStroke(30, 10)", "false");
     28 
     29 var path = new Path2D();
     30 path.rect(20, 20, 100, 100);
     31 _assertSame(ctx.isPointInStroke(path, 20, 20), true, "ctx.isPointInStroke(path, 20, 20)", "true");
     32 _assertSame(ctx.isPointInStroke(path, 120, 20), true, "ctx.isPointInStroke(path, 120, 20)", "true");
     33 t.done();
     34 
     35 });
     36 </script>