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 src="../../resources/js-test.js"/> | 3 <script src="../../resources/js-test.js"/> |
4 </head> | 4 </head> |
5 <body> | 5 <body> |
6 <svg display="none" xmlns="http://www.w3.org/2000/svg"/> | 6 <svg display="none" xmlns="http://www.w3.org/2000/svg"/> |
7 <p id="description"></p> | 7 <p id="description"></p> |
8 <div id="console"/> | 8 <div id="console"/> |
9 <script><![CDATA[ | 9 <script><![CDATA[ |
10 SVG_NS = 'http://www.w3.org/2000/svg'; | 10 SVG_NS = 'http://www.w3.org/2000/svg'; |
11 var color1, color2; | 11 var computedStyleText, computedStyleDiv; |
12 var systemColorRed, systemColorGreen, systemColorBlue; | |
13 function checkSystemColor(id1, id2, systemColor) | 12 function checkSystemColor(id1, id2, systemColor) |
14 { | 13 { |
15 var textElement = document.getElementById(id1); | 14 var textElement = document.getElementById(id1); |
16 var computedStyleText = textElement.ownerDocument.defaultView.getComputedSty
le(textElement); | 15 computedStyleText = textElement.ownerDocument.defaultView.getComputedStyle(t
extElement); |
17 var divElement = document.getElementById(id2); | 16 var divElement = document.getElementById(id2); |
18 var computedStyleDiv = divElement.ownerDocument.defaultView.getComputedStyle
(divElement); | 17 computedStyleDiv = divElement.ownerDocument.defaultView.getComputedStyle(div
Element); |
19 | |
20 color1 = computedStyleText.getPropertyValue('fill'); | |
21 var re = new RegExp("rgba?\\(([^, ]*), ([^, ]*), ([^, ]*)(?:, )?([^, ]*)\\)"
); | |
22 color1Components = re.exec(color1); | |
23 | |
24 color2 = computedStyleDiv.getPropertyCSSValue('color').getRGBColorValue(); | |
25 | |
26 systemColorRed = color2.red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER); | |
27 systemColorGreen = color2.green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER); | |
28 systemColorBlue = color2.blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER); | |
29 | 18 |
30 debug('Testing system color' + systemColor); | 19 debug('Testing system color' + systemColor); |
31 | 20 shouldBe("computedStyleText.fill", "computedStyleDiv.color"); |
32 shouldBe("parseInt(color1Components[1])", "systemColorRed"); | 21 shouldBe("computedStyleText.stroke", "computedStyleDiv.color"); |
33 shouldBe("parseInt(color1Components[2])", "systemColorGreen"); | |
34 shouldBe("parseInt(color1Components[3])", "systemColorBlue"); | |
35 | |
36 color1 = computedStyleText.getPropertyValue('stroke'); | |
37 color1Components = re.exec(color1); | |
38 | |
39 shouldBe("parseInt(color1Components[1])", "systemColorRed"); | |
40 shouldBe("parseInt(color1Components[2])", "systemColorGreen"); | |
41 shouldBe("parseInt(color1Components[3])", "systemColorBlue"); | |
42 } | 22 } |
43 | 23 |
44 description('Test that fill and stroke properties accept system colors'); | 24 description('Test that fill and stroke properties accept system colors'); |
45 debug(''); | 25 debug(''); |
46 | 26 |
47 var systemColors = new Array("ActiveBorder", "ActiveCaption", "AppWorkspace", "B
ackground", "ButtonFace", "ButtonHighlight", | 27 var systemColors = new Array("ActiveBorder", "ActiveCaption", "AppWorkspace", "B
ackground", "ButtonFace", "ButtonHighlight", |
48 "ButtonShadow", "ButtonText", "CaptionText", "GrayT
ext", "Highlight", "HighlightText", | 28 "ButtonShadow", "ButtonText", "CaptionText", "GrayT
ext", "Highlight", "HighlightText", |
49 "InactiveBorder", "InactiveCaption", "InactiveCapti
onText", "InfoBackground", "InfoText", | 29 "InactiveBorder", "InactiveCaption", "InactiveCapti
onText", "InfoBackground", "InfoText", |
50 "Menu", "MenuText", "Scrollbar", "ThreeDDarkShadow"
, "ThreeDFace", "ThreeDHighlight", | 30 "Menu", "MenuText", "Scrollbar", "ThreeDDarkShadow"
, "ThreeDFace", "ThreeDHighlight", |
51 "ThreeDLightShadow", "ThreeDShadow", "Window", "Win
dowFrame", "WindowText"); | 31 "ThreeDLightShadow", "ThreeDShadow", "Window", "Win
dowFrame", "WindowText"); |
(...skipping 11 matching lines...) Expand all Loading... |
63 document.body.appendChild(divElement); | 43 document.body.appendChild(divElement); |
64 | 44 |
65 checkSystemColor('text' + i, 'expected' + i, systemColors[i]); | 45 checkSystemColor('text' + i, 'expected' + i, systemColors[i]); |
66 } | 46 } |
67 | 47 |
68 ]]> | 48 ]]> |
69 </script> | 49 </script> |
70 | 50 |
71 </body> | 51 </body> |
72 </html> | 52 </html> |
OLD | NEW |