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