1 description("Test 'by' animation of SVGNumberList on 'rotate' attribute of text.");
5 var text
= createSVGElement("text");
6 text
.textContent
= "ABCD";
7 text
.setAttribute("x", "40 60 80 100");
8 text
.setAttribute("y", "60");
9 text
.setAttribute("rotate", "15");
10 text
.setAttribute("fill", "green");
11 text
.setAttribute("onclick", "executeTest()");
13 var animate
= createSVGElement("animate");
14 animate
.setAttribute("id", "animation");
15 animate
.setAttribute("attributeName", "rotate");
16 animate
.setAttribute("begin", "click");
17 animate
.setAttribute("dur", "4s");
18 animate
.setAttribute("from", "0 45 90 135");
19 animate
.setAttribute("by", "45 45 45 45");
20 text
.appendChild(animate
);
21 rootSVGElement
.appendChild(text
);
23 // Setup animation test
25 shouldBe("text.rotate.animVal.numberOfItems", "1");
26 shouldBeCloseEnough("text.rotate.animVal.getItem(0).value", "15");
28 shouldBe("text.rotate.baseVal.numberOfItems", "1");
29 shouldBe("text.rotate.baseVal.getItem(0).value", "15");
33 shouldBe("text.rotate.animVal.numberOfItems", "4");
34 shouldBeCloseEnough("text.rotate.animVal.getItem(0).value", "0");
35 shouldBeCloseEnough("text.rotate.animVal.getItem(1).value", "45");
36 shouldBeCloseEnough("text.rotate.animVal.getItem(2).value", "90");
37 shouldBeCloseEnough("text.rotate.animVal.getItem(3).value", "135");
39 shouldBe("text.rotate.baseVal.numberOfItems", "1");
40 shouldBe("text.rotate.baseVal.getItem(0).value", "15");
44 shouldBe("text.rotate.animVal.numberOfItems", "4");
45 shouldBeCloseEnough("text.rotate.animVal.getItem(0).value", "22.5");
46 shouldBeCloseEnough("text.rotate.animVal.getItem(1).value", "67.5");
47 shouldBeCloseEnough("text.rotate.animVal.getItem(2).value", "112.5");
48 shouldBeCloseEnough("text.rotate.animVal.getItem(3).value", "157.5");
50 shouldBe("text.rotate.baseVal.numberOfItems", "1");
51 shouldBe("text.rotate.baseVal.getItem(0).value", "15");
55 shouldBe("text.rotate.animVal.numberOfItems", "4");
56 shouldBeCloseEnough("text.rotate.animVal.getItem(0).value", "45");
57 shouldBeCloseEnough("text.rotate.animVal.getItem(1).value", "90");
58 shouldBeCloseEnough("text.rotate.animVal.getItem(2).value", "135");
59 shouldBeCloseEnough("text.rotate.animVal.getItem(3).value", "180");
61 shouldBe("text.rotate.baseVal.numberOfItems", "1");
62 shouldBe("text.rotate.baseVal.getItem(0).value", "15");
65 function executeTest() {
66 const expectedValues
= [
67 // [animationId, time, sampleCallback]
68 ["animation", 0.0, sample1
],
69 ["animation", 0.001, sample2
],
70 ["animation", 2.0, sample3
],
71 ["animation", 3.999, sample4
],
72 ["animation", 4.001, sample1
]
75 runAnimationTest(expectedValues
);
78 var successfullyParsed
= true;