OLD | NEW |
1 <html xmlns="http://www.w3.org/1999/xhtml"> | 1 <html xmlns="http://www.w3.org/1999/xhtml"> |
2 <head> | 2 <head> |
3 <script>window.enablePixelTesting = true;</script> | 3 <script>window.enablePixelTesting = true;</script> |
4 <script src="../../fast/js/resources/js-test-pre.js"></script> | 4 <script src="../../fast/js/resources/js-test-pre.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200"> | 7 <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200"> |
8 <text id="text1" x="500 1000 1500" y="50"> ABC </text> | 8 <text id="text1" x="500 1000 1500" y="50"> ABC </text> |
9 </svg> | 9 </svg> |
10 | 10 |
11 <p id="description"></p> | 11 <p id="description"></p> |
12 <div id="console"></div> | 12 <div id="console"></div> |
13 <script type="text/javascript"> | 13 <script type="text/javascript"> |
14 <![CDATA[ | 14 <![CDATA[ |
15 description("This is a test of the simple SVGLengthList API parts."); | 15 description("This is a test of the simple SVGLengthList API parts."); |
16 | 16 |
| 17 if (window.testRunner) |
| 18 testRunner.dumpAsText(); |
| 19 |
17 var text1 = document.getElementById("text1"); | 20 var text1 = document.getElementById("text1"); |
18 | 21 |
19 // Spec: The object referenced by animVal will always be distinct from the o
ne referenced by baseVal, even when the attribute is not animated. | 22 // Spec: The object referenced by animVal will always be distinct from the o
ne referenced by baseVal, even when the attribute is not animated. |
20 shouldBeTrue("text1.x.baseVal != text1.x.animVal"); | 23 shouldBeTrue("text1.x.baseVal != text1.x.animVal"); |
21 | 24 |
22 shouldBe("text1.x.baseVal.numberOfItems", "3"); | 25 shouldBe("text1.x.baseVal.numberOfItems", "3"); |
23 shouldBe("text1.x.animVal.numberOfItems", "3"); | 26 shouldBe("text1.x.animVal.numberOfItems", "3"); |
24 shouldBe("text1.x.baseVal.getItem(0).value", "500"); | 27 shouldBe("text1.x.baseVal.getItem(0).value", "500"); |
25 shouldBe("text1.x.baseVal.getItem(1).value", "1000"); | 28 shouldBe("text1.x.baseVal.getItem(1).value", "1000"); |
26 shouldBe("text1.x.baseVal.getItem(2).value", "1500"); | 29 shouldBe("text1.x.baseVal.getItem(2).value", "1500"); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 shouldBeEqualToString("text1.getAttribute('x')", "500 1000 1500"); | 78 shouldBeEqualToString("text1.getAttribute('x')", "500 1000 1500"); |
76 | 79 |
77 shouldThrow("text1.x.baseVal.insertItemBefore(30, 0)"); | 80 shouldThrow("text1.x.baseVal.insertItemBefore(30, 0)"); |
78 shouldThrow("text1.x.baseVal.insertItemBefore('aString', 0)"); | 81 shouldThrow("text1.x.baseVal.insertItemBefore('aString', 0)"); |
79 shouldThrow("text1.x.baseVal.insertItemBefore(text1, 0)"); | 82 shouldThrow("text1.x.baseVal.insertItemBefore(text1, 0)"); |
80 shouldThrow("text1.x.baseVal.insertItemBefore(null, 0)"); | 83 shouldThrow("text1.x.baseVal.insertItemBefore(null, 0)"); |
81 | 84 |
82 debug(""); | 85 debug(""); |
83 debug("Set x='1 2 3 4' for text1"); | 86 debug("Set x='1 2 3 4' for text1"); |
84 shouldBeUndefined("text1.setAttribute('x', '1 2 3 4')"); | 87 shouldBeUndefined("text1.setAttribute('x', '1 2 3 4')"); |
| 88 |
| 89 debug(""); |
| 90 debug("Test edge cases for insertItemBefore()"); |
| 91 shouldBe("text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(3), 3)",
"text1.x.baseVal.getItem(3)"); |
| 92 shouldBeEqualToString("text1.getAttribute('x')", "1 2 3 4"); |
| 93 shouldBe("text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), 5)",
"text1.x.baseVal.getItem(3)"); |
| 94 shouldBeEqualToString("text1.getAttribute('x')", "1 3 4 2"); |
| 95 shouldBe("text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), 0)",
"text1.x.baseVal.getItem(0)"); |
| 96 shouldBeEqualToString("text1.getAttribute('x')", "3 1 4 2"); |
| 97 |
| 98 debug(""); |
| 99 debug("Set x='1 2 3 4' for text1"); |
| 100 shouldBeUndefined("text1.setAttribute('x', '1 2 3 4')"); |
85 shouldBe("text1.x.baseVal.numberOfItems", "4"); | 101 shouldBe("text1.x.baseVal.numberOfItems", "4"); |
86 shouldBe("text1.x.baseVal.getItem(0).value", "1"); | 102 shouldBe("text1.x.baseVal.getItem(0).value", "1"); |
87 shouldBe("text1.x.baseVal.getItem(1).value", "2"); | 103 shouldBe("text1.x.baseVal.getItem(1).value", "2"); |
88 shouldBe("text1.x.baseVal.getItem(2).value", "3"); | 104 shouldBe("text1.x.baseVal.getItem(2).value", "3"); |
89 shouldBe("text1.x.baseVal.getItem(3).value", "4"); | 105 shouldBe("text1.x.baseVal.getItem(3).value", "4"); |
90 shouldBeEqualToString("text1.getAttribute('x')", "1 2 3 4"); | 106 shouldBeEqualToString("text1.getAttribute('x')", "1 2 3 4"); |
91 | 107 |
92 debug(""); | 108 debug(""); |
93 debug("Test uncommon arguments for replaceItem()"); | 109 debug("Test uncommon arguments for replaceItem()"); |
94 shouldThrow("text1.x.baseVal.replaceItem(30)"); | 110 shouldThrow("text1.x.baseVal.replaceItem(30)"); |
95 shouldThrow("text1.x.baseVal.replaceItem('aString')"); | 111 shouldThrow("text1.x.baseVal.replaceItem('aString')"); |
96 shouldThrow("text1.x.baseVal.replaceItem(text1)"); | 112 shouldThrow("text1.x.baseVal.replaceItem(text1)"); |
97 shouldThrow("text1.x.baseVal.replaceItem(null)"); | 113 shouldThrow("text1.x.baseVal.replaceItem(null)"); |
98 shouldThrow("text1.x.baseVal.replaceItem(30, 0)"); | 114 shouldThrow("text1.x.baseVal.replaceItem(30, 0)"); |
99 shouldThrow("text1.x.baseVal.replaceItem('aString', 0)"); | 115 shouldThrow("text1.x.baseVal.replaceItem('aString', 0)"); |
100 shouldThrow("text1.x.baseVal.replaceItem(text1, 0)"); | 116 shouldThrow("text1.x.baseVal.replaceItem(text1, 0)"); |
101 shouldThrow("text1.x.baseVal.replaceItem(null, 0)"); | 117 shouldThrow("text1.x.baseVal.replaceItem(null, 0)"); |
102 | 118 |
103 shouldBe("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), 0)", "text
1.x.baseVal.getItem(0)"); | 119 shouldBe("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), 0)", "text
1.x.baseVal.getItem(0)"); |
104 shouldBe("text1.x.baseVal.numberOfItems", "3"); | 120 shouldBe("text1.x.baseVal.numberOfItems", "4"); |
105 shouldBe("text1.x.baseVal.getItem(0).value", "1"); | 121 shouldBe("text1.x.baseVal.getItem(0).value", "1"); |
106 shouldBe("text1.x.baseVal.getItem(1).value", "3"); | 122 shouldBe("text1.x.baseVal.getItem(1).value", "2"); |
107 shouldBe("text1.x.baseVal.getItem(2).value", "4"); | 123 shouldBe("text1.x.baseVal.getItem(2).value", "3"); |
108 shouldBeEqualToString("text1.getAttribute('x')", "1 3 4"); | 124 shouldBe("text1.x.baseVal.getItem(3).value", "4"); |
| 125 shouldBeEqualToString("text1.getAttribute('x')", "1 2 3 4"); |
109 | 126 |
110 shouldBe("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), 'aString')
", "text1.x.baseVal.getItem(0)"); | 127 shouldBe("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), 'aString')
", "text1.x.baseVal.getItem(0)"); |
111 shouldBe("text1.x.baseVal.numberOfItems", "2"); | 128 shouldBe("text1.x.baseVal.numberOfItems", "4"); |
112 shouldBe("text1.x.baseVal.getItem(0).value", "1"); | 129 shouldBe("text1.x.baseVal.getItem(0).value", "1"); |
113 shouldBe("text1.x.baseVal.getItem(1).value", "4"); | 130 shouldBe("text1.x.baseVal.getItem(1).value", "2"); |
114 shouldBeEqualToString("text1.getAttribute('x')", "1 4"); | 131 shouldBe("text1.x.baseVal.getItem(2).value", "3"); |
| 132 shouldBe("text1.x.baseVal.getItem(3).value", "4"); |
| 133 shouldBeEqualToString("text1.getAttribute('x')", "1 2 3 4"); |
115 | 134 |
116 shouldBe("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), text1)", "
text1.x.baseVal.getItem(0)"); | 135 shouldBe("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), text1)", "
text1.x.baseVal.getItem(0)"); |
117 shouldBe("text1.x.baseVal.numberOfItems", "1"); | 136 shouldBe("text1.x.baseVal.numberOfItems", "4"); |
118 shouldBeEqualToString("text1.getAttribute('x')", "1"); | 137 shouldBeEqualToString("text1.getAttribute('x')", "1 2 3 4"); |
119 | |
120 shouldThrow("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), null)")
; | |
121 shouldBe("text1.x.baseVal.numberOfItems", "0"); | |
122 shouldBeEqualToString("text1.getAttribute('x')", ""); | |
123 | 138 |
124 debug(""); | 139 debug(""); |
125 debug("Set x='1 2 3 4' for text1"); | 140 debug("Set x='1 2 3 4' for text1"); |
126 shouldBeUndefined("text1.setAttribute('x', '1 2 3 4')"); | 141 shouldBeUndefined("text1.setAttribute('x', '1 2 3 4')"); |
127 | 142 |
| 143 debug(""); |
| 144 debug("Test edge cases for replaceItem()"); |
| 145 shouldBe("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(3), 3)", "text
1.x.baseVal.getItem(3)"); |
| 146 shouldBe("text1.x.baseVal.numberOfItems", "4"); |
| 147 shouldBeEqualToString("text1.getAttribute('x')", "1 2 3 4"); |
| 148 shouldBe("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(1), 3)", "text
1.x.baseVal.getItem(2)"); |
| 149 shouldBe("text1.x.baseVal.numberOfItems", "3"); |
| 150 shouldBeEqualToString("text1.getAttribute('x')", "1 3 2"); |
| 151 shouldThrow("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(3), 4)"); |
| 152 |
| 153 debug(""); |
| 154 debug("Set x='1 2 3 4' for text1"); |
| 155 shouldBeUndefined("text1.setAttribute('x', '1 2 3 4')"); |
| 156 |
128 debug(""); | 157 debug(""); |
129 debug("Test uncommon arguments for removeItem()"); | 158 debug("Test uncommon arguments for removeItem()"); |
130 shouldThrow("text1.x.baseVal.removeItem(30)"); | 159 shouldThrow("text1.x.baseVal.removeItem(30)"); |
131 | 160 |
132 shouldBe("text1.x.baseVal.removeItem(0).value", "1"); | 161 shouldBe("text1.x.baseVal.removeItem(0).value", "1"); |
133 shouldBe("text1.x.baseVal.numberOfItems", "3"); | 162 shouldBe("text1.x.baseVal.numberOfItems", "3"); |
134 shouldBe("text1.x.baseVal.getItem(0).value", "2"); | 163 shouldBe("text1.x.baseVal.getItem(0).value", "2"); |
135 shouldBe("text1.x.baseVal.getItem(1).value", "3"); | 164 shouldBe("text1.x.baseVal.getItem(1).value", "3"); |
136 shouldBe("text1.x.baseVal.getItem(2).value", "4"); | 165 shouldBe("text1.x.baseVal.getItem(2).value", "4"); |
137 shouldBeEqualToString("text1.getAttribute('x')", "2 3 4"); | 166 shouldBeEqualToString("text1.getAttribute('x')", "2 3 4"); |
(...skipping 14 matching lines...) Expand all Loading... |
152 debug(""); | 181 debug(""); |
153 debug("Testing animVal clear throws"); | 182 debug("Testing animVal clear throws"); |
154 shouldThrow("text1.x.animVal.clear()"); | 183 shouldThrow("text1.x.animVal.clear()"); |
155 shouldBeUndefined("text1.x.baseVal.clear()"); | 184 shouldBeUndefined("text1.x.baseVal.clear()"); |
156 | 185 |
157 ]]> | 186 ]]> |
158 </script> | 187 </script> |
159 <script src="../../fast/js/resources/js-test-post.js"></script> | 188 <script src="../../fast/js/resources/js-test-post.js"></script> |
160 </body> | 189 </body> |
161 </html> | 190 </html> |
OLD | NEW |