1 description("Test calcMode spline with values animation. You should see a green 100x100 rect and only PASS messages");
5 var rect
= createSVGElement("rect");
6 rect
.setAttribute("id", "rect");
7 rect
.setAttribute("x", "100");
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", "x");
16 animate
.setAttribute("values", "100;0");
17 animate
.setAttribute("begin", "click");
18 animate
.setAttribute("dur", "4s");
19 animate
.setAttribute("keyTimes", "0;1");
20 animate
.setAttribute("keySplines", "0.25 .5 .25 0.85");
21 animate
.setAttribute("calcMode", "spline");
22 rect
.appendChild(animate
);
23 rootSVGElement
.appendChild(rect
);
25 // Setup animation test
27 // Check initial/end conditions
28 shouldBeCloseEnough("rect.x.animVal.value", "100");
29 shouldBe("rect.x.baseVal.value", "100");
33 // Check half-time conditions
34 shouldBeCloseEnough("rect.x.animVal.value", "18.8");
35 shouldBe("rect.x.baseVal.value", "100");
39 // Check just before-end conditions
40 shouldBeCloseEnough("rect.x.animVal.value", "0");
41 shouldBe("rect.x.baseVal.value", "100");
44 function executeTest() {
45 const expectedValues
= [
46 // [animationId, time, sampleCallback]
47 ["animation", 0.0, sample1
],
48 ["animation", 2.0, sample2
],
49 ["animation", 3.999, sample3
],
50 ["animation", 4.001, sample1
]
53 runAnimationTest(expectedValues
);
57 var successfullyParsed
= true;