1 description("Test calcMode discrete with from-to animation on numbers. 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;200;300");
17 animate
.setAttribute("begin", "click");
18 animate
.setAttribute("dur", "3s");
19 animate
.setAttribute("keyTimes", "0;0.5;1");
20 animate
.setAttribute("calcMode", "discrete");
21 animate
.setAttribute("fill", "freeze");
22 rect
.appendChild(animate
);
23 rootSVGElement
.appendChild(rect
);
25 // Setup animation test
27 shouldBe("rect.x.animVal.value", "100");
28 shouldBe("rect.x.baseVal.value", "100");
32 shouldBe("rect.x.animVal.value", "200");
33 shouldBe("rect.x.baseVal.value", "100");
37 shouldBe("rect.x.animVal.value", "300");
38 shouldBe("rect.x.baseVal.value", "100");
41 function executeTest() {
42 const expectedValues
= [
43 // [animationId, time, sampleCallback]
44 ["animation", 0.0, sample1
],
45 ["animation", 1.499, sample1
],
46 ["animation", 1.501, sample2
],
47 ["animation", 2.999, sample2
],
48 ["animation", 3.001, sample3
]
51 runAnimationTest(expectedValues
);
55 var successfullyParsed
= true;