2 <script src=
"../../resources/js-test.js"></script>
5 internals
.settings
.setImageAnimationPolicy("once");
6 if (window
.testRunner
) {
7 testRunner
.dumpAsText();
8 testRunner
.waitUntilDone();
10 window
.jsTestIsAsync
= true;
14 function iframeLoaded() {
15 rootSVGElement
= document
.getElementById("iframe").contentDocument
.documentElement
;
20 // True because animation is frozen by animation policy.
21 shouldBeTrue("rootSVGElement.animationsPaused()");
23 // pauseAnimations after animation is frozen.
24 rootSVGElement
.pauseAnimations();
25 shouldBeTrue("rootSVGElement.animationsPaused()");
27 // unpauseAnimations after animation is frozen.
28 rootSVGElement
.unpauseAnimations();
29 shouldBeFalse("rootSVGElement.animationsPaused()");
31 // setCurrentTime after animation is frozen.
32 rootSVGElement
.setCurrentTime(5.0);
33 shouldBe("rootSVGElement.getCurrentTime()", "5.0");
34 shouldBe("rect.y.animVal.value", "100");
40 // SVG is not suspended.
41 // Check setCurrentTime before animation is frozen.
42 shouldBeFalse("rootSVGElement.animationsPaused()");
43 rootSVGElement
.setCurrentTime(2.5);
44 shouldBe("rootSVGElement.getCurrentTime()", "2.5");
45 shouldBe("rect.y.animVal.value", "100");
47 // Check pauseAnimations before animation is frozen.
48 rootSVGElement
.pauseAnimations();
49 shouldBeTrue("rootSVGElement.animationsPaused()");
51 // Check unpauseAnimations before animation is frozen.
52 rootSVGElement
.unpauseAnimations();
53 shouldBeFalse("rootSVGElement.animationsPaused()");
55 // Check setCurrentTime over duration before animation is frozen.
56 rootSVGElement
.setCurrentTime(5.0);
57 shouldBe("rootSVGElement.getCurrentTime()", "5.0");
58 shouldBe("rect.y.animVal.value", "100");
59 shouldBeFalse("rootSVGElement.animationsPaused()");
61 // It will be fired after animation is frozen.
62 // It's to check working after animation policy timer is fired.
63 // animation policy timer is 3 secs.
64 setTimeout(timerFired
, 3000);
67 function prepareTest() {
68 rect
= rootSVGElement
.ownerDocument
.getElementsByTagName("rect")[0];
69 description("This tests svg animation with animation policy once");
71 // Check SVG is not paused.
72 shouldBeFalse("rootSVGElement.animationsPaused()");
73 setTimeout(runTest
, 0);
76 <body onload=
"prepareTest()">
77 <h1>SVG with animation policy, once
</h1>
78 <iframe id=
"iframe" src=
"resources/animation-policy.svg" style=
"width: 300px; height: 300px;" onload=
"iframeLoaded()"></iframe>
79 <p id=
"description"></p>
80 <div id=
"console"></div>