dom/smil/test/test_smilUpdatedInterval.xhtml

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/smil/test/test_smilUpdatedInterval.xhtml	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,64 @@
     1.4 +<html xmlns="http://www.w3.org/1999/xhtml">
     1.5 +<head>
     1.6 +  <title>Tests updated intervals</title>
     1.7 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     1.8 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     1.9 +</head>
    1.10 +<body>
    1.11 +<p id="display"></p>
    1.12 +<div id="content" style="display: none">
    1.13 +<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="120px" height="120px"
    1.14 +     onload="this.pauseAnimations()">
    1.15 +  <circle cx="20" cy="20" r="15" fill="blue" id="circle">
    1.16 +    <animate attributeName="cx" from="0" to="100" begin="2s" dur="4s"
    1.17 +             id="anim1" attributeType="XML"/>
    1.18 +  </circle>
    1.19 +</svg>
    1.20 +</div>
    1.21 +<pre id="test">
    1.22 +<script class="testbody" type="text/javascript">
    1.23 +<![CDATA[
    1.24 +/** Tests for updated intervals  **/
    1.25 +
    1.26 +/* Global Variables */
    1.27 +SimpleTest.waitForExplicitFinish();
    1.28 +
    1.29 +function main() {
    1.30 +  var svg = document.getElementById("svg");
    1.31 +  ok(svg.animationsPaused(), "should be paused by <svg> load handler");
    1.32 +  is(svg.getCurrentTime(), 0, "should be paused at 0 in <svg> load handler");
    1.33 +
    1.34 +  var anim = document.getElementById("anim1");
    1.35 +
    1.36 +  // Check regular operation
    1.37 +  svg.setCurrentTime(3);
    1.38 +  is(anim.getStartTime(), 2, "Unexpected initial start time");
    1.39 +
    1.40 +  // Add an instance time before the current interval at t=1s
    1.41 +  anim.beginElementAt(-2);
    1.42 +
    1.43 +  // We shouldn't change the begin time
    1.44 +  is(anim.getStartTime(), 2, "Start time shouldn't have changed");
    1.45 +
    1.46 +  // Or the end--that is, if we go to t=5.5 we should still be running
    1.47 +  svg.setCurrentTime(5.5);
    1.48 +  try {
    1.49 +    is(anim.getSimpleDuration(), 4, "Simple duration shouldn't have changed");
    1.50 +    is(anim.getStartTime(), 2, "Start time shouldn't have changed after seek");
    1.51 +  } catch (e) {
    1.52 +    if (e.name != "InvalidStateError" ||
    1.53 +        e.code != DOMException.INVALID_STATE_ERR)
    1.54 +      throw e;
    1.55 +    ok(false, "Animation ended too early, even though begin time and " +
    1.56 +      "simple duration didn't change");
    1.57 +  }
    1.58 +
    1.59 +  SimpleTest.finish();
    1.60 +}
    1.61 +
    1.62 +window.addEventListener("load", main, false);
    1.63 +]]>
    1.64 +</script>
    1.65 +</pre>
    1.66 +</body>
    1.67 +</html>

mercurial