2d.path.isPointInStroke.scaleddashes.html (1795B)
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.isPointInStroke.scaleddashes</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.isPointInStroke.scaleddashes</h1> 12 <p class="desc">isPointInStroke() should return correct results on dashed paths at high scale factors</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("isPointInStroke() should return correct results on dashed paths at high scale factors"); 21 _addTest(function(canvas, ctx) { 22 23 var scale = 20; 24 ctx.setLineDash([10, 21.4159]); // dash from t=0 to t=10 along the circle 25 ctx.scale(scale, scale); 26 ctx.ellipse(6, 10, 5, 5, 0, 2*Math.PI, false); 27 ctx.stroke(); 28 29 // hit-test the beginning of the dash (t=0) 30 _assertSame(ctx.isPointInStroke(11*scale, 10*scale), true, "ctx.isPointInStroke(11*scale, 10*scale)", "true"); 31 // hit-test the middle of the dash (t=5) 32 _assertSame(ctx.isPointInStroke(8.70*scale, 14.21*scale), true, "ctx.isPointInStroke(8.70*scale, 14.21*scale)", "true"); 33 // hit-test the end of the dash (t=9.8) 34 _assertSame(ctx.isPointInStroke(4.10*scale, 14.63*scale), true, "ctx.isPointInStroke(4.10*scale, 14.63*scale)", "true"); 35 // hit-test past the end of the dash (t=10.2) 36 _assertSame(ctx.isPointInStroke(3.74*scale, 14.46*scale), false, "ctx.isPointInStroke(3.74*scale, 14.46*scale)", "false"); 37 38 }); 39 </script>