2d.path.isPointInpath.invalid.worker.js (2392B)
1 // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. 2 // OffscreenCanvas test in a worker:2d.path.isPointInpath.invalid 3 // Description:Verify isPointInPath throws exceptions with invalid inputs. 4 // Note: 5 6 importScripts("/resources/testharness.js"); 7 importScripts("/html/canvas/resources/canvas-tests.js"); 8 9 var t = async_test("Verify isPointInPath throws exceptions with invalid inputs."); 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 canvas.width = 200; 20 canvas.height = 200; 21 path = new Path2D(); 22 path.rect(0, 0, 100, 100); 23 path.rect(25, 25, 50, 50); 24 // Testing invalid enumeration isPointInPath (w/ and w/o Path object'); 25 assert_throws_js(TypeError, function() { ctx.isPointInPath(path, 50, 50, 'gazonk'); }); 26 assert_throws_js(TypeError, function() { ctx.isPointInPath(50, 50, 'gazonk'); }); 27 28 // Testing invalid type isPointInPath with Path object'); 29 assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50); }); 30 assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50, 'nonzero'); }); 31 assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50, 'evenodd'); }); 32 assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50, null); }); 33 assert_throws_js(TypeError, function() { ctx.isPointInPath(path, 50, 50, null); }); 34 assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50); }); 35 assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50, 'nonzero'); }); 36 assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50, 'evenodd'); }); 37 assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50, undefined); }); 38 assert_throws_js(TypeError, function() { ctx.isPointInPath([], 50, 50); }); 39 assert_throws_js(TypeError, function() { ctx.isPointInPath([], 50, 50, 'nonzero'); }); 40 assert_throws_js(TypeError, function() { ctx.isPointInPath([], 50, 50, 'evenodd'); }); 41 assert_throws_js(TypeError, function() { ctx.isPointInPath({}, 50, 50); }); 42 assert_throws_js(TypeError, function() { ctx.isPointInPath({}, 50, 50, 'nonzero'); }); 43 assert_throws_js(TypeError, function() { ctx.isPointInPath({}, 50, 50, 'evenodd'); }); 44 t.done(); 45 }); 46 done();