dom/smil/test/test_smilReset.xhtml

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 <html xmlns="http://www.w3.org/1999/xhtml">
michael@0 2 <head>
michael@0 3 <title>Tests for SMIL Reset Behavior </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">
michael@0 13 <animate attributeName="cx" from="20" 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 SMIL Reset Behavior **/
michael@0 22
michael@0 23 SimpleTest.waitForExplicitFinish();
michael@0 24
michael@0 25 function main() {
michael@0 26 var svg = document.getElementById("svg");
michael@0 27 ok(svg.animationsPaused(), "should be paused by <svg> load handler");
michael@0 28 is(svg.getCurrentTime(), 0, "should be paused at 0 in <svg> load handler");
michael@0 29
michael@0 30 var anim = document.getElementById("anim1");
michael@0 31 is(anim.getStartTime(), 2, "Unexpected initial start time");
michael@0 32
michael@0 33 svg.setCurrentTime(1);
michael@0 34 anim.beginElementAt(2);
michael@0 35
michael@0 36 // We now have two instance times: 2, 3
michael@0 37
michael@0 38 // Restart (and reset) animation at t=1
michael@0 39 anim.beginElement();
michael@0 40
michael@0 41 // Instance times should now be 1, 2 (3 should have be reset)
michael@0 42 is(anim.getStartTime(), 1,
michael@0 43 "Unexpected start time after restart. Perhaps the added instance time "
michael@0 44 + "was cleared");
michael@0 45 svg.setCurrentTime(4);
michael@0 46 // Instance times will now be 2 (1 will have be reset when we restarted)
michael@0 47 is(anim.getStartTime(), 2, "Unexpected start time after seek");
michael@0 48
michael@0 49 // Create a two new instance times at t=4, 5
michael@0 50 anim.beginElement();
michael@0 51 anim.beginElementAt(1);
michael@0 52 is(anim.getStartTime(), 4, "Unexpected start time after beginElement");
michael@0 53
michael@0 54 // Here is a white box test to make sure we don't discard instance times
michael@0 55 // created by DOM calls when setting/unsetting the 'begin' spec
michael@0 56 anim.removeAttribute('begin');
michael@0 57 is(anim.getStartTime(), 4, "Unexpected start time after clearing begin spec");
michael@0 58 svg.setCurrentTime(6);
michael@0 59 is(anim.getStartTime(), 5,
michael@0 60 "Second DOM instance time cleared when begin spec was removed");
michael@0 61
michael@0 62 // And likewise, when we set it again
michael@0 63 anim.beginElementAt(1); // Instance times now t=5s, 7s
michael@0 64 anim.setAttribute('begin', '1s'); // + t=1s
michael@0 65 is(anim.getStartTime(), 5, "Unexpected start time after setting begin spec");
michael@0 66 svg.setCurrentTime(8);
michael@0 67 is(anim.getStartTime(), 7,
michael@0 68 "Second DOM instance time cleared when begin spec was added");
michael@0 69
michael@0 70 // But check we do update state appropriately
michael@0 71 anim.setAttribute('begin', '8s');
michael@0 72 is(anim.getStartTime(), 8, "Interval not updated with updated begin spec");
michael@0 73
michael@0 74 SimpleTest.finish();
michael@0 75 }
michael@0 76
michael@0 77 window.addEventListener("load", main, false);
michael@0 78 ]]>
michael@0 79 </script>
michael@0 80 </pre>
michael@0 81 </body>
michael@0 82 </html>

mercurial