2011-05-26 Rob Buis <rbuis@rim.com>
[WebKit-https.git] / LayoutTests / svg / animations / script-tests / animate-insert-no-begin.js
1 description("Test behavior of dynamically inserting animate without begin attribute");
2 createSVGTestCase();
3
4
5 // Setup test document
6 var rect = createSVGElement("rect");
7 rect.setAttribute("id", "rect");
8 rect.setAttribute("x", "0");
9 rect.setAttribute("y", "45");
10 rect.setAttribute("width", "10");
11 rect.setAttribute("height", "10");
12 rect.setAttribute("fill", "green");
13 rect.setAttribute("onclick", "executeTest()");
14
15 var animate = createSVGElement("animate");
16 animate.setAttribute("id", "animation");
17 animate.setAttribute("attributeName", "x");
18 animate.setAttribute("from", "0");
19 animate.setAttribute("to", "90");
20 animate.setAttribute("dur", "3s");
21 animate.setAttribute("fill", "freeze");
22 rect.appendChild(animate);
23 rootSVGElement.appendChild(rect);
24
25 // Setup animation test
26 function sample1() {
27     shouldBe("rect.x.baseVal.value", "0");
28 }
29
30 function sample2() {
31     shouldBe("rect.x.baseVal.value", "90");
32 }
33
34 function executeTest() {
35     const expectedValues = [
36         // [animationId, time, elementId, sampleCallback]
37         ["animation", 0.0,    "rect", sample1],
38         ["animation", 3.0,    "rect", sample2],
39     ];
40
41     runAnimationTest(expectedValues);
42 }
43
44 // Begin test async
45 window.setTimeout("triggerUpdate(5, 50)", 0);
46 var successfullyParsed = true;