Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(450)

Side by Side Diff: LayoutTests/svg/dom/SVGLengthList-replaceItem.xhtml

Issue 1177303004: Updated SVGListPropertyHelper as per SVG2 Spec (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fixed presubmit error Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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="../../resources/js-test.js"></script> 4 <script src="../../resources/js-test.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 <text id="text2" x="500 100 50 150" y="75"> ABC </text> 9 <text id="text2" x="500 100 150 50" y="75"> ABC </text>
10 <text id="text3" x="50 50 100 100 150" y="100"> ABC</text> 10 <text id="text3" x="50 50 100 100 150" y="100"> ABC</text>
11 <text id="text4" x="100 50 150 150" y="125"> ABC</text> 11 <text id="text4" x="100 50 150 150" y="125"> ABC</text>
12 <text id="reference" x="50 100 150" y="150">ABC </text> 12 <text id="reference" x="50 100 150" y="150">ABC </text>
13 </svg> 13 </svg>
14 14
15 <p id="description"></p> 15 <p id="description"></p>
16 <div id="console"></div> 16 <div id="console"></div>
17 <script type="text/javascript"> 17 <script type="text/javascript">
18 <![CDATA[ 18 <![CDATA[
19 description("This is a test of the SVGLengthList::replaceItem() API."); 19 description("This is a test of the SVGLengthList::replaceItem() API.");
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 shouldBe("text1.x.baseVal.numberOfItems", "3"); 61 shouldBe("text1.x.baseVal.numberOfItems", "3");
62 shouldBe("text1.x.baseVal.getItem(0).value", "50"); 62 shouldBe("text1.x.baseVal.getItem(0).value", "50");
63 shouldBe("text1.x.baseVal.getItem(1).value", "100"); 63 shouldBe("text1.x.baseVal.getItem(1).value", "100");
64 shouldBe("text1.x.baseVal.getItem(2).value", "150"); 64 shouldBe("text1.x.baseVal.getItem(2).value", "150");
65 65
66 debug(""); 66 debug("");
67 debug("Check initial list state of text2"); 67 debug("Check initial list state of text2");
68 shouldBe("text2.x.baseVal.numberOfItems", "4"); 68 shouldBe("text2.x.baseVal.numberOfItems", "4");
69 shouldBe("text2.x.baseVal.getItem(0).value", "500"); 69 shouldBe("text2.x.baseVal.getItem(0).value", "500");
70 shouldBe("text2.x.baseVal.getItem(1).value", "100"); 70 shouldBe("text2.x.baseVal.getItem(1).value", "100");
71 shouldBe("text2.x.baseVal.getItem(2).value", "50"); 71 shouldBe("text2.x.baseVal.getItem(2).value", "150");
72 shouldBe("text2.x.baseVal.getItem(3).value", "150"); 72 shouldBe("text2.x.baseVal.getItem(3).value", "50");
73 shouldThrow("text2.x.baseVal.getItem(4)"); 73 shouldThrow("text2.x.baseVal.getItem(4)");
74 74
75 // Spec: If newItem is already in a list, then a new object is created with the same values as newItem and this item is inserted into the list.
76 // Otherwise, newItem itself is inserted into the list.
75 debug(""); 77 debug("");
76 debug("Replace the first item in text2 x list with the third item in the lis t"); 78 debug("Replace the first item in text2 x list with the fourth item in the li st");
77 shouldBe("text2.x.baseVal.replaceItem(text2.x.baseVal.getItem(2), 0).value", "50"); 79 shouldBe("text2.x.baseVal.replaceItem(text2.x.baseVal.getItem(3), 0).value", "50");
78 shouldBe("text2.x.baseVal.numberOfItems", "3"); 80 shouldBe("text2.x.baseVal.numberOfItems", "4");
79 shouldBe("text2.x.baseVal.getItem(0).value", "50"); 81 shouldBe("text2.x.baseVal.getItem(0).value", "50");
80 shouldBe("text2.x.baseVal.getItem(1).value", "100"); 82 shouldBe("text2.x.baseVal.getItem(1).value", "100");
81 shouldBe("text2.x.baseVal.getItem(2).value", "150"); 83 shouldBe("text2.x.baseVal.getItem(2).value", "150");
84 shouldBe("text2.x.baseVal.getItem(3).value", "50");
82 85
83 debug(""); 86 debug("");
84 debug("Check initial list state of text3"); 87 debug("Check initial list state of text3");
85 shouldBe("text3.x.baseVal.numberOfItems", "5"); 88 shouldBe("text3.x.baseVal.numberOfItems", "5");
86 shouldBe("text3.x.baseVal.getItem(0).value", "50"); 89 shouldBe("text3.x.baseVal.getItem(0).value", "50");
87 shouldBe("text3.x.baseVal.getItem(1).value", "50"); 90 shouldBe("text3.x.baseVal.getItem(1).value", "50");
88 shouldBe("text3.x.baseVal.getItem(2).value", "100"); 91 shouldBe("text3.x.baseVal.getItem(2).value", "100");
89 shouldBe("text3.x.baseVal.getItem(3).value", "100"); 92 shouldBe("text3.x.baseVal.getItem(3).value", "100");
90 shouldBe("text3.x.baseVal.getItem(4).value", "150"); 93 shouldBe("text3.x.baseVal.getItem(4).value", "150");
91 shouldThrow("text3.x.baseVal.getItem(5)"); 94 shouldThrow("text3.x.baseVal.getItem(5)");
92 95
93 debug(""); 96 debug("");
94 debug("Check initial list state of text4"); 97 debug("Check initial list state of text4");
95 shouldBe("text4.x.baseVal.numberOfItems", "4"); 98 shouldBe("text4.x.baseVal.numberOfItems", "4");
96 shouldBe("text4.x.baseVal.getItem(0).value", "100"); 99 shouldBe("text4.x.baseVal.getItem(0).value", "100");
97 shouldBe("text4.x.baseVal.getItem(1).value", "50"); 100 shouldBe("text4.x.baseVal.getItem(1).value", "50");
98 shouldBe("text4.x.baseVal.getItem(2).value", "150"); 101 shouldBe("text4.x.baseVal.getItem(2).value", "150");
99 shouldBe("text4.x.baseVal.getItem(3).value", "150"); 102 shouldBe("text4.x.baseVal.getItem(3).value", "150");
100 shouldThrow("text4.x.baseVal.getItem(4)"); 103 shouldThrow("text4.x.baseVal.getItem(4)");
101 104
102 debug(""); 105 debug("");
103 debug("Replace the first item in text4 x list with the second item in the te xt3 x list"); 106 debug("Replace the first item in text4 x list with the second item in the te xt3 x list");
104 shouldBe("text4.x.baseVal.replaceItem(text3.x.baseVal.getItem(1), 0).value", "50"); 107 shouldBe("text4.x.baseVal.replaceItem(text3.x.baseVal.getItem(1), 0).value", "50");
105 shouldBe("text3.x.baseVal.numberOfItems", "4"); 108 shouldBe("text3.x.baseVal.numberOfItems", "5");
106 shouldBe("text3.x.baseVal.getItem(0).value", "50"); 109 shouldBe("text3.x.baseVal.getItem(0).value", "50");
107 shouldBe("text3.x.baseVal.getItem(1).value", "100"); 110 shouldBe("text3.x.baseVal.getItem(1).value", "50");
108 shouldBe("text3.x.baseVal.getItem(2).value", "100"); 111 shouldBe("text3.x.baseVal.getItem(2).value", "100");
109 shouldBe("text3.x.baseVal.getItem(3).value", "150"); 112 shouldBe("text3.x.baseVal.getItem(3).value", "100");
110 shouldThrow("text3.x.baseVal.getItem(4)"); 113 shouldBe("text3.x.baseVal.getItem(4).value", "150");
114 shouldThrow("text3.x.baseVal.getItem(5)");
111 shouldBe("text4.x.baseVal.numberOfItems", "4"); 115 shouldBe("text4.x.baseVal.numberOfItems", "4");
112 shouldBe("text4.x.baseVal.getItem(0).value", "50"); 116 shouldBe("text4.x.baseVal.getItem(0).value", "50");
113 shouldBe("text4.x.baseVal.getItem(1).value", "50"); 117 shouldBe("text4.x.baseVal.getItem(1).value", "50");
114 shouldBe("text4.x.baseVal.getItem(2).value", "150"); 118 shouldBe("text4.x.baseVal.getItem(2).value", "150");
115 shouldBe("text4.x.baseVal.getItem(3).value", "150"); 119 shouldBe("text4.x.baseVal.getItem(3).value", "150");
116 shouldThrow("text4.x.baseVal.getItem(4)"); 120 shouldThrow("text4.x.baseVal.getItem(4)");
117 121
118 debug(""); 122 debug("");
119 debug("Replace the second item in text4 x list with the second item in the t ext4 x list"); 123 debug("Replace the second item in text4 x list with the second item in the t ext4 x list");
120 shouldBe("text4.x.baseVal.replaceItem(text3.x.baseVal.getItem(2), 1).value", "100"); 124 shouldBe("text4.x.baseVal.replaceItem(text3.x.baseVal.getItem(2), 1).value", "100");
121 shouldBe("text4.x.baseVal.numberOfItems", "4"); 125 shouldBe("text4.x.baseVal.numberOfItems", "4");
122 shouldBe("text4.x.baseVal.getItem(0).value", "50"); 126 shouldBe("text4.x.baseVal.getItem(0).value", "50");
123 shouldBe("text4.x.baseVal.getItem(1).value", "100"); 127 shouldBe("text4.x.baseVal.getItem(1).value", "100");
124 shouldBe("text4.x.baseVal.getItem(2).value", "150"); 128 shouldBe("text4.x.baseVal.getItem(2).value", "150");
125 shouldBe("text4.x.baseVal.getItem(3).value", "150"); 129 shouldBe("text4.x.baseVal.getItem(3).value", "150");
126 shouldThrow("text4.x.baseVal.getItem(4)"); 130 shouldThrow("text4.x.baseVal.getItem(4)");
127 131
128 debug(""); 132 debug("");
133 debug("Replace the items of text3 x list with the same text3 x list");
134 shouldBe("text3.x.baseVal.replaceItem(text3.x.baseVal.getItem(2), 1).value", "100");
135 shouldBe("text3.x.baseVal.replaceItem(text3.x.baseVal.getItem(4), 2).value", "150");
136 shouldBe("text3.x.baseVal.numberOfItems", "5");
137 shouldBe("text3.x.baseVal.getItem(0).value", "50");
138 shouldBe("text3.x.baseVal.getItem(1).value", "100");
139 shouldBe("text3.x.baseVal.getItem(2).value", "150");
140 shouldBe("text3.x.baseVal.getItem(3).value", "100");
141 shouldBe("text3.x.baseVal.getItem(4).value", "150");
142 shouldThrow("text3.x.baseVal.getItem(5)");
143
144 debug("");
129 debug("Check final list state of text1"); 145 debug("Check final list state of text1");
130 shouldBe("text1.x.baseVal.numberOfItems", "3"); 146 shouldBe("text1.x.baseVal.numberOfItems", "3");
131 shouldBe("text1.x.baseVal.getItem(0).value", "50"); 147 shouldBe("text1.x.baseVal.getItem(0).value", "50");
132 shouldBe("text1.x.baseVal.getItem(1).value", "100"); 148 shouldBe("text1.x.baseVal.getItem(1).value", "100");
133 shouldBe("text1.x.baseVal.getItem(2).value", "150"); 149 shouldBe("text1.x.baseVal.getItem(2).value", "150");
134 shouldThrow("text1.x.baseVal.getItem(3)"); 150 shouldThrow("text1.x.baseVal.getItem(3)");
135 151
136 debug(""); 152 debug("");
137 debug("Check final list state of text2"); 153 debug("Check final list state of text2");
138 shouldBe("text2.x.baseVal.numberOfItems", "3"); 154 shouldBe("text2.x.baseVal.numberOfItems", "4");
139 shouldBe("text2.x.baseVal.getItem(0).value", "50"); 155 shouldBe("text2.x.baseVal.getItem(0).value", "50");
140 shouldBe("text2.x.baseVal.getItem(1).value", "100"); 156 shouldBe("text2.x.baseVal.getItem(1).value", "100");
141 shouldBe("text2.x.baseVal.getItem(2).value", "150"); 157 shouldBe("text2.x.baseVal.getItem(2).value", "150");
142 shouldThrow("text2.x.baseVal.getItem(3)"); 158 shouldBe("text2.x.baseVal.getItem(3).value", "50");
159 shouldThrow("text2.x.baseVal.getItem(4)");
143 160
144 debug(""); 161 debug("");
145 debug("Check final list state of text3"); 162 debug("Check final list state of text3");
146 shouldBe("text3.x.baseVal.numberOfItems", "3"); 163 shouldBe("text3.x.baseVal.numberOfItems", "5");
147 shouldBe("text3.x.baseVal.getItem(0).value", "50"); 164 shouldBe("text3.x.baseVal.getItem(0).value", "50");
148 shouldBe("text3.x.baseVal.getItem(1).value", "100"); 165 shouldBe("text3.x.baseVal.getItem(1).value", "100");
149 shouldBe("text3.x.baseVal.getItem(2).value", "150"); 166 shouldBe("text3.x.baseVal.getItem(2).value", "150");
150 shouldThrow("text3.x.baseVal.getItem(3)"); 167 shouldBe("text3.x.baseVal.getItem(3).value", "100");
168 shouldBe("text3.x.baseVal.getItem(4).value", "150");
169 shouldThrow("text3.x.baseVal.getItem(5)");
151 170
152 debug(""); 171 debug("");
153 debug("Check final list state of text4"); 172 debug("Check final list state of text4");
154 shouldBe("text4.x.baseVal.numberOfItems", "4"); 173 shouldBe("text4.x.baseVal.numberOfItems", "4");
155 shouldBe("text4.x.baseVal.getItem(0).value", "50"); 174 shouldBe("text4.x.baseVal.getItem(0).value", "50");
156 shouldBe("text4.x.baseVal.getItem(1).value", "100"); 175 shouldBe("text4.x.baseVal.getItem(1).value", "100");
157 shouldBe("text4.x.baseVal.getItem(2).value", "150"); 176 shouldBe("text4.x.baseVal.getItem(2).value", "150");
158 shouldBe("text4.x.baseVal.getItem(3).value", "150"); 177 shouldBe("text4.x.baseVal.getItem(3).value", "150");
159 shouldThrow("text4.x.baseVal.getItem(4)"); 178 shouldThrow("text4.x.baseVal.getItem(4)");
160 179
161 debug(""); 180 debug("");
162 debug("The test passes if you only see 'PASS' messages, and all five text el ements on top look the same"); 181 debug("The test passes if you only see 'PASS' messages, and all five text el ements on top look the same");
163 debug(""); 182 debug("");
164 183
165 ]]> 184 ]]>
166 </script> 185 </script>
167 </body> 186 </body>
168 </html> 187 </html>
OLDNEW
« no previous file with comments | « LayoutTests/svg/dom/SVGLengthList-removeItem-expected.txt ('k') | LayoutTests/svg/dom/SVGLengthList-replaceItem-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698