<!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] SVGClipPathElement-dom-clipPathUnits-attr.js
// [Expected rendering result] green circle - and a series of PASS messages

description("Tests dynamic updates of the 'clipPathUnits' attribute of the SVGClipPathElement object")
createSVGTestCase();

var defsElement = createSVGElement("defs");
rootSVGElement.appendChild(defsElement);

var clipPathElement = createSVGElement("clipPath");
clipPathElement.setAttribute("id", "clipper");
clipPathElement.setAttribute("clipPathUnits", "userSpaceOnUse");

var rectElementA = createSVGElement("rect");
rectElementA.setAttribute("width", "10");
rectElementA.setAttribute("height", "10");
clipPathElement.appendChild(rectElementA);

defsElement.appendChild(clipPathElement);

var rectElementB = createSVGElement("rect");
rectElementB.setAttribute("width", "100");
rectElementB.setAttribute("height", "100");
rectElementB.setAttribute("fill", "green");
rectElementB.setAttribute("clip-path", "url(#clipper)");
rootSVGElement.appendChild(rectElementB);

shouldBeEqualToString("clipPathElement.getAttribute('clipPathUnits')", "userSpaceOnUse")

function repaintTest() {
    clipPathElement.setAttribute("clipPathUnits", "objectBoundingBox");
    shouldBeEqualToString("clipPathElement.getAttribute('clipPathUnits')", "objectBoundingBox");

    completeTest();
}

var successfullyParsed = true;
</script>
</body>
</html>
