Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / svg / animations / script-tests / svgnumberlist-animation-1.js
blob8f51d43e24e18d0f76f9119b175d29b4fd7f1758
1 description("Test SVGNumberList animation on 'rotate' attribute of text.");
2 createSVGTestCase();
4 // Setup test document
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 0 0 0");
19 animate.setAttribute("to", "45 90 135 180");
20 text.appendChild(animate);
21 rootSVGElement.appendChild(text);
23 // Setup animation test
24 function sample1() {
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");
32 function sample2() {
33 shouldBe("text.rotate.animVal.numberOfItems", "4");
34 shouldBeCloseEnough("text.rotate.animVal.getItem(0).value", "0");
35 shouldBeCloseEnough("text.rotate.animVal.getItem(1).value", "0");
36 shouldBeCloseEnough("text.rotate.animVal.getItem(2).value", "0");
37 shouldBeCloseEnough("text.rotate.animVal.getItem(3).value", "0");
39 shouldBe("text.rotate.baseVal.numberOfItems", "1");
40 shouldBe("text.rotate.baseVal.getItem(0).value", "15");
43 function sample3() {
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", "45");
47 shouldBeCloseEnough("text.rotate.animVal.getItem(2).value", "67.5");
48 shouldBeCloseEnough("text.rotate.animVal.getItem(3).value", "90");
50 shouldBe("text.rotate.baseVal.numberOfItems", "1");
51 shouldBe("text.rotate.baseVal.getItem(0).value", "15");
54 function sample4() {
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;