blob: 4c3e93a17f440ce0cbfb9ca7fd14045f6d831e1c [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="resources/SVGTestCase.js"></script>
<script src="../../resources/js-test-pre.js"></script>
<script src="../../fast/repaint/resources/repaint.js"></script>
</head>
<body onload="runRepaintTest()">
<h1>SVG 1.1 dynamic update tests</h1>
<p id="description"></p>
<div id="console"></div>
<script>
// [Name] SVGFEDiffuseLightingElement-inherit-lighting-color-css-prop.js
// [Expected rendering result] A shining circle (performed by diffuse lighting) - and a series of PASS messages
description("Tests dynamic updates of the inherited 'lighting-color' css property of the SVGFEDiffuseLightingElement object");
createSVGTestCase();
var pointLight = createSVGElement("fePointLight");
pointLight.setAttribute("x", "100");
pointLight.setAttribute("y", "180");
pointLight.setAttribute("z", "30");
var blurElement = createSVGElement("feGaussianBlur");
blurElement.setAttribute("in", "SourceGraphic");
blurElement.setAttribute("stdDeviation", "2");
blurElement.setAttribute("result", "blur");
var gradientElement = createSVGElement("feDiffuseLighting");
gradientElement.setAttribute("in", "blur");
gradientElement.setAttribute("surfaceScale", "1");
gradientElement.setAttribute("diffuseConstant", "1");
gradientElement.setAttribute("lighting-color", "inherit");
gradientElement.appendChild(pointLight);
var filterElement = createSVGElement("filter");
filterElement.setAttribute("id", "myFilter");
filterElement.setAttribute("filterUnits", "userSpaceOnUse");
filterElement.setAttribute("x", "0");
filterElement.setAttribute("y", "0");
filterElement.setAttribute("width", "200");
filterElement.setAttribute("height", "200");
filterElement.setAttribute("style", "lighting-color:red");
filterElement.appendChild(blurElement);
filterElement.appendChild(gradientElement);
var defsElement = createSVGElement("defs");
defsElement.appendChild(filterElement);
rootSVGElement.appendChild(defsElement);
var rectElement = createSVGElement("circle");
rectElement.setAttribute("width", 200);
rectElement.setAttribute("height", 200);
rectElement.setAttribute("cx", "100");
rectElement.setAttribute("cy", "60");
rectElement.setAttribute("r", "50");
rectElement.setAttribute("filter", "url(#myFilter)");
rootSVGElement.appendChild(rectElement);
shouldBeEqualToString("document.defaultView.getComputedStyle(gradientElement).getPropertyValue('lighting-color')", "rgb(255, 0, 0)");
function repaintTest() {
gradientElement.style.setProperty("lighting-color", "yellow", "");
shouldBeEqualToString("document.defaultView.getComputedStyle(gradientElement).getPropertyValue('lighting-color')", "rgb(255, 255, 0)");
completeTest();
}
var successfullyParsed = true;
</script>
</body>
</html>