chromium/third_party/blink/web_tests/external/wpt/svg/types/scripted/SVGGeometryElement.isPointInStroke-02.svg

<svg id="svg" xmlns="http://www.w3.org/2000/svg" xmlns:h="http://www.w3.org/1999/xhtml" viewBox="0 0 36 36" width="600" height="600">
  <title>isPointInStroke w/dashes works properly at large scale factors</title>
  <h:script src="/resources/testharness.js"/>
  <h:script src="/resources/testharnessreport.js"/>
  <metadata>
    <h:link rel="help" href="https://svgwg.org/svg2-draft/types.html#InterfaceSVGGeometryElement"/>
    <h:link rel="help" href="https://svgwg.org/svg2-draft/types.html#__svg__SVGGeometryElement__isPointInStroke"/>
  </metadata>
  <circle id="circle" cx="6" cy="10" r="5" stroke="blue" stroke-width="1" stroke-dasharray="10 21.4159" fill="none"/>
  <script>
  <![CDATA[
    test(function() {
      let svg = document.getElementById("svg");
      let circle = document.getElementById("circle");
      let pt = svg.createSVGPoint();

      pt.x = 11;
      pt.y = 10;
      assert_true(circle.isPointInStroke(pt), "hit-test the beginning of the dash (t=0)");

      pt.x = 8.70;
      pt.y = 14.21;
      assert_true(circle.isPointInStroke(pt), "hit-test the middle of the dash (t=5)");

      pt.x = 4.10;
      pt.y = 14.63;
      assert_true(circle.isPointInStroke(pt), "hit-test the end of the dash (t=9.8)");

      pt.x = 3.74;
      pt.y = 14.46;
      assert_false(circle.isPointInStroke(pt), "hit-test past the end of the dash (t=10.2)");
    });
  ]]>
  </script>
</svg>