Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / svg / animations / script-tests / animate-path-animation-Qq-Tt.js
blobdd974befee6240ad9cc2d87d86eeacac4d728d46
1 description("Test path animation where coordinate modes of start and end differ. You should see PASS messages");
2 createSVGTestCase();
4 // Setup test document
5 var path = createSVGElement("path");
6 path.setAttribute("id", "path");
7 path.setAttribute("d", "M -30 -30 Q 30 -30 30 0 T -30 30 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 -30 -30 Q 30 -30 30 0 T -30 30 Z");
16 animate.setAttribute("to", "M -30 -30 q 30 0 30 30 t -30 30 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", "-30");
27 shouldBe("path.pathSegList.getItem(0).y", "-30");
28 shouldBeEqualToString("path.pathSegList.getItem(1).pathSegTypeAsLetter", "Q");
29 shouldBe("path.pathSegList.getItem(1).x", "30");
30 shouldBe("path.pathSegList.getItem(1).y", "0");
31 shouldBe("path.pathSegList.getItem(1).x1", "30");
32 shouldBe("path.pathSegList.getItem(1).y1", "-30");
33 shouldBeEqualToString("path.pathSegList.getItem(2).pathSegTypeAsLetter", "T");
34 shouldBe("path.pathSegList.getItem(2).x", "-30");
35 shouldBe("path.pathSegList.getItem(2).y", "30");
36 shouldBeEqualToString("path.pathSegList.getItem(3).pathSegTypeAsLetter", "Z");
39 function sample1() {
40 // Check initial/end conditions
41 shouldBe("path.animatedPathSegList.numberOfItems", "4");
42 shouldBeEqualToString("path.animatedPathSegList.getItem(0).pathSegTypeAsLetter", "M");
43 shouldBeCloseEnough("path.animatedPathSegList.getItem(0).x", "-30");
44 shouldBeCloseEnough("path.animatedPathSegList.getItem(0).y", "-30");
45 shouldBeEqualToString("path.animatedPathSegList.getItem(1).pathSegTypeAsLetter", "Q");
46 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x", "30");
47 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y", "0");
48 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x1", "30");
49 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y1", "-30");
50 shouldBeEqualToString("path.animatedPathSegList.getItem(2).pathSegTypeAsLetter", "T");
51 shouldBeCloseEnough("path.animatedPathSegList.getItem(2).x", "-30");
52 shouldBeCloseEnough("path.animatedPathSegList.getItem(2).y", "30");
53 shouldBeEqualToString("path.animatedPathSegList.getItem(3).pathSegTypeAsLetter", "Z");
54 checkBaseVal();
57 function sample2() {
58 shouldBe("path.animatedPathSegList.numberOfItems", "4");
59 shouldBeEqualToString("path.animatedPathSegList.getItem(0).pathSegTypeAsLetter", "M");
60 shouldBeCloseEnough("path.animatedPathSegList.getItem(0).x", "-30");
61 shouldBeCloseEnough("path.animatedPathSegList.getItem(0).y", "-30");
62 shouldBeEqualToString("path.animatedPathSegList.getItem(1).pathSegTypeAsLetter", "Q");
63 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x", "22.5");
64 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y", "0");
65 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x1", "22.5");
66 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y1", "-30");
67 shouldBeEqualToString("path.animatedPathSegList.getItem(2).pathSegTypeAsLetter", "T");
68 shouldBeCloseEnough("path.animatedPathSegList.getItem(2).x", "-30");
69 shouldBeCloseEnough("path.animatedPathSegList.getItem(2).y", "30");
70 shouldBeEqualToString("path.animatedPathSegList.getItem(3).pathSegTypeAsLetter", "Z");
71 checkBaseVal();
74 function sample3() {
75 shouldBe("path.animatedPathSegList.numberOfItems", "4");
76 shouldBeEqualToString("path.animatedPathSegList.getItem(0).pathSegTypeAsLetter", "M");
77 shouldBeCloseEnough("path.animatedPathSegList.getItem(0).x", "-30");
78 shouldBeCloseEnough("path.animatedPathSegList.getItem(0).y", "-30");
79 shouldBeEqualToString("path.animatedPathSegList.getItem(1).pathSegTypeAsLetter", "q");
80 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x", "37.5");
81 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y", "30");
82 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x1", "37.5");
83 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y1", "0");
84 shouldBeEqualToString("path.animatedPathSegList.getItem(2).pathSegTypeAsLetter", "t");
85 shouldBeCloseEnough("path.animatedPathSegList.getItem(2).x", "-37.5");
86 shouldBeCloseEnough("path.animatedPathSegList.getItem(2).y", "30");
87 shouldBeEqualToString("path.animatedPathSegList.getItem(3).pathSegTypeAsLetter", "Z");
88 checkBaseVal();
91 function sample4() {
92 shouldBe("path.animatedPathSegList.numberOfItems", "4");
93 shouldBeEqualToString("path.animatedPathSegList.getItem(0).pathSegTypeAsLetter", "M");
94 shouldBeCloseEnough("path.animatedPathSegList.getItem(0).x", "-30");
95 shouldBeCloseEnough("path.animatedPathSegList.getItem(0).y", "-30");
96 shouldBeEqualToString("path.animatedPathSegList.getItem(1).pathSegTypeAsLetter", "q");
97 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x", "30");
98 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y", "30");
99 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).x1", "30");
100 shouldBeCloseEnough("path.animatedPathSegList.getItem(1).y1", "0");
101 shouldBeEqualToString("path.animatedPathSegList.getItem(2).pathSegTypeAsLetter", "t");
102 shouldBeCloseEnough("path.animatedPathSegList.getItem(2).x", "-30");
103 shouldBeCloseEnough("path.animatedPathSegList.getItem(2).y", "30");
104 shouldBeEqualToString("path.animatedPathSegList.getItem(3).pathSegTypeAsLetter", "Z");
105 checkBaseVal();
108 function executeTest() {
109 const expectedValues = [
110 // [animationId, time, sampleCallback]
111 ["animation", 0.0, sample1],
112 ["animation", 1.0, sample2],
113 ["animation", 3.0, sample3],
114 ["animation", 3.999, sample4],
115 ["animation", 4.001, sample1]
118 runAnimationTest(expectedValues);
121 var successfullyParsed = true;