Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / svg / animations / script-tests / animate-keySplines.js
blob989ffc249186fb8f4467009bcec300829c2deb40
1 description("Testing correct parsing of keySplines.");
2 createSVGTestCase();
4 // Setup test document
5 var rect = createSVGElement("rect");
6 rect.setAttribute("id", "rect");
7 rect.setAttribute("fill", "green");
8 rect.setAttribute("x", "0");
9 rect.setAttribute("y", "0");
10 rect.setAttribute("width", "100");
11 rect.setAttribute("height", "100");
12 rect.setAttribute("onclick", "executeTest()");
14 var animate = createSVGElement("animate");
15 animate.setAttribute("id", "animation");
16 animate.setAttribute("attributeName", "height");
17 animate.setAttribute("calcMode", "spline");
18 animate.setAttribute("keyTimes", " 0 ; 0.3333333 ; 0.666666; 1 ");
19 animate.setAttribute("keySplines", " 0 ,0 1 , 1 ; 0 0 , 1 , 1 ; .75 , 0 , 0 , .75 ; ");
20 animate.setAttribute("values", "200;167;111;0");
21 animate.setAttribute("begin", "click");
22 animate.setAttribute("dur", "9s");
23 rect.appendChild(animate);
24 rootSVGElement.appendChild(rect);
26 // Setup animation test
27 function sample1() {
28 // Check initial/end conditions
29 shouldBeCloseEnough("rect.height.animVal.value", "167");
30 shouldBe("rect.height.baseVal.value", "100");
33 function sample2() {
34 // Check half-time conditions
35 shouldBeCloseEnough("rect.height.animVal.value", "111");
36 shouldBe("rect.height.baseVal.value", "100");
39 function sample3() {
40 // Check just before-end conditions
41 shouldBeCloseEnough("rect.height.animVal.value", "0");
42 shouldBe("rect.height.baseVal.value", "100");
45 function sample4() {
46 // Check end conditions
47 shouldBeCloseEnough("rect.height.animVal.value", "100");
48 shouldBe("rect.height.baseVal.value", "100");
51 function executeTest() {
52 const expectedValues = [
53 // [animationId, time, sampleCallback]
54 ["animation", 3.0, sample1],
55 ["animation", 6.0, sample2],
56 ["animation", 8.999, sample3],
57 ["animation", 9.001, sample4]
60 runAnimationTest(expectedValues);
63 var successfullyParsed = true;