1 description("Tests animation beginElement command's restarting capability after endElement.");
6 var rect
= createSVGElement("rect");
7 rect
.setAttribute("id", "rect");
8 rect
.setAttribute("width", "50px");
9 rect
.setAttribute("height", "50px");
10 rect
.setAttribute("fill", "green");
11 rect
.setAttribute("onclick", "executeTest()");
13 var animateX
= createSVGElement("animate");
14 animateX
.setAttribute("id", "animateX");
15 animateX
.setAttribute("attributeName", "x");
16 animateX
.setAttribute("from", "0");
17 animateX
.setAttribute("to", "100");
18 animateX
.setAttribute("dur", "2s");
19 animateX
.setAttribute("begin", "indefinite");
20 animateX
.setAttribute("fill", "freeze");
21 rect
.appendChild(animateX
);
22 rootSVGElement
.appendChild(rect
);
24 // Setup animation test
27 // Check half-time conditions
28 shouldBeCloseEnough("rect.x.animVal.value", "50");
29 shouldBe("rect.x.baseVal.value", "0");
32 function executeTest() {
33 // Start animating, and stop it again after 100ms.
34 animateX
.beginElement();
35 // Allow time to pass. (The test framework pauses the timeline on load.)
36 rootSVGElement
.unpauseAnimations();
41 // Stop animating, and restart it in 100ms.
42 animateX
.endElement();
43 setTimeout(begin
, 100);
47 // Once the animation is running again, sample it.
48 animateX
.beginElement();
50 setTimeout(function() {
51 const expectedValues
= [
52 // [animationId, time, sampleCallback]
53 ["animateX", 1.0, sample1
]
55 runAnimationTest(expectedValues
);
61 var successfullyParsed
= true;