| <?xml version="1.0" encoding="UTF-8"?> |
| <svg xmlns="http://www.w3.org/2000/svg" |
| xmlns:h="http://www.w3.org/1999/xhtml"> |
| <metadata> |
| <h:link rel="help" href="https://svgwg.org/svg2-draft/single-page.html#types-InterfaceSVGGeometryElement"/> |
| <h:meta name="assert" content="SVGGeometryElement members work for rect elements."/> |
| </metadata> |
| <style> |
| rect { |
| stroke-width: 10; |
| } |
| </style> |
| <rect id="box" x="50" y="50" width="200" height="100" pathLength="6"/> |
| <h:script src="/resources/testharness.js"/> |
| <h:script src="/resources/testharnessreport.js"/> |
| <script><![CDATA[ |
| var box = document.getElementById('box'); |
| |
| test(function() { |
| assert_equals(box.pathLength.baseVal, 6); |
| |
| assert_equals(box.getTotalLength(), 600); |
| |
| assert_equals(box.getPointAtLength(210).x, 250); |
| assert_equals(box.getPointAtLength(210).y, 60); |
| }, 'getTotalLength and getPointAtLength do not take pathLength into account'); |
| |
| test(function() { |
| assert_true(box.getPointAtLength(210) instanceof DOMPoint); |
| }, 'getPointAtLength() returns instance of DOMPoint'); |
| ]]></script> |
| </svg> |