Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / svg / animations / script-tests / svgnumber-animation-4.js
blobde0b15ca00fe73114bd1aea65015add371def276
1 description("Test for SVGNumber animation on SVG DOM properties.");
2 createSVGTestCase();
4 // Setup test document
5 var gradient = createSVGElement("linearGradient");
6 gradient.setAttribute("id", "gradient");
8 var stop1 = createSVGElement("stop");
9 stop1.setAttribute("offset", "0");
10 stop1.setAttribute("stop-color", "green");
11 gradient.appendChild(stop1);
13 var stop2 = createSVGElement("stop");
14 stop2.setAttribute("offset", "1");
15 stop2.setAttribute("stop-color", "red");
16 gradient.appendChild(stop2);
18 var defsElement = createSVGElement("defs");
19 defsElement.appendChild(gradient);
20 rootSVGElement.appendChild(defsElement);
22 var rect = createSVGElement("rect");
23 rect.setAttribute("id", "rect");
24 rect.setAttribute("x", "0");
25 rect.setAttribute("width", "100");
26 rect.setAttribute("height", "100");
27 rect.setAttribute("fill", "url(#gradient)");
28 rect.setAttribute("onclick", "executeTest()");
30 var animate = createSVGElement("animate");
31 animate.setAttribute("id", "animation");
32 animate.setAttribute("attributeType", "XML");
33 animate.setAttribute("attributeName", "offset");
34 animate.setAttribute("begin", "rect.click");
35 animate.setAttribute("dur", "4s");
36 animate.setAttribute("from", "0");
37 animate.setAttribute("to", "1");
38 animate.setAttribute("fill", "freeze");
39 stop1.appendChild(animate);
41 rootSVGElement.appendChild(rect);
43 // Setup animation test
44 function sample1() {
45 shouldBeCloseEnough("stop1.offset.animVal", "0");
46 shouldBe("stop1.offset.baseVal", "0");
49 function sample2() {
50 shouldBeCloseEnough("stop1.offset.animVal", "0.5");
51 shouldBe("stop1.offset.baseVal", "0");
54 function sample3() {
55 shouldBeCloseEnough("stop1.offset.animVal", "1");
56 shouldBe("stop1.offset.baseVal", "0");
59 function executeTest() {
60 const expectedValues = [
61 // [animationId, time, sampleCallback]
62 ["animation", 0.0, sample1],
63 ["animation", 2.0, sample2],
64 ["animation", 4.0, sample3]
67 runAnimationTest(expectedValues);
70 var successfullyParsed = true;