Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / svg / animations / script-tests / svgnumber-animation-1.js
blob1a49f563b58719cccb4aff9a0b29673dbe220c21
1 description("Test for SVGNumber animation.");
2 createSVGTestCase();
4 // Setup test document
5 var rect = createSVGElement("rect");
6 rect.setAttribute("id", "rect");
7 rect.setAttribute("x", "0");
8 rect.setAttribute("width", "100");
9 rect.setAttribute("height", "100");
10 rect.setAttribute("fill", "green");
11 rect.setAttribute("opacity", "0");
12 rect.setAttribute("onclick", "executeTest()");
14 var animate = createSVGElement("animate");
15 animate.setAttribute("id", "animation");
16 animate.setAttribute("attributeName", "opacity");
17 animate.setAttribute("begin", "click");
18 animate.setAttribute("dur", "4s");
19 animate.setAttribute("from", "0");
20 animate.setAttribute("to", "1");
21 rect.appendChild(animate);
22 rootSVGElement.appendChild(rect);
24 // Setup animation test
25 function sample1() {
26 // Check initial/end conditions
27 shouldBeCloseEnough("parseFloat(getComputedStyle(rect).opacity)", "0");
30 function sample2() {
31 shouldBeCloseEnough("parseFloat(getComputedStyle(rect).opacity)", "0.5");
34 function sample3() {
35 shouldBeCloseEnough("parseFloat(getComputedStyle(rect).opacity)", "1");
38 function executeTest() {
39 const expectedValues = [
40 // [animationId, time, sampleCallback]
41 ["animation", 0.0, sample1],
42 ["animation", 2.0, sample2],
43 ["animation", 3.999, sample3],
44 ["animation", 4.001, sample1]
47 runAnimationTest(expectedValues);
50 var successfullyParsed = true;