OLD | NEW |
| (Empty) |
1 description("This tests getPointAtLength of SVG path."); | |
2 | |
3 var pathElement = document.createElementNS("http://www.w3.org/2000/svg", "path")
; | |
4 | |
5 function pointAtLengthOfPath(string) { | |
6 pathElement.setAttributeNS(null, "d", string); | |
7 | |
8 var point = pathElement.getPointAtLength(700); | |
9 return "(" + Math.round(point.x) + ", " + Math.round(point.y) + ")"; | |
10 } | |
11 | |
12 shouldBe("pointAtLengthOfPath('M0,20 L400,20 L640,20')", "'(640, 20)'"); | |
13 shouldBe("pointAtLengthOfPath('M0,20 L400,20 L640,20 z')", "'(580, 20)'"); | |
14 shouldBe("pointAtLengthOfPath('M0,20 L400,20 z M 320,20 L640,20')", "'(100, 20)'
"); | |
15 shouldBe("pointAtLengthOfPath('M0,20 L20,40')", "'(20, 40)'"); | |
16 | |
17 var successfullyParsed = true; | |
OLD | NEW |