Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / svg / animations / script-tests / svglengthlist-animation-3.js
blob68ac5623c2ad6d90fef03281200564dcbbfd75b6
1 description("Test 'to' animation of SVGLengthList with different count of items.");
2 createSVGTestCase();
4 // Setup test document
5 var text = createSVGElement("text");
6 text.setAttribute("id", "text");
7 text.textContent = "ABCD";
8 text.setAttribute("x", "50");
9 text.setAttribute("y", "50");
10 text.setAttribute("onclick", "executeTest()");
11 rootSVGElement.appendChild(text);
13 var animate = createSVGElement("animate");
14 animate.setAttribute("id", "animation");
15 animate.setAttribute("attributeName", "x");
16 animate.setAttribute("begin", "click");
17 animate.setAttribute("dur", "4s");
18 animate.setAttribute("from", "50");
19 animate.setAttribute("to", "70 80 90 110");
20 text.appendChild(animate);
22 // Setup animation test
23 function sample1() {
24 shouldBe("text.x.animVal.numberOfItems", "1");
25 shouldBeCloseEnough("text.x.animVal.getItem(0).value", "50");
27 shouldBe("text.x.baseVal.numberOfItems", "1");
28 shouldBe("text.x.baseVal.getItem(0).value", "50");
31 function sample2() {
32 shouldBe("text.x.animVal.numberOfItems", "4");
33 shouldBeCloseEnough("text.x.animVal.getItem(0).value", "70");
34 shouldBeCloseEnough("text.x.animVal.getItem(1).value", "80");
35 shouldBeCloseEnough("text.x.animVal.getItem(2).value", "90");
36 shouldBeCloseEnough("text.x.animVal.getItem(3).value", "110");
38 shouldBe("text.x.baseVal.numberOfItems", "1");
39 shouldBe("text.x.baseVal.getItem(0).value", "50");
42 function sample3() {
43 shouldBe("text.x.animVal.numberOfItems", "4");
44 shouldBeCloseEnough("text.x.animVal.getItem(0).value", "70");
45 shouldBeCloseEnough("text.x.animVal.getItem(1).value", "80");
46 shouldBeCloseEnough("text.x.animVal.getItem(2).value", "90");
47 shouldBeCloseEnough("text.x.animVal.getItem(3).value", "110");
49 shouldBe("text.x.baseVal.numberOfItems", "1");
50 shouldBe("text.x.baseVal.getItem(0).value", "50");
53 function executeTest() {
54 const expectedValues = [
55 // [animationId, time, sampleCallback]
56 ["animation", 0.0, sample1],
57 ["animation", 2.0, sample2],
58 ["animation", 3.999, sample3],
59 ["animation", 4.001, sample1]
62 runAnimationTest(expectedValues);
65 var successfullyParsed = true;