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

Side by Side Diff: LayoutTests/svg/dom/SVGLengthList-removeItem.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 50 100 900 1000" y="50">ABC</text> 8 <text id="text" x="500 50 100 900 150" y="50">ABC</text>
9 <text id="text2" x="50 100 1000" y="100">ABC</text> 9 <text id="reference" x="50 100 150" y="100">ABC</text>
10 <text id="reference" x="50 100 150" y="150">ABC</text>
11 </svg> 10 </svg>
12 11
13 <p id="description"></p> 12 <p id="description"></p>
14 <div id="console"></div> 13 <div id="console"></div>
15 <script type="text/javascript"> 14 <script type="text/javascript">
16 <![CDATA[ 15 <![CDATA[
17 description("This is a test of the SVGLengthList::appendItem() API."); 16 description("This is a test of the SVGLengthList::removeItem() API.");
18 17
19 var svg = document.getElementById("svg"); 18 var svg = document.getElementById("svg");
20 var text1 = document.getElementById("text1"); 19 var text = document.getElementById("text");
21 var text2 = document.getElementById("text2"); 20
21 debug("");
22 debug("Check initial list state of text1");
23 shouldBe("text.x.baseVal.numberOfItems", "5");
24 shouldBe("text.x.baseVal.getItem(0).value", "500");
25 shouldBe("text.x.baseVal.getItem(1).value", "50");
26 shouldBe("text.x.baseVal.getItem(2).value", "100");
27 shouldBe("text.x.baseVal.getItem(3).value", "900");
28 shouldBe("text.x.baseVal.getItem(4).value", "150");
29 shouldThrow("text.x.baseVal.getItem(5)");
22 30
23 debug(""); 31 debug("");
24 debug("Create a new SVGLength object, with value=150"); 32 debug("Remove fourth item of text1");
25 var newLength1 = svg.createSVGLength(); 33 shouldBe("text.x.baseVal.removeItem(0).value", "500");
26 newLength1.value = 150; 34
27 shouldBe("newLength1.value", "150"); 35 debug("");
36 debug("Remove third item of text1");
37 shouldBe("text.x.baseVal.removeItem(2).value", "900");
28 38
29 debug(""); 39 debug("");
30 debug("Check initial list state of text1"); 40 debug("The test passes if you only see 'PASS' messages, and both text elemen ts on top look the same");
31 shouldBe("text1.x.baseVal.numberOfItems", "5");
32 shouldBe("text1.x.baseVal.getItem(0).value", "500");
33 shouldBe("text1.x.baseVal.getItem(1).value", "50");
34 shouldBe("text1.x.baseVal.getItem(2).value", "100");
35 shouldBe("text1.x.baseVal.getItem(3).value", "900");
36 shouldBe("text1.x.baseVal.getItem(4).value", "1000");
37 shouldThrow("text1.x.baseVal.getItem(5)");
38
39 debug("");
40 debug("Check initial list state of text2");
41 shouldBe("text2.x.baseVal.numberOfItems", "3");
42 shouldBe("text2.x.baseVal.getItem(0).value", "50");
43 shouldBe("text2.x.baseVal.getItem(1).value", "100");
44 shouldBe("text2.x.baseVal.getItem(2).value", "1000");
45 shouldThrow("text2.x.baseVal.getItem(3)");
46
47 debug("");
48 debug("Append fourth item x=900 to the text1 x list");
49 shouldBe("text1.x.baseVal.appendItem(text1.x.baseVal.getItem(3))", "text1.x. baseVal.getItem(4)");
50 shouldBe("text1.x.baseVal.numberOfItems", "5");
51 shouldBe("text1.x.baseVal.getItem(0).value", "500");
52 shouldBe("text1.x.baseVal.getItem(1).value", "50");
53 shouldBe("text1.x.baseVal.getItem(2).value", "100");
54 shouldBe("text1.x.baseVal.getItem(3).value", "1000");
55 shouldBe("text1.x.baseVal.getItem(4).value", "900");
56 shouldThrow("text1.x.baseVal.getItem(5)");
57
58 debug("");
59 debug("Append first item x=500 to the text1 x list");
60 shouldBe("text1.x.baseVal.appendItem(text1.x.baseVal.getItem(0))", "text1.x. baseVal.getItem(4)");
61 shouldBe("text1.x.baseVal.numberOfItems", "5");
62 shouldBe("text1.x.baseVal.getItem(0).value", "50");
63 shouldBe("text1.x.baseVal.getItem(1).value", "100");
64 shouldBe("text1.x.baseVal.getItem(2).value", "1000");
65 shouldBe("text1.x.baseVal.getItem(3).value", "900");
66 shouldBe("text1.x.baseVal.getItem(4).value", "500");
67 shouldThrow("text1.x.baseVal.getItem(5)");
68
69 debug("");
70 debug("Append 'newLength1' to the text1 x list");
71 shouldBe("text1.x.baseVal.appendItem(newLength1)", "text1.x.baseVal.getItem( 5)");
72 shouldBe("text1.x.baseVal.numberOfItems", "6");
73 shouldBe("text1.x.baseVal.getItem(0).value", "50");
74 shouldBe("text1.x.baseVal.getItem(1).value", "100");
75 shouldBe("text1.x.baseVal.getItem(2).value", "1000");
76 shouldBe("text1.x.baseVal.getItem(3).value", "900");
77 shouldBe("text1.x.baseVal.getItem(4).value", "500");
78 shouldBe("text1.x.baseVal.getItem(5).value", "150");
79 shouldThrow("text1.x.baseVal.getItem(6)");
80
81 debug("");
82 debug("Append third and fourth item of the text1 x list to the text2 x list" );
83 shouldBe("text2.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value", "10 00");
84 shouldBe("text2.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value", "90 0");
85 shouldBe("text1.x.baseVal.numberOfItems", "4");
86 shouldBe("text1.x.baseVal.getItem(0).value", "50");
87 shouldBe("text1.x.baseVal.getItem(1).value", "100");
88 shouldBe("text1.x.baseVal.getItem(2).value", "500");
89 shouldBe("text1.x.baseVal.getItem(3).value", "150");
90 shouldThrow("text1.x.baseVal.getItem(4)");
91 shouldBe("text2.x.baseVal.numberOfItems", "5");
92 shouldBe("text2.x.baseVal.getItem(0).value", "50");
93 shouldBe("text2.x.baseVal.getItem(1).value", "100");
94 shouldBe("text2.x.baseVal.getItem(2).value", "1000");
95 shouldBe("text2.x.baseVal.getItem(3).value", "1000");
96 shouldBe("text2.x.baseVal.getItem(4).value", "900");
97 shouldThrow("text2.x.baseVal.getItem(5)");
98
99 var newLength2 = svg.createSVGLength();
100 newLength2.value = 150;
101 shouldBe("newLength2.value", "150");
102
103 debug("");
104 debug("Shuffle around items in text1 and text2 list using appendItem, to get x=50,100,150,... in both lists");
105 shouldBe("text1.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value", "50 0");
106 shouldBe("text2.x.baseVal.appendItem(newLength2).value", "150");
107 shouldBe("text2.x.baseVal.appendItem(text2.x.baseVal.getItem(2)).value", "10 00");
108 shouldBe("text2.x.baseVal.appendItem(text2.x.baseVal.getItem(3)).value", "90 0");
109 shouldBe("text2.x.baseVal.appendItem(text2.x.baseVal.getItem(2)).value", "10 00");
110 shouldBe("text1.x.baseVal.numberOfItems", "4");
111 shouldBe("text1.x.baseVal.getItem(0).value", "50");
112 shouldBe("text1.x.baseVal.getItem(1).value", "100");
113 shouldBe("text1.x.baseVal.getItem(2).value", "150");
114 shouldBe("text1.x.baseVal.getItem(3).value", "500");
115 shouldThrow("text1.x.baseVal.getItem(4)");
116 shouldBe("text2.x.baseVal.numberOfItems", "6");
117 shouldBe("text2.x.baseVal.getItem(0).value", "50");
118 shouldBe("text2.x.baseVal.getItem(1).value", "100");
119 shouldBe("text2.x.baseVal.getItem(2).value", "150");
120 shouldBe("text2.x.baseVal.getItem(3).value", "1000");
121 shouldBe("text2.x.baseVal.getItem(4).value", "900");
122 shouldBe("text2.x.baseVal.getItem(5).value", "1000");
123 shouldThrow("text2.x.baseVal.getItem(6)");
124
125 debug("");
126 debug("The test passes if you only see 'PASS' messages, and all three text e lements on top look the same");
127 debug(""); 41 debug("");
128 42
129 ]]> 43 ]]>
130 </script> 44 </script>
131 </body> 45 </body>
132 </html> 46 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698