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

Side by Side Diff: LayoutTests/svg/dom/SVGLengthList-appendItem.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="text1" x="500 50 100 900 1000" y="50">ABC</text>
9 <text id="text2" x="50 100 1000" y="100">ABC</text> 9 <text id="text2" x="50 100 1000" y="100">ABC</text>
10 <text id="reference" x="50 100 150" y="150">ABC</text> 10 <text id="reference" x="50 100 150" y="150">ABC</text>
(...skipping 28 matching lines...) Expand all
39 debug(""); 39 debug("");
40 debug("Check initial list state of text2"); 40 debug("Check initial list state of text2");
41 shouldBe("text2.x.baseVal.numberOfItems", "3"); 41 shouldBe("text2.x.baseVal.numberOfItems", "3");
42 shouldBe("text2.x.baseVal.getItem(0).value", "50"); 42 shouldBe("text2.x.baseVal.getItem(0).value", "50");
43 shouldBe("text2.x.baseVal.getItem(1).value", "100"); 43 shouldBe("text2.x.baseVal.getItem(1).value", "100");
44 shouldBe("text2.x.baseVal.getItem(2).value", "1000"); 44 shouldBe("text2.x.baseVal.getItem(2).value", "1000");
45 shouldThrow("text2.x.baseVal.getItem(3)"); 45 shouldThrow("text2.x.baseVal.getItem(3)");
46 46
47 debug(""); 47 debug("");
48 debug("Append fourth item x=900 to the text1 x list"); 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)"); 49 shouldBe("text1.x.baseVal.appendItem(text1.x.baseVal.getItem(3))", "text1.x. baseVal.getItem(5)");
50 shouldBe("text1.x.baseVal.numberOfItems", "5"); 50 shouldBe("text1.x.baseVal.numberOfItems", "6");
51 shouldBe("text1.x.baseVal.getItem(0).value", "500"); 51 shouldBe("text1.x.baseVal.getItem(0).value", "500");
52 shouldBe("text1.x.baseVal.getItem(1).value", "50"); 52 shouldBe("text1.x.baseVal.getItem(1).value", "50");
53 shouldBe("text1.x.baseVal.getItem(2).value", "100"); 53 shouldBe("text1.x.baseVal.getItem(2).value", "100");
54 shouldBe("text1.x.baseVal.getItem(3).value", "1000"); 54 shouldBe("text1.x.baseVal.getItem(3).value", "900");
55 shouldBe("text1.x.baseVal.getItem(4).value", "900"); 55 shouldBe("text1.x.baseVal.getItem(4).value", "1000");
56 shouldThrow("text1.x.baseVal.getItem(5)"); 56 shouldBe("text1.x.baseVal.getItem(5).value", "900");
57 shouldThrow("text1.x.baseVal.getItem(6)");
57 58
58 debug(""); 59 debug("");
59 debug("Append first item x=500 to the text1 x list"); 60 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.appendItem(text1.x.baseVal.getItem(0))", "text1.x. baseVal.getItem(6)");
61 shouldBe("text1.x.baseVal.numberOfItems", "5"); 62 shouldBe("text1.x.baseVal.numberOfItems", "7");
62 shouldBe("text1.x.baseVal.getItem(0).value", "50"); 63 shouldBe("text1.x.baseVal.getItem(0).value", "500");
63 shouldBe("text1.x.baseVal.getItem(1).value", "100"); 64 shouldBe("text1.x.baseVal.getItem(1).value", "50");
64 shouldBe("text1.x.baseVal.getItem(2).value", "1000"); 65 shouldBe("text1.x.baseVal.getItem(2).value", "100");
65 shouldBe("text1.x.baseVal.getItem(3).value", "900"); 66 shouldBe("text1.x.baseVal.getItem(3).value", "900");
66 shouldBe("text1.x.baseVal.getItem(4).value", "500"); 67 shouldBe("text1.x.baseVal.getItem(4).value", "1000");
67 shouldThrow("text1.x.baseVal.getItem(5)"); 68 shouldBe("text1.x.baseVal.getItem(5).value", "900");
69 shouldBe("text1.x.baseVal.getItem(6).value", "500");
70 shouldThrow("text1.x.baseVal.getItem(7)");
68 71
69 debug(""); 72 debug("");
70 debug("Append 'newLength1' to the text1 x list"); 73 debug("Append 'newLength1' to the text1 x list");
71 shouldBe("text1.x.baseVal.appendItem(newLength1)", "text1.x.baseVal.getItem( 5)"); 74 shouldBe("text1.x.baseVal.appendItem(newLength1)", "text1.x.baseVal.getItem( 7)");
72 shouldBe("text1.x.baseVal.numberOfItems", "6"); 75 shouldBe("text1.x.baseVal.numberOfItems", "8");
73 shouldBe("text1.x.baseVal.getItem(0).value", "50"); 76 shouldBe("text1.x.baseVal.getItem(0).value", "500");
74 shouldBe("text1.x.baseVal.getItem(1).value", "100"); 77 shouldBe("text1.x.baseVal.getItem(1).value", "50");
75 shouldBe("text1.x.baseVal.getItem(2).value", "1000"); 78 shouldBe("text1.x.baseVal.getItem(2).value", "100");
76 shouldBe("text1.x.baseVal.getItem(3).value", "900"); 79 shouldBe("text1.x.baseVal.getItem(3).value", "900");
77 shouldBe("text1.x.baseVal.getItem(4).value", "500"); 80 shouldBe("text1.x.baseVal.getItem(4).value", "1000");
78 shouldBe("text1.x.baseVal.getItem(5).value", "150"); 81 shouldBe("text1.x.baseVal.getItem(5).value", "900");
79 shouldThrow("text1.x.baseVal.getItem(6)"); 82 shouldBe("text1.x.baseVal.getItem(6).value", "500");
83 shouldBe("text1.x.baseVal.getItem(7).value", "150");
84 shouldThrow("text1.x.baseVal.getItem(8)");
80 85
81 debug(""); 86 debug("");
82 debug("Append third and fourth item of the text1 x list to the text2 x list" ); 87 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"); 88 shouldBe("text2.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value", "10 0");
84 shouldBe("text2.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value", "90 0"); 89 shouldBe("text2.x.baseVal.appendItem(text1.x.baseVal.getItem(3)).value", "90 0");
85 shouldBe("text1.x.baseVal.numberOfItems", "4"); 90 shouldBe("text1.x.baseVal.numberOfItems", "8");
86 shouldBe("text1.x.baseVal.getItem(0).value", "50"); 91 shouldBe("text1.x.baseVal.getItem(0).value", "500");
87 shouldBe("text1.x.baseVal.getItem(1).value", "100"); 92 shouldBe("text1.x.baseVal.getItem(1).value", "50");
88 shouldBe("text1.x.baseVal.getItem(2).value", "500"); 93 shouldBe("text1.x.baseVal.getItem(2).value", "100");
89 shouldBe("text1.x.baseVal.getItem(3).value", "150"); 94 shouldBe("text1.x.baseVal.getItem(3).value", "900");
90 shouldThrow("text1.x.baseVal.getItem(4)"); 95 shouldBe("text1.x.baseVal.getItem(4).value", "1000");
96 shouldBe("text1.x.baseVal.getItem(5).value", "900");
97 shouldBe("text1.x.baseVal.getItem(6).value", "500");
98 shouldBe("text1.x.baseVal.getItem(7).value", "150");
99 shouldThrow("text1.x.baseVal.getItem(8)");
91 shouldBe("text2.x.baseVal.numberOfItems", "5"); 100 shouldBe("text2.x.baseVal.numberOfItems", "5");
92 shouldBe("text2.x.baseVal.getItem(0).value", "50"); 101 shouldBe("text2.x.baseVal.getItem(0).value", "50");
93 shouldBe("text2.x.baseVal.getItem(1).value", "100"); 102 shouldBe("text2.x.baseVal.getItem(1).value", "100");
94 shouldBe("text2.x.baseVal.getItem(2).value", "1000"); 103 shouldBe("text2.x.baseVal.getItem(2).value", "1000");
95 shouldBe("text2.x.baseVal.getItem(3).value", "1000"); 104 shouldBe("text2.x.baseVal.getItem(3).value", "100");
96 shouldBe("text2.x.baseVal.getItem(4).value", "900"); 105 shouldBe("text2.x.baseVal.getItem(4).value", "900");
97 shouldThrow("text2.x.baseVal.getItem(5)"); 106 shouldThrow("text2.x.baseVal.getItem(5)");
98 107
99 var newLength2 = svg.createSVGLength(); 108 var newLength2 = svg.createSVGLength();
100 newLength2.value = 150; 109 newLength2.value = 150;
101 shouldBe("newLength2.value", "150"); 110 shouldBe("newLength2.value", "150");
102 111 shouldBeUndefined("text1.x.baseVal.clear()");
112
103 debug(""); 113 debug("");
104 debug("Shuffle around items in text1 and text2 list using appendItem, to get x=50,100,150,... in both lists"); 114 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"); 115 shouldBe("text1.x.baseVal.appendItem(text2.x.baseVal.getItem(0)).value", "50 ");
106 shouldBe("text2.x.baseVal.appendItem(newLength2).value", "150"); 116 shouldBe("text1.x.baseVal.appendItem(text2.x.baseVal.getItem(1)).value", "10 0");
107 shouldBe("text2.x.baseVal.appendItem(text2.x.baseVal.getItem(2)).value", "10 00"); 117 shouldBe("text1.x.baseVal.appendItem(newLength2).value", "150");
108 shouldBe("text2.x.baseVal.appendItem(text2.x.baseVal.getItem(3)).value", "90 0"); 118 shouldBeUndefined("text2.x.baseVal.clear()");
109 shouldBe("text2.x.baseVal.appendItem(text2.x.baseVal.getItem(2)).value", "10 00"); 119 shouldBe("text2.x.baseVal.appendItem(text1.x.baseVal.getItem(0)).value", "50 ");
110 shouldBe("text1.x.baseVal.numberOfItems", "4"); 120 shouldBe("text2.x.baseVal.appendItem(text1.x.baseVal.getItem(1)).value", "10 0");
121 shouldBe("text2.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value", "15 0");
122 shouldBe("text1.x.baseVal.numberOfItems", "3");
111 shouldBe("text1.x.baseVal.getItem(0).value", "50"); 123 shouldBe("text1.x.baseVal.getItem(0).value", "50");
112 shouldBe("text1.x.baseVal.getItem(1).value", "100"); 124 shouldBe("text1.x.baseVal.getItem(1).value", "100");
113 shouldBe("text1.x.baseVal.getItem(2).value", "150"); 125 shouldBe("text1.x.baseVal.getItem(2).value", "150");
114 shouldBe("text1.x.baseVal.getItem(3).value", "500");
115 shouldThrow("text1.x.baseVal.getItem(4)"); 126 shouldThrow("text1.x.baseVal.getItem(4)");
116 shouldBe("text2.x.baseVal.numberOfItems", "6"); 127 shouldBe("text2.x.baseVal.numberOfItems", "3");
117 shouldBe("text2.x.baseVal.getItem(0).value", "50"); 128 shouldBe("text2.x.baseVal.getItem(0).value", "50");
118 shouldBe("text2.x.baseVal.getItem(1).value", "100"); 129 shouldBe("text2.x.baseVal.getItem(1).value", "100");
119 shouldBe("text2.x.baseVal.getItem(2).value", "150"); 130 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)"); 131 shouldThrow("text2.x.baseVal.getItem(6)");
124 132
125 debug(""); 133 debug("");
126 debug("The test passes if you only see 'PASS' messages, and all three text e lements on top look the same"); 134 debug("The test passes if you only see 'PASS' messages, and all three text e lements on top look the same");
127 debug(""); 135 debug("");
128 136
129 ]]> 137 ]]>
130 </script> 138 </script>
131 </body> 139 </body>
132 </html> 140 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698