blob: 39d64edacb94dd4596b21e74da12ea617ee606fa [file] [log] [blame]
// [Name] SVGLinearGradientElement-svgdom-gradientUnits-prop.js
// [Expected rendering result] green ellipse, no red visible - and a series of PASS messages
description("Tests dynamic updates of the 'gradientUnits' property 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");
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);
shouldBe("linearGradientElement.gradientUnits.baseVal", "SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX");
function executeTest() {
linearGradientElement.gradientUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE;
shouldBe("linearGradientElement.gradientUnits.baseVal", "SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE");
completeTest();
}
startTest(ellipseElement, 150, 150);
var successfullyParsed = true;