tor-browser

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

2d.path.isPointInpath.invalid.html (2554B)


      1 <!DOCTYPE html>
      2 <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
      3 <meta charset="UTF-8">
      4 <title>OffscreenCanvas test: 2d.path.isPointInpath.invalid</title>
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script src="/html/canvas/resources/canvas-tests.js"></script>
      8 
      9 <h1>2d.path.isPointInpath.invalid</h1>
     10 <p class="desc">Verify isPointInPath throws exceptions with invalid inputs.</p>
     11 
     12 
     13 <script>
     14 var t = async_test("Verify isPointInPath throws exceptions with invalid inputs.");
     15 var t_pass = t.done.bind(t);
     16 var t_fail = t.step_func(function(reason) {
     17    throw reason;
     18 });
     19 t.step(function() {
     20 
     21  var canvas = new OffscreenCanvas(100, 50);
     22  var ctx = canvas.getContext('2d');
     23 
     24  canvas.width = 200;
     25  canvas.height = 200;
     26  path = new Path2D();
     27  path.rect(0, 0, 100, 100);
     28  path.rect(25, 25, 50, 50);
     29  // Testing invalid enumeration isPointInPath (w/ and w/o Path object');
     30  assert_throws_js(TypeError, function() { ctx.isPointInPath(path, 50, 50, 'gazonk'); });
     31  assert_throws_js(TypeError, function() { ctx.isPointInPath(50, 50, 'gazonk'); });
     32 
     33  // Testing invalid type isPointInPath with Path object');
     34  assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50); });
     35  assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50, 'nonzero'); });
     36  assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50, 'evenodd'); });
     37  assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50, null); });
     38  assert_throws_js(TypeError, function() { ctx.isPointInPath(path, 50, 50, null); });
     39  assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50); });
     40  assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50, 'nonzero'); });
     41  assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50, 'evenodd'); });
     42  assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50, undefined); });
     43  assert_throws_js(TypeError, function() { ctx.isPointInPath([], 50, 50); });
     44  assert_throws_js(TypeError, function() { ctx.isPointInPath([], 50, 50, 'nonzero'); });
     45  assert_throws_js(TypeError, function() { ctx.isPointInPath([], 50, 50, 'evenodd'); });
     46  assert_throws_js(TypeError, function() { ctx.isPointInPath({}, 50, 50); });
     47  assert_throws_js(TypeError, function() { ctx.isPointInPath({}, 50, 50, 'nonzero'); });
     48  assert_throws_js(TypeError, function() { ctx.isPointInPath({}, 50, 50, 'evenodd'); });
     49  t.done();
     50 
     51 });
     52 </script>