blob: a84a9b9f0a62352529b0afde26faddb48d574f3d [file] [log] [blame]
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="../../resources/js-test-pre.js"/>
</head>
<body>
<svg display="none" xmlns="http://www.w3.org/2000/svg"/>
<p id="description"></p>
<div id="console"/>
<script><![CDATA[
SVG_NS = 'http://www.w3.org/2000/svg';
var color1, color2;
var systemColorRed, systemColorGreen, systemColorBlue;
function checkSystemColor(id1, id2, systemColor)
{
var textElement = document.getElementById(id1);
computedStyleText = textElement.ownerDocument.defaultView.getComputedStyle(textElement);
var divElement = document.getElementById(id2);
computedStyleDiv = divElement.ownerDocument.defaultView.getComputedStyle(divElement);
debug('Testing system color' + systemColor);
shouldBe("computedStyleText.fill", "computedStyleDiv.color");
shouldBe("computedStyleText.stroke", "computedStyleDiv.color");
}
description('Test that fill and stroke properties accept system colors');
debug('');
var systemColors = new Array("ActiveBorder", "ActiveCaption", "AppWorkspace", "Background", "ButtonFace", "ButtonHighlight",
"ButtonShadow", "ButtonText", "CaptionText", "GrayText", "Highlight", "HighlightText",
"InactiveBorder", "InactiveCaption", "InactiveCaptionText", "InfoBackground", "InfoText",
"Menu", "MenuText", "Scrollbar", "ThreeDDarkShadow", "ThreeDFace", "ThreeDHighlight",
"ThreeDLightShadow", "ThreeDShadow", "Window", "WindowFrame", "WindowText");
var svgElement = document.getElementsByTagName("svg")[0];
for (i = 0; i < systemColors.length; ++i) {
var textElement = document.createElementNS(SVG_NS, "text");
textElement.setAttribute("id", "text" + i);
textElement.setAttribute("stroke", systemColors[i]);
textElement.setAttribute("style", "fill:" + systemColors[i]);
svgElement.appendChild(textElement);
var divElement = document.createElement("div");
divElement.setAttribute("id", "expected" + i);
divElement.setAttribute("style", "color:" + systemColors[i]);
document.body.appendChild(divElement);
checkSystemColor('text' + i, 'expected' + i, systemColors[i]);
}
]]>
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>