2d.path.isPointInpath.invalid.html (2633B)
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>Canvas 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 <link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css"> 9 <body class="show_output"> 10 11 <h1>2d.path.isPointInpath.invalid</h1> 12 <p class="desc">Verify isPointInPath throws exceptions with invalid inputs.</p> 13 14 15 <p class="output">Actual output:</p> 16 <canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas> 17 18 <ul id="d"></ul> 19 <script> 20 var t = async_test("Verify isPointInPath throws exceptions with invalid inputs."); 21 _addTest(function(canvas, ctx) { 22 23 canvas.width = 200; 24 canvas.height = 200; 25 path = new Path2D(); 26 path.rect(0, 0, 100, 100); 27 path.rect(25, 25, 50, 50); 28 // Testing invalid enumeration isPointInPath (w/ and w/o Path object'); 29 assert_throws_js(TypeError, function() { ctx.isPointInPath(path, 50, 50, 'gazonk'); }); 30 assert_throws_js(TypeError, function() { ctx.isPointInPath(50, 50, 'gazonk'); }); 31 32 // Testing invalid type isPointInPath with Path object'); 33 assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50); }); 34 assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50, 'nonzero'); }); 35 assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50, 'evenodd'); }); 36 assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50, null); }); 37 assert_throws_js(TypeError, function() { ctx.isPointInPath(path, 50, 50, null); }); 38 assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50); }); 39 assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50, 'nonzero'); }); 40 assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50, 'evenodd'); }); 41 assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50, undefined); }); 42 assert_throws_js(TypeError, function() { ctx.isPointInPath([], 50, 50); }); 43 assert_throws_js(TypeError, function() { ctx.isPointInPath([], 50, 50, 'nonzero'); }); 44 assert_throws_js(TypeError, function() { ctx.isPointInPath([], 50, 50, 'evenodd'); }); 45 assert_throws_js(TypeError, function() { ctx.isPointInPath({}, 50, 50); }); 46 assert_throws_js(TypeError, function() { ctx.isPointInPath({}, 50, 50, 'nonzero'); }); 47 assert_throws_js(TypeError, function() { ctx.isPointInPath({}, 50, 50, 'evenodd'); }); 48 49 }); 50 </script>