1 <html xmlns="http://www.w3.org/1999/xhtml">
3 <script>window.enablePixelTesting = true;</script>
4 <script src="../../fast/js/resources/js-test-pre.js"></script>
7 <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="250" height="250">
8 <g transform="translate(10, 10)">
9 <path id="path1" d="M 0 0 L 100 0 L 100 100 z L 0 100" fill="green"/>
10 <path transform="translate(110, 0)" id="path2" d="M 0 0 h 100 z v 100 h -100" fill="green"/>
14 <p id="description"></p>
15 <div id="console"></div>
16 <script type="text/javascript">
18 description("This is a test of the SVGPathSegList::removeItem() API.");
20 var svg = document.getElementById("svg");
21 var path1 = document.getElementById("path1");
22 var path2 = document.getElementById("path2");
25 debug("Check initial 'pathSegList' value of path1");
26 shouldBe("path1.pathSegList.numberOfItems", "5");
27 shouldBeEqualToString("path1.pathSegList.getItem(0).toString()", "[object SVGPathSegMovetoAbs]");
28 shouldBe("path1.pathSegList.getItem(0).x", "0");
29 shouldBe("path1.pathSegList.getItem(0).y", "0");
30 shouldBeEqualToString("path1.pathSegList.getItem(1).toString()", "[object SVGPathSegLinetoAbs]");
31 shouldBe("path1.pathSegList.getItem(1).x", "100");
32 shouldBe("path1.pathSegList.getItem(1).y", "0");
33 shouldBeEqualToString("path1.pathSegList.getItem(2).toString()", "[object SVGPathSegLinetoAbs]");
34 shouldBe("path1.pathSegList.getItem(2).x", "100");
35 shouldBe("path1.pathSegList.getItem(2).y", "100");
36 shouldBeEqualToString("path1.pathSegList.getItem(3).toString()", "[object SVGPathSegClosePath]");
37 shouldBeEqualToString("path1.pathSegList.getItem(4).toString()", "[object SVGPathSegLinetoAbs]");
38 shouldBe("path1.pathSegList.getItem(4).x", "0");
39 shouldBe("path1.pathSegList.getItem(4).y", "100");
42 debug("Check initial 'pathSegList' value of path2");
43 shouldBe("path2.pathSegList.numberOfItems", "5");
44 shouldBeEqualToString("path2.pathSegList.getItem(0).toString()", "[object SVGPathSegMovetoAbs]");
45 shouldBe("path2.pathSegList.getItem(0).x", "0");
46 shouldBe("path2.pathSegList.getItem(0).y", "0");
47 shouldBeEqualToString("path2.pathSegList.getItem(1).toString()", "[object SVGPathSegLinetoHorizontalRel]");
48 shouldBe("path2.pathSegList.getItem(1).x", "100");
49 shouldBeEqualToString("path2.pathSegList.getItem(2).toString()", "[object SVGPathSegClosePath]");
50 shouldBeEqualToString("path2.pathSegList.getItem(3).toString()", "[object SVGPathSegLinetoVerticalRel]");
51 shouldBe("path2.pathSegList.getItem(3).y", "100");
52 shouldBeEqualToString("path2.pathSegList.getItem(4).toString()", "[object SVGPathSegLinetoHorizontalRel]");
53 shouldBe("path2.pathSegList.getItem(4).x", "-100");
56 debug("Remove fourth item of path1");
57 shouldBeEqualToString("path1.pathSegList.removeItem(3).toString()", "[object SVGPathSegClosePath]");
60 debug("Remove third item of path2");
61 shouldBeEqualToString("path2.pathSegList.removeItem(2).toString()", "[object SVGPathSegClosePath]");
65 <script src="../../fast/js/resources/js-test-post.js"></script>