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 100 100 L 100 0 L 100 100" fill="green"/> | |
10 <path transform="translate(110, 0)" id="path2" d="M 50 50 L 0 100 M 0 0"
fill="green"/> | |
11 </g> | |
12 </svg> | |
13 | |
14 <p id="description"></p> | |
15 <div id="console"></div> | |
16 <script type="text/javascript"> | |
17 <![CDATA[ | |
18 description("This is a test of the SVGPathSegList::appendItem() API."); | |
19 | |
20 var svg = document.getElementById("svg"); | |
21 var path1 = document.getElementById("path1"); | |
22 var path2 = document.getElementById("path2"); | |
23 | |
24 debug(""); | |
25 debug("Check initial 'pathSegList' value of path1"); | |
26 shouldBe("path1.pathSegList.numberOfItems", "3"); | |
27 shouldBeEqualToString("path1.pathSegList.getItem(0).toString()", "[object SV
GPathSegMovetoAbs]"); | |
28 shouldBe("path1.pathSegList.getItem(0).x", "100"); | |
29 shouldBe("path1.pathSegList.getItem(0).y", "100"); | |
30 shouldBeEqualToString("path1.pathSegList.getItem(1).toString()", "[object SV
GPathSegLinetoAbs]"); | |
31 shouldBe("path1.pathSegList.getItem(1).x", "100"); | |
32 shouldBe("path1.pathSegList.getItem(1).y", "0"); | |
33 shouldBeEqualToString("path1.pathSegList.getItem(2).toString()", "[object SV
GPathSegLinetoAbs]"); | |
34 shouldBe("path1.pathSegList.getItem(2).x", "100"); | |
35 shouldBe("path1.pathSegList.getItem(2).y", "100"); | |
36 | |
37 debug(""); | |
38 debug("Check initial 'pathSegList' value of path2"); | |
39 shouldBe("path2.pathSegList.numberOfItems", "3"); | |
40 shouldBeEqualToString("path2.pathSegList.getItem(0).toString()", "[object SV
GPathSegMovetoAbs]"); | |
41 shouldBe("path2.pathSegList.getItem(0).x", "50"); | |
42 shouldBe("path2.pathSegList.getItem(0).y", "50"); | |
43 shouldBeEqualToString("path2.pathSegList.getItem(1).toString()", "[object SV
GPathSegLinetoAbs]"); | |
44 shouldBe("path2.pathSegList.getItem(1).x", "0"); | |
45 shouldBe("path2.pathSegList.getItem(1).y", "100"); | |
46 shouldBeEqualToString("path2.pathSegList.getItem(2).toString()", "[object SV
GPathSegMovetoAbs]"); | |
47 shouldBe("path2.pathSegList.getItem(2).x", "0"); | |
48 shouldBe("path2.pathSegList.getItem(2).y", "0"); | |
49 | |
50 debug(""); | |
51 debug("Cache first item of path1 in local variable 'item0'"); | |
52 var item0 = path1.pathSegList.getItem(0); | |
53 shouldBe("item0.x", "100"); | |
54 shouldBe("item0.y", "100"); | |
55 | |
56 debug(""); | |
57 debug("Clear path1 segment list"); | |
58 shouldBeUndefined("path1.pathSegList.clear()"); | |
59 | |
60 debug(""); | |
61 debug("Verify that item0 is still alive, and can be modified"); | |
62 shouldBe("item0.x", "100"); | |
63 shouldBe("item0.y", "100"); | |
64 shouldBe("item0.x += 50", "150"); | |
65 shouldBe("item0.y += 50", "150"); | |
66 | |
67 debug(""); | |
68 debug("Check intermediate list state of path1"); | |
69 shouldBe("path1.pathSegList.numberOfItems", "0"); | |
70 shouldThrow("path1.pathSegList.getItem(0)"); | |
71 | |
72 debug(""); | |
73 debug("Check intermediate list state of path2"); | |
74 shouldBe("path2.pathSegList.numberOfItems", "3"); | |
75 shouldBeEqualToString("path2.pathSegList.getItem(0).toString()", "[object SV
GPathSegMovetoAbs]"); | |
76 shouldBe("path2.pathSegList.getItem(0).x", "50"); | |
77 shouldBe("path2.pathSegList.getItem(0).y", "50"); | |
78 shouldBeEqualToString("path2.pathSegList.getItem(1).toString()", "[object SV
GPathSegLinetoAbs]"); | |
79 shouldBe("path2.pathSegList.getItem(1).x", "0"); | |
80 shouldBe("path2.pathSegList.getItem(1).y", "100"); | |
81 shouldBeEqualToString("path2.pathSegList.getItem(2).toString()", "[object SV
GPathSegMovetoAbs]"); | |
82 shouldBe("path2.pathSegList.getItem(2).x", "0"); | |
83 shouldBe("path2.pathSegList.getItem(2).y", "0"); | |
84 | |
85 debug(""); | |
86 debug("Initialize path1 list with first item of path2"); | |
87 shouldBeEqualToString("path1.pathSegList.initialize(path2.pathSegList.getIte
m(0)).toString()", "[object SVGPathSegMovetoAbs]"); | |
88 | |
89 debug(""); | |
90 debug("Check intermediate list state of path1"); | |
91 shouldBe("path1.pathSegList.numberOfItems", "1"); | |
92 shouldBeEqualToString("path1.pathSegList.getItem(0).toString()", "[object SV
GPathSegMovetoAbs]"); | |
93 shouldBe("path1.pathSegList.getItem(0).x", "50"); | |
94 shouldBe("path1.pathSegList.getItem(0).y", "50"); | |
95 | |
96 debug(""); | |
97 debug("Check intermediate list state of path2"); | |
98 shouldBe("path2.pathSegList.numberOfItems", "3"); | |
99 shouldBeEqualToString("path2.pathSegList.getItem(0).toString()", "[object SV
GPathSegMovetoAbs]"); | |
100 shouldBe("path2.pathSegList.getItem(0).x", "50"); | |
101 shouldBe("path2.pathSegList.getItem(0).y", "50"); | |
102 shouldBeEqualToString("path2.pathSegList.getItem(1).toString()", "[object SV
GPathSegLinetoAbs]"); | |
103 shouldBe("path2.pathSegList.getItem(1).x", "0"); | |
104 shouldBe("path2.pathSegList.getItem(1).y", "100"); | |
105 shouldBeEqualToString("path2.pathSegList.getItem(2).toString()", "[object SV
GPathSegMovetoAbs]"); | |
106 shouldBe("path2.pathSegList.getItem(2).x", "0"); | |
107 shouldBe("path2.pathSegList.getItem(2).y", "0"); | |
108 | |
109 debug(""); | |
110 debug("Initialize path2 list with item0"); | |
111 shouldBeEqualToString("path2.pathSegList.initialize(item0).toString()", "[ob
ject SVGPathSegMovetoAbs]"); | |
112 | |
113 debug(""); | |
114 debug("Check final list state of path1"); | |
115 shouldBe("path1.pathSegList.numberOfItems", "1"); | |
116 shouldBeEqualToString("path1.pathSegList.getItem(0).toString()", "[object SV
GPathSegMovetoAbs]"); | |
117 shouldBe("path1.pathSegList.getItem(0).x", "50"); | |
118 shouldBe("path1.pathSegList.getItem(0).y", "50"); | |
119 | |
120 debug(""); | |
121 debug("Check final list state of path2"); | |
122 shouldBe("path2.pathSegList.numberOfItems", "1"); | |
123 shouldBeEqualToString("path2.pathSegList.getItem(0).toString()", "[object SV
GPathSegMovetoAbs]"); | |
124 shouldBe("path2.pathSegList.getItem(0).x", "150"); | |
125 shouldBe("path2.pathSegList.getItem(0).y", "150"); | |
126 | |
127 ]]> | |
128 </script> | |
129 </body> | |
130 </html> | |
OLD | NEW |