Fix rewinding of SVG animations
[WebKit-https.git] / LayoutTests / svg / animations / animate-reset-freeze.html
1 <!DOCTYPE HTML>
2 <html>
3     <head>
4         <!--
5         Test for WK89846: Animations should be rewindable even with existing fill=freeze animations.
6         If this test passes, only the word "PASS" will be visible.
7         -->
8         <script src="../../fast/js/resources/js-test-pre.js"></script>
9     </head>
10     <body>
11         <svg id="svg" width="500" height="500">
12             <rect x="0" y="0" width="100" height="100" fill="red"/>
13             <rect id="rect" x="0" y="0" width="100" height="100" fill="blue">
14                 <set attributeName="x" to="100" begin="4s" fill="freeze"></set>
15                 <set attributeName="x" to="200" begin="1s" dur="1s" fill="freeze">
16             </rect>
17         </svg>
18         <script>
19             if (window.testRunner) {
20                 testRunner.waitUntilDone();
21                 testRunner.dumpAsText();
22             }
23
24             var svg = document.getElementById('svg');
25             var rect = document.getElementById('rect');
26             svg.pauseAnimations();
27             svg.setCurrentTime(100);
28
29             setTimeout(function() {
30                 svg.setCurrentTime(0);
31                 if (rect.x.animVal.value != 0)
32                     document.body.innerHTML = "FAIL: rect.x.animVal.value was " + rect.x.animVal.value + ", expected 0";
33                 else
34                     document.body.innerHTML = "PASS";
35
36                 if (window.testRunner)
37                     testRunner.notifyDone();
38             }, 1);
39         </script>
40     </body>
41 </html>