blob: 29c49154cf5453ada497264bfe49d23270fd966c [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] SVGLinearGradientElement-dom-x2-attr.js
// [Expected rendering result] green ellipse, no red visible - and a series of PASS messages
description("Tests dynamic updates of the 'x2' attribute of the SVGLinearGradientElement object")
createSVGTestCase();
var ellipseElement = createSVGElement("ellipse");
ellipseElement.setAttribute("cx", "150");
ellipseElement.setAttribute("cy", "150");
ellipseElement.setAttribute("rx", "100");
ellipseElement.setAttribute("ry", "150");
ellipseElement.setAttribute("fill", "url(#gradient)");
var defsElement = createSVGElement("defs");
rootSVGElement.appendChild(defsElement);
var linearGradientElement = createSVGElement("linearGradient");
linearGradientElement.setAttribute("id", "gradient");
linearGradientElement.setAttribute("x1", "200%");
linearGradientElement.setAttribute("x2", "-100%");
var firstStopElement = createSVGElement("stop");
firstStopElement.setAttribute("offset", "0");
firstStopElement.setAttribute("stop-color", "red");
linearGradientElement.appendChild(firstStopElement);
var lastStopElement = createSVGElement("stop");
lastStopElement.setAttribute("offset", "1");
lastStopElement.setAttribute("stop-color", "green");
linearGradientElement.appendChild(lastStopElement);
defsElement.appendChild(linearGradientElement);
rootSVGElement.appendChild(ellipseElement);
shouldBeEqualToString("linearGradientElement.getAttribute('x2')", "-100%");
function repaintTest() {
linearGradientElement.setAttribute("x2", "100%");
shouldBeEqualToString("linearGradientElement.getAttribute('x2')", "100%");
completeTest();
}
var successfullyParsed = true;
</script>
</body>
</html>