blob: df0f1e14190690feb84c65f9a93966dcb95cf518 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests getPointAtLength of SVG path.");
var pathElement = document.createElementNS("http://www.w3.org/2000/svg", "path");
function pointAtLengthOfPath(string) {
pathElement.setAttributeNS(null, "d", string);
var point = pathElement.getPointAtLength(700);
return "(" + Math.round(point.x) + ", " + Math.round(point.y) + ")";
}
shouldBe("pointAtLengthOfPath('M0,20 L400,20 L640,20')", "'(640, 20)'");
shouldBe("pointAtLengthOfPath('M0,20 L400,20 L640,20 z')", "'(580, 20)'");
shouldBe("pointAtLengthOfPath('M0,20 L400,20 z M 320,20 L640,20')", "'(100, 20)'");
shouldBe("pointAtLengthOfPath('M0,20 L20,40')", "'(20, 40)'");
var successfullyParsed = true;
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>