1 description("Test SVGLength animation on LengthModeWidth.");
5 rootSVGElement
.setAttribute("width", "600");
6 rootSVGElement
.setAttribute("height", "400");
9 var rect
= createSVGElement("rect");
10 rect
.setAttribute("id", "rect");
11 rect
.setAttribute("x", "0");
12 rect
.setAttribute("width", "100");
13 rect
.setAttribute("height", "100");
14 rect
.setAttribute("fill", "green");
15 rect
.setAttribute("font-size", "10px");
16 rect
.setAttribute("onclick", "executeTest()");
18 var animate
= createSVGElement("animate");
19 animate
.setAttribute("id", "animation");
20 animate
.setAttribute("attributeName", "width");
21 animate
.setAttribute("begin", "click");
22 animate
.setAttribute("dur", "4s");
23 animate
.setAttribute("from", "100");
24 animate
.setAttribute("to", "50%");
25 rect
.appendChild(animate
);
26 rootSVGElement
.appendChild(rect
);
28 // Setup animation test
30 // Check initial/end conditions
31 shouldBeCloseEnough("rect.width.animVal.value", "100");
32 shouldBe("rect.width.baseVal.value", "100");
36 shouldBeCloseEnough("rect.width.animVal.value", "200");
37 shouldBe("rect.width.baseVal.value", "100");
41 shouldBeCloseEnough("rect.width.animVal.value", "300");
42 shouldBe("rect.width.baseVal.value", "100");
45 function executeTest() {
46 const expectedValues
= [
47 // [animationId, time, sampleCallback]
48 ["animation", 0.0, sample1
],
49 ["animation", 2.0, sample2
],
50 ["animation", 3.999, sample3
],
51 ["animation", 4.001, sample1
]
54 runAnimationTest(expectedValues
);
57 var successfullyParsed
= true;