OLD | NEW |
| (Empty) |
1 <html xmlns="http://www.w3.org/1999/xhtml"> | |
2 <head> | |
3 <script>window.enablePixelTesting = true;</script> | |
4 <script src="../../resources/js-test.js"></script> | |
5 </head> | |
6 <body> | |
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 0 100 L 100 100" fill="green"/> | |
10 </g> | |
11 </svg> | |
12 | |
13 <p id="description"></p> | |
14 <div id="console"></div> | |
15 <script type="text/javascript"> | |
16 <![CDATA[ | |
17 description("This is a test of the SVGPathSegList::insertItemBefore() API.")
; | |
18 | |
19 var svg = document.getElementById("svg"); | |
20 var path1 = document.getElementById("path1"); | |
21 | |
22 debug(""); | |
23 debug("Check initial 'pathSegList' value of path1"); | |
24 shouldBe("path1.pathSegList.numberOfItems", "4"); | |
25 shouldBeEqualToString("path1.pathSegList.getItem(0).toString()", "[object SV
GPathSegMovetoAbs]"); | |
26 shouldBe("path1.pathSegList.getItem(0).x", "0"); | |
27 shouldBe("path1.pathSegList.getItem(0).y", "0"); | |
28 shouldBeEqualToString("path1.pathSegList.getItem(1).toString()", "[object SV
GPathSegLinetoAbs]"); | |
29 shouldBe("path1.pathSegList.getItem(1).x", "100"); | |
30 shouldBe("path1.pathSegList.getItem(1).y", "0"); | |
31 shouldBeEqualToString("path1.pathSegList.getItem(2).toString()", "[object SV
GPathSegLinetoAbs]"); | |
32 shouldBe("path1.pathSegList.getItem(2).x", "0"); | |
33 shouldBe("path1.pathSegList.getItem(2).y", "100"); | |
34 shouldBeEqualToString("path1.pathSegList.getItem(3).toString()", "[object SV
GPathSegLinetoAbs]"); | |
35 shouldBe("path1.pathSegList.getItem(3).x", "100"); | |
36 shouldBe("path1.pathSegList.getItem(3).y", "100"); | |
37 | |
38 debug(""); | |
39 debug("Insert fourth item at position three using insertItemBefore()"); | |
40 shouldBeEqualToString("path1.pathSegList.insertItemBefore(path1.pathSegList.
getItem(3), 2).toString()", "[object SVGPathSegLinetoAbs]"); | |
41 shouldBe("path1.pathSegList.numberOfItems", "5"); | |
42 shouldBeEqualToString("path1.pathSegList.getItem(0).toString()", "[object SV
GPathSegMovetoAbs]"); | |
43 shouldBe("path1.pathSegList.getItem(0).x", "0"); | |
44 shouldBe("path1.pathSegList.getItem(0).y", "0"); | |
45 shouldBeEqualToString("path1.pathSegList.getItem(1).toString()", "[object SV
GPathSegLinetoAbs]"); | |
46 shouldBe("path1.pathSegList.getItem(1).x", "100"); | |
47 shouldBe("path1.pathSegList.getItem(1).y", "0"); | |
48 shouldBeEqualToString("path1.pathSegList.getItem(2).toString()", "[object SV
GPathSegLinetoAbs]"); | |
49 shouldBe("path1.pathSegList.getItem(2).x", "100"); | |
50 shouldBe("path1.pathSegList.getItem(2).y", "100"); | |
51 shouldBeEqualToString("path1.pathSegList.getItem(3).toString()", "[object SV
GPathSegLinetoAbs]"); | |
52 shouldBe("path1.pathSegList.getItem(3).x", "0"); | |
53 shouldBe("path1.pathSegList.getItem(3).y", "100"); | |
54 shouldBeEqualToString("path1.pathSegList.getItem(4).toString()", "[object SV
GPathSegLinetoAbs]"); | |
55 shouldBe("path1.pathSegList.getItem(4).x", "100"); | |
56 shouldBe("path1.pathSegList.getItem(4).y", "100"); | |
57 | |
58 debug(""); | |
59 debug("Change last item of path1 list"); | |
60 shouldBe("path1.pathSegList.getItem(4).x = 0", "0"); | |
61 | |
62 debug(""); | |
63 debug("Check final 'pathSegList' value of path1"); | |
64 shouldBe("path1.pathSegList.numberOfItems", "5"); | |
65 shouldBeEqualToString("path1.pathSegList.getItem(0).toString()", "[object SV
GPathSegMovetoAbs]"); | |
66 shouldBe("path1.pathSegList.getItem(0).x", "0"); | |
67 shouldBe("path1.pathSegList.getItem(0).y", "0"); | |
68 shouldBeEqualToString("path1.pathSegList.getItem(1).toString()", "[object SV
GPathSegLinetoAbs]"); | |
69 shouldBe("path1.pathSegList.getItem(1).x", "100"); | |
70 shouldBe("path1.pathSegList.getItem(1).y", "0"); | |
71 shouldBeEqualToString("path1.pathSegList.getItem(2).toString()", "[object SV
GPathSegLinetoAbs]"); | |
72 shouldBe("path1.pathSegList.getItem(2).x", "100"); | |
73 shouldBe("path1.pathSegList.getItem(2).y", "100"); | |
74 shouldBeEqualToString("path1.pathSegList.getItem(3).toString()", "[object SV
GPathSegLinetoAbs]"); | |
75 shouldBe("path1.pathSegList.getItem(3).x", "0"); | |
76 shouldBe("path1.pathSegList.getItem(3).y", "100"); | |
77 shouldBeEqualToString("path1.pathSegList.getItem(4).toString()", "[object SV
GPathSegLinetoAbs]"); | |
78 shouldBe("path1.pathSegList.getItem(4).x", "0"); | |
79 shouldBe("path1.pathSegList.getItem(4).y", "100"); | |
80 | |
81 ]]> | |
82 </script> | |
83 </body> | |
84 </html> | |
OLD | NEW |