1 description("Test path animation where coordinate modes of start and end differ. You should see PASS messages");
5 var path
= createSVGElement("path");
6 path
.setAttribute("id", "path");
7 path
.setAttribute("d", "M -20 -20 C 20 -20 20 -20 20 20 S 20 40 -20 20 Z");
8 path
.setAttribute("fill", "green");
9 path
.setAttribute("onclick", "executeTest()");
10 path
.setAttribute("transform", "translate(50, 50)");
12 var animate
= createSVGElement("animate");
13 animate
.setAttribute("id", "animation");
14 animate
.setAttribute("attributeName", "d");
15 animate
.setAttribute("from", "M -20 -20 C 20 -20 20 -20 20 20 S 20 40 -20 20 Z");
16 animate
.setAttribute("to", "M -20 -20 c 0 40 0 40 40 40 s 40 0 0 -40 z");
17 animate
.setAttribute("begin", "click");
18 animate
.setAttribute("dur", "4s");
19 path
.appendChild(animate
);
20 rootSVGElement
.appendChild(path
);
22 // Setup animation test
23 function checkBaseVal() {
24 shouldBe("path.pathSegList.numberOfItems", "4");
25 shouldBeEqualToString("path.pathSegList.getItem(0).pathSegTypeAsLetter", "M");
26 shouldBe("path.pathSegList.getItem(0).x", "-20");
27 shouldBe("path.pathSegList.getItem(0).y", "-20");
28 shouldBeEqualToString("path.pathSegList.getItem(1).pathSegTypeAsLetter", "C");
29 shouldBe("path.pathSegList.getItem(1).x", "20");
30 shouldBe("path.pathSegList.getItem(1).y", "20");
31 shouldBe("path.pathSegList.getItem(1).x1", "20");
32 shouldBe("path.pathSegList.getItem(1).y1", "-20");
33 shouldBe("path.pathSegList.getItem(1).x2", "20");
34 shouldBe("path.pathSegList.getItem(1).y2", "-20");
35 shouldBeEqualToString("path.pathSegList.getItem(2).pathSegTypeAsLetter", "S");
36 shouldBe("path.pathSegList.getItem(2).x", "-20");
37 shouldBe("path.pathSegList.getItem(2).y", "20");
38 shouldBe("path.pathSegList.getItem(2).x2", "20");
39 shouldBe("path.pathSegList.getItem(2).y2", "40");
40 shouldBeEqualToString("path.pathSegList.getItem(3).pathSegTypeAsLetter", "Z");
44 // Check initial/end conditions
45 shouldBe("path.animatedPathSegList.numberOfItems", "4");
46 shouldBeEqualToString("path.animatedPathSegList.getItem(0).pathSegTypeAsLetter", "M");
47 shouldBeCloseEnough("path.animatedPathSegList.getItem(0).x", "-20");
48 shouldBeCloseEnough("path.animatedPathSegList.getItem(0).y", "-20");
49 shouldBeEqualToString("path.animatedPathSegList.getItem(1).pathSegTypeAsLetter", "C");
50 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x", "20");
51 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y", "20");
52 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x1", "20");
53 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y1", "-20");
54 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x2", "20");
55 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y2", "-20");
56 shouldBeEqualToString("path.animatedPathSegList.getItem(2).pathSegTypeAsLetter", "S");
57 shouldBeCloseEnough("path.animatedPathSegList.getItem(2).x", "-20");
58 shouldBeCloseEnough("path.animatedPathSegList.getItem(2).y", "20");
59 shouldBeCloseEnough("path.animatedPathSegList.getItem(2).x2", "20");
60 shouldBeCloseEnough("path.animatedPathSegList.getItem(2).y2", "40");
61 shouldBeEqualToString("path.animatedPathSegList.getItem(3).pathSegTypeAsLetter", "Z");
66 shouldBe("path.animatedPathSegList.numberOfItems", "4");
67 shouldBeEqualToString("path.animatedPathSegList.getItem(0).pathSegTypeAsLetter", "M");
68 shouldBeCloseEnough("path.animatedPathSegList.getItem(0).x", "-20");
69 shouldBeCloseEnough("path.animatedPathSegList.getItem(0).y", "-20");
70 shouldBeEqualToString("path.animatedPathSegList.getItem(1).pathSegTypeAsLetter", "C");
71 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x", "20");
72 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y", "20");
73 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x1", "10");
74 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y1", "-10");
75 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x2", "10");
76 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y2", "-10");
77 shouldBeEqualToString("path.animatedPathSegList.getItem(2).pathSegTypeAsLetter", "S");
78 shouldBeCloseEnough("path.animatedPathSegList.getItem(2).x", "-10");
79 shouldBeCloseEnough("path.animatedPathSegList.getItem(2).y", "10");
80 shouldBeCloseEnough("path.animatedPathSegList.getItem(2).x2", "30");
81 shouldBeCloseEnough("path.animatedPathSegList.getItem(2).y2", "35");
82 shouldBeEqualToString("path.animatedPathSegList.getItem(3).pathSegTypeAsLetter", "Z");
87 shouldBe("path.animatedPathSegList.numberOfItems", "4");
88 shouldBeEqualToString("path.animatedPathSegList.getItem(0).pathSegTypeAsLetter", "M");
89 shouldBeCloseEnough("path.animatedPathSegList.getItem(0).x", "-20");
90 shouldBeCloseEnough("path.animatedPathSegList.getItem(0).y", "-20");
91 shouldBeEqualToString("path.animatedPathSegList.getItem(1).pathSegTypeAsLetter", "c");
92 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x", "40");
93 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y", "40");
94 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x1", "10");
95 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y1", "30");
96 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x2", "10");
97 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y2", "30");
98 shouldBeEqualToString("path.animatedPathSegList.getItem(2).pathSegTypeAsLetter", "s");
99 shouldBeCloseEnough("path.animatedPathSegList.getItem(2).x", "-10");
100 shouldBeCloseEnough("path.animatedPathSegList.getItem(2).y", "-30");
101 shouldBeCloseEnough("path.animatedPathSegList.getItem(2).x2", "30");
102 shouldBeCloseEnough("path.animatedPathSegList.getItem(2).y2", "5");
103 shouldBeEqualToString("path.animatedPathSegList.getItem(3).pathSegTypeAsLetter", "Z");
108 shouldBe("path.animatedPathSegList.numberOfItems", "4");
109 shouldBeEqualToString("path.animatedPathSegList.getItem(0).pathSegTypeAsLetter", "M");
110 shouldBeCloseEnough("path.animatedPathSegList.getItem(0).x", "-20");
111 shouldBeCloseEnough("path.animatedPathSegList.getItem(0).y", "-20");
112 shouldBeEqualToString("path.animatedPathSegList.getItem(1).pathSegTypeAsLetter", "c");
113 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x", "40");
114 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y", "40");
115 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x1", "0");
116 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y1", "40");
117 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x2", "0");
118 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y2", "40");
119 shouldBeEqualToString("path.animatedPathSegList.getItem(2).pathSegTypeAsLetter", "s");
120 shouldBeCloseEnough("path.animatedPathSegList.getItem(2).x", "-0");
121 shouldBeCloseEnough("path.animatedPathSegList.getItem(2).y", "-40");
122 shouldBeCloseEnough("path.animatedPathSegList.getItem(2).x2", "40");
123 shouldBeCloseEnough("path.animatedPathSegList.getItem(2).y2", "0");
124 shouldBeEqualToString("path.animatedPathSegList.getItem(3).pathSegTypeAsLetter", "Z");
128 function executeTest() {
129 const expectedValues
= [
130 // [animationId, time, sampleCallback]
131 ["animation", 0.0, sample1
],
132 ["animation", 1.0, sample2
],
133 ["animation", 3.0, sample3
],
134 ["animation", 3.999, sample4
],
135 ["animation", 4.001, sample1
]
138 runAnimationTest(expectedValues
);
141 var successfullyParsed
= true;