2d.path.isPointInpath.multi.path.html (1867B)
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.multi.path</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.multi.path</h1> 10 <p class="desc">Verify the winding rule in isPointInPath works for path object.</p> 11 12 13 <script> 14 var t = async_test("Verify the winding rule in isPointInPath works for path object."); 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 27 // Testing default isPointInPath with Path object'); 28 path = new Path2D(); 29 path.rect(0, 0, 100, 100); 30 path.rect(25, 25, 50, 50); 31 _assertSame(ctx.isPointInPath(path, 50, 50), true, "ctx.isPointInPath(path, 50, 50)", "true"); 32 _assertSame(ctx.isPointInPath(path, 50, 50, undefined), true, "ctx.isPointInPath(path, 50, 50, undefined)", "true"); 33 _assertSame(ctx.isPointInPath(path, NaN, 50), false, "ctx.isPointInPath(path, NaN, 50)", "false"); 34 _assertSame(ctx.isPointInPath(path, 50, NaN), false, "ctx.isPointInPath(path, 50, NaN)", "false"); 35 36 // Testing nonzero isPointInPath with Path object'); 37 path = new Path2D(); 38 path.rect(0, 0, 100, 100); 39 path.rect(25, 25, 50, 50); 40 _assertSame(ctx.isPointInPath(path, 50, 50, 'nonzero'), true, "ctx.isPointInPath(path, 50, 50, 'nonzero')", "true"); 41 42 // Testing evenodd isPointInPath with Path object'); 43 path = new Path2D(); 44 path.rect(0, 0, 100, 100); 45 path.rect(25, 25, 50, 50); 46 assert_false(ctx.isPointInPath(path, 50, 50, 'evenodd')); 47 t.done(); 48 49 }); 50 </script>