OLD | NEW |
1 if (window.testRunner) | 1 if (window.testRunner) |
2 testRunner.dumpAsText(); | 2 testRunner.dumpAsText(); |
3 | 3 |
4 description("Test strict color parsing on SVG presentation attributes.") | 4 description("Test strict color parsing on SVG presentation attributes.") |
5 createSVGTestCase(); | 5 createSVGTestCase(); |
6 | 6 |
7 var rect = createSVGElement("rect"); | 7 var rect = createSVGElement("rect"); |
8 rect.setAttribute("id", "rect"); | 8 rect.setAttribute("id", "rect"); |
9 rect.setAttribute("width", "100px"); | 9 rect.setAttribute("width", "100px"); |
10 rect.setAttribute("height", "100px"); | 10 rect.setAttribute("height", "100px"); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 rect.setAttribute("fill", "green"); | 44 rect.setAttribute("fill", "green"); |
45 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).fill",
"rgb(0, 128, 0)"); | 45 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).fill",
"rgb(0, 128, 0)"); |
46 | 46 |
47 rect.setAttribute("fill", ""); | 47 rect.setAttribute("fill", ""); |
48 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).fill",
"rgb(0, 0, 0)"); | 48 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).fill",
"rgb(0, 0, 0)"); |
49 // Reset to green. | 49 // Reset to green. |
50 rect.setAttribute("fill", "green"); | 50 rect.setAttribute("fill", "green"); |
51 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).fill",
"rgb(0, 128, 0)"); | 51 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).fill",
"rgb(0, 128, 0)"); |
52 | 52 |
53 rect.setAttribute("fill", "url(#reference)"); | 53 rect.setAttribute("fill", "url(#reference)"); |
54 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).fill",
"url(#reference)"); | 54 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).fill",
'url("#reference")'); |
55 // Reset to green. | 55 // Reset to green. |
56 rect.setAttribute("fill", "green"); | 56 rect.setAttribute("fill", "green"); |
57 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).fill",
"rgb(0, 128, 0)"); | 57 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).fill",
"rgb(0, 128, 0)"); |
58 | 58 |
59 rect.setAttribute("fill", "url(#reference) green"); | 59 rect.setAttribute("fill", "url(#reference) green"); |
60 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).fill",
"url(#reference) rgb(0, 128, 0)"); | 60 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).fill",
'url("#reference") rgb(0, 128, 0)'); |
61 // Reset to green. | 61 // Reset to green. |
62 rect.setAttribute("fill", "green"); | 62 rect.setAttribute("fill", "green"); |
63 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).fill",
"rgb(0, 128, 0)"); | 63 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).fill",
"rgb(0, 128, 0)"); |
64 | 64 |
65 | 65 |
66 // Testing 'stroke' | 66 // Testing 'stroke' |
67 // The default stroke value should be 'none'. | 67 // The default stroke value should be 'none'. |
68 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).stroke"
, "none"); | 68 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).stroke"
, "none"); |
69 | 69 |
70 // Set the stroke color to green. | 70 // Set the stroke color to green. |
(...skipping 25 matching lines...) Expand all Loading... |
96 rect.setAttribute("stroke", "green"); | 96 rect.setAttribute("stroke", "green"); |
97 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).stroke"
, "rgb(0, 128, 0)"); | 97 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).stroke"
, "rgb(0, 128, 0)"); |
98 | 98 |
99 rect.setAttribute("stroke", ""); | 99 rect.setAttribute("stroke", ""); |
100 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).stroke"
, "none"); | 100 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).stroke"
, "none"); |
101 // Reset to green. | 101 // Reset to green. |
102 rect.setAttribute("stroke", "green"); | 102 rect.setAttribute("stroke", "green"); |
103 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).stroke"
, "rgb(0, 128, 0)"); | 103 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).stroke"
, "rgb(0, 128, 0)"); |
104 | 104 |
105 rect.setAttribute("stroke", "url(#reference)"); | 105 rect.setAttribute("stroke", "url(#reference)"); |
106 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).stroke"
, "url(#reference)"); | 106 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).stroke"
, 'url("#reference")'); |
107 // Reset to green. | 107 // Reset to green. |
108 rect.setAttribute("stroke", "green"); | 108 rect.setAttribute("stroke", "green"); |
109 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).stroke"
, "rgb(0, 128, 0)"); | 109 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).stroke"
, "rgb(0, 128, 0)"); |
110 | 110 |
111 rect.setAttribute("stroke", "url(#reference) green"); | 111 rect.setAttribute("stroke", "url(#reference) green"); |
112 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).stroke"
, "url(#reference) rgb(0, 128, 0)"); | 112 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).stroke"
, 'url("#reference") rgb(0, 128, 0)'); |
113 // Reset to green. | 113 // Reset to green. |
114 rect.setAttribute("stroke", "green"); | 114 rect.setAttribute("stroke", "green"); |
115 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).stroke"
, "rgb(0, 128, 0)"); | 115 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).stroke"
, "rgb(0, 128, 0)"); |
116 | 116 |
117 | 117 |
118 // Testing 'color' | 118 // Testing 'color' |
119 // The default for color is rgb(0, 0, 0). | 119 // The default for color is rgb(0, 0, 0). |
120 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).color",
"rgb(0, 0, 0)"); | 120 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).color",
"rgb(0, 0, 0)"); |
121 | 121 |
122 // Set color to green. | 122 // Set color to green. |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 | 230 |
231 rect.setAttribute("flood-color", ""); | 231 rect.setAttribute("flood-color", ""); |
232 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).floodCo
lor", "rgb(0, 0, 0)"); | 232 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).floodCo
lor", "rgb(0, 0, 0)"); |
233 // Reset to green. | 233 // Reset to green. |
234 rect.setAttribute("flood-color", "green"); | 234 rect.setAttribute("flood-color", "green"); |
235 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).floodCo
lor", "rgb(0, 128, 0)"); | 235 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).floodCo
lor", "rgb(0, 128, 0)"); |
236 | 236 |
237 var successfullyParsed = true; | 237 var successfullyParsed = true; |
238 | 238 |
239 completeTest(); | 239 completeTest(); |
OLD | NEW |