blob: c954d76304955e56e6a37b7904bcd847767cc7be [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] SVGPatternElement-svgdom-patternTransform-prop.js
// [Expected rendering result] green ellipse, no red visible - and a series of PASS messages
description("Tests dynamic updates of the 'patternTransform' property of the SVGPatternElement object")
createSVGTestCase();
var rectElement = createSVGElement("rect");
rectElement.setAttribute("x", "10");
rectElement.setAttribute("y", "10");
rectElement.setAttribute("width", "190");
rectElement.setAttribute("height", "190");
rectElement.setAttribute("fill", "url(#pattern)");
var transform = rootSVGElement.createSVGTransform();
shouldBe("transform.type", "SVGTransform.SVG_TRANSFORM_MATRIX");
shouldBe("transform.matrix.a", "1.0");
shouldBe("transform.matrix.b", "0.0");
shouldBe("transform.matrix.c", "0.0");
shouldBe("transform.matrix.d", "1.0");
shouldBe("transform.matrix.e", "0.0");
shouldBe("transform.matrix.f", "0.0");
shouldBe("transform.angle", "0.0");
var defsElement = createSVGElement("defs");
rootSVGElement.appendChild(defsElement);
var patternElement = createSVGElement("pattern");
patternElement.setAttribute("id", "pattern");
patternElement.setAttribute("width", "100");
patternElement.setAttribute("height", "50");
patternElement.setAttribute("patternUnits", "userSpaceOnUse");
patternElement.setAttribute("patternTransform", "matrix(" + transform.matrix.a + " "
+ transform.matrix.b + " "
+ transform.matrix.c + " "
+ transform.matrix.d + " "
+ transform.matrix.e + " "
+ transform.matrix.f + ")");
var patternContentRect1Element = createSVGElement("rect");
patternContentRect1Element.setAttribute("width", "50");
patternContentRect1Element.setAttribute("height", "50");
patternContentRect1Element.setAttribute("fill", "green");
patternElement.appendChild(patternContentRect1Element);
var patternContentRect2Element = createSVGElement("rect");
patternContentRect2Element.setAttribute("x", "50");
patternContentRect2Element.setAttribute("width", "50");
patternContentRect2Element.setAttribute("height", "50");
patternContentRect2Element.setAttribute("fill", "red");
patternElement.appendChild(patternContentRect2Element);
defsElement.appendChild(patternElement);
rootSVGElement.appendChild(rectElement);
shouldBe("patternElement.patternTransform.baseVal.getItem(0).matrix.a", "1.0");
shouldBe("patternElement.patternTransform.baseVal.getItem(0).matrix.b", "0.0");
shouldBe("patternElement.patternTransform.baseVal.getItem(0).matrix.c", "0.0");
shouldBe("patternElement.patternTransform.baseVal.getItem(0).matrix.d", "1.0");
shouldBe("patternElement.patternTransform.baseVal.getItem(0).matrix.e", "0.0");
shouldBe("patternElement.patternTransform.baseVal.getItem(0).matrix.f", "0.0");
function repaintTest() {
patternElement.patternTransform.baseVal.getItem(0).matrix.a = 4;
shouldBe("patternElement.patternTransform.baseVal.getItem(0).matrix.a", "4.0");
shouldBe("patternElement.patternTransform.baseVal.getItem(0).matrix.b", "0.0");
shouldBe("patternElement.patternTransform.baseVal.getItem(0).matrix.c", "0.0");
shouldBe("patternElement.patternTransform.baseVal.getItem(0).matrix.d", "1.0");
shouldBe("patternElement.patternTransform.baseVal.getItem(0).matrix.e", "0.0");
shouldBe("patternElement.patternTransform.baseVal.getItem(0).matrix.f", "0.0");
completeTest();
}
var successfullyParsed = true;
</script>
</body>
</html>