dom/smil/test/test_smilUpdatedInterval.xhtml

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 <html xmlns="http://www.w3.org/1999/xhtml">
michael@0 2 <head>
michael@0 3 <title>Tests updated intervals</title>
michael@0 4 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 5 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 6 </head>
michael@0 7 <body>
michael@0 8 <p id="display"></p>
michael@0 9 <div id="content" style="display: none">
michael@0 10 <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="120px" height="120px"
michael@0 11 onload="this.pauseAnimations()">
michael@0 12 <circle cx="20" cy="20" r="15" fill="blue" id="circle">
michael@0 13 <animate attributeName="cx" from="0" to="100" begin="2s" dur="4s"
michael@0 14 id="anim1" attributeType="XML"/>
michael@0 15 </circle>
michael@0 16 </svg>
michael@0 17 </div>
michael@0 18 <pre id="test">
michael@0 19 <script class="testbody" type="text/javascript">
michael@0 20 <![CDATA[
michael@0 21 /** Tests for updated intervals **/
michael@0 22
michael@0 23 /* Global Variables */
michael@0 24 SimpleTest.waitForExplicitFinish();
michael@0 25
michael@0 26 function main() {
michael@0 27 var svg = document.getElementById("svg");
michael@0 28 ok(svg.animationsPaused(), "should be paused by <svg> load handler");
michael@0 29 is(svg.getCurrentTime(), 0, "should be paused at 0 in <svg> load handler");
michael@0 30
michael@0 31 var anim = document.getElementById("anim1");
michael@0 32
michael@0 33 // Check regular operation
michael@0 34 svg.setCurrentTime(3);
michael@0 35 is(anim.getStartTime(), 2, "Unexpected initial start time");
michael@0 36
michael@0 37 // Add an instance time before the current interval at t=1s
michael@0 38 anim.beginElementAt(-2);
michael@0 39
michael@0 40 // We shouldn't change the begin time
michael@0 41 is(anim.getStartTime(), 2, "Start time shouldn't have changed");
michael@0 42
michael@0 43 // Or the end--that is, if we go to t=5.5 we should still be running
michael@0 44 svg.setCurrentTime(5.5);
michael@0 45 try {
michael@0 46 is(anim.getSimpleDuration(), 4, "Simple duration shouldn't have changed");
michael@0 47 is(anim.getStartTime(), 2, "Start time shouldn't have changed after seek");
michael@0 48 } catch (e) {
michael@0 49 if (e.name != "InvalidStateError" ||
michael@0 50 e.code != DOMException.INVALID_STATE_ERR)
michael@0 51 throw e;
michael@0 52 ok(false, "Animation ended too early, even though begin time and " +
michael@0 53 "simple duration didn't change");
michael@0 54 }
michael@0 55
michael@0 56 SimpleTest.finish();
michael@0 57 }
michael@0 58
michael@0 59 window.addEventListener("load", main, false);
michael@0 60 ]]>
michael@0 61 </script>
michael@0 62 </pre>
michael@0 63 </body>
michael@0 64 </html>

mercurial