1 description("Test SVGUnitTypes enumeration animations");
5 var defs
= createSVGElement("defs");
6 rootSVGElement
.appendChild(defs
);
8 var pattern
= createSVGElement("pattern");
9 pattern
.setAttribute("id", "pattern");
10 pattern
.setAttribute("patternUnits", "userSpaceOnUse");
11 pattern
.setAttribute("patternContentUnits", "userSpaceOnUse");
12 pattern
.setAttribute("width", "50");
13 pattern
.setAttribute("height", "50");
14 defs
.appendChild(pattern
);
16 var patternChild
= createSVGElement("rect");
17 patternChild
.setAttribute("width", "1");
18 patternChild
.setAttribute("height", "1");
19 patternChild
.setAttribute("fill", "green");
20 pattern
.appendChild(patternChild
);
22 var rect
= createSVGElement("rect");
23 rect
.setAttribute("id", "rect");
24 rect
.setAttribute("width", "100");
25 rect
.setAttribute("height", "100");
26 rect
.setAttribute("fill", "url(#pattern)");
27 rect
.setAttribute("onclick", "executeTest()");
28 rootSVGElement
.appendChild(rect
);
30 var animate
= createSVGElement("animate");
31 animate
.setAttribute("id", "animation");
32 animate
.setAttribute("attributeName", "patternContentUnits");
33 animate
.setAttribute("begin", "rect.click");
34 animate
.setAttribute("dur", "4s");
35 animate
.setAttribute("from", "userSpaceOnUse");
36 animate
.setAttribute("to", "objectBoundingBox");
37 animate
.setAttribute("fill", "freeze");
38 pattern
.appendChild(animate
);
40 // Setup animation test
42 shouldBe("pattern.patternContentUnits.animVal", "SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE");
43 shouldBe("pattern.patternContentUnits.baseVal", "SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE");
47 shouldBe("pattern.patternContentUnits.animVal", "SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX");
48 shouldBe("pattern.patternContentUnits.baseVal", "SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE");
51 function executeTest() {
52 const expectedValues
= [
53 // [animationId, time, sampleCallback]
54 ["animation", 0.0, sample1
],
55 ["animation", 1.999, sample1
],
56 ["animation", 2.001, sample2
],
57 ["animation", 3.999, sample2
],
58 ["animation", 4.001, sample2
]
61 runAnimationTest(expectedValues
);
64 var successfullyParsed
= true;