1 description("Test SVGLength animation from px to cm.");
5 var rect
= createSVGElement("rect");
6 rect
.setAttribute("id", "rect");
7 rect
.setAttribute("x", "0");
8 rect
.setAttribute("width", "100");
9 rect
.setAttribute("height", "100");
10 rect
.setAttribute("fill", "green");
11 rect
.setAttribute("onclick", "executeTest()");
13 var animate
= createSVGElement("animate");
14 animate
.setAttribute("id", "animation");
15 animate
.setAttribute("attributeName", "width");
16 animate
.setAttribute("begin", "click");
17 animate
.setAttribute("dur", "4s");
18 animate
.setAttribute("from", "100px");
19 animate
.setAttribute("to", "200px");
20 rect
.appendChild(animate
);
21 rootSVGElement
.appendChild(rect
);
23 // Setup animation test
25 // Check initial/end conditions
26 shouldBeCloseEnough("rect.width.animVal.value", "100");
27 shouldBe("rect.width.baseVal.value", "100");
31 shouldBeCloseEnough("rect.width.animVal.value", "150");
32 shouldBe("rect.width.baseVal.value", "100");
36 shouldBeCloseEnough("rect.width.animVal.value", "200");
37 shouldBe("rect.width.baseVal.value", "100");
40 function executeTest() {
41 const expectedValues
= [
42 // [animationId, time, sampleCallback]
43 ["animation", 0.0, sample1
],
44 ["animation", 2.0, sample2
],
45 ["animation", 3.999, sample3
],
46 ["animation", 4.001, sample1
]
49 runAnimationTest(expectedValues
);
52 var successfullyParsed
= true;