dom/smil/test/test_smilXHR.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>Test for SMIL Behavior in Data Documents</title>
michael@0 4 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 5 <script type="text/javascript" src="smilTestUtils.js"></script>
michael@0 6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 7 </head>
michael@0 8 <body>
michael@0 9 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=529387">Mozilla Bug 529387</a>
michael@0 10 <p id="display"></p>
michael@0 11 <div id="content" style="display: none">
michael@0 12 </div>
michael@0 13 <pre id="test">
michael@0 14 <script class="testbody" type="text/javascript">
michael@0 15 <![CDATA[
michael@0 16 /** Test for SMIL Behavior in Data Documents, with XMLHttpRequest **/
michael@0 17
michael@0 18 SimpleTest.waitForExplicitFinish();
michael@0 19
michael@0 20 function tryPausing(svg) {
michael@0 21 // Check that pausing has no effect
michael@0 22 ok(!svg.animationsPaused(),
michael@0 23 "shouldn't be paused (because we shouldn't have even started");
michael@0 24 svg.pauseAnimations();
michael@0 25 ok(!svg.animationsPaused(), "attempts to pause should have no effect");
michael@0 26 svg.unpauseAnimations();
michael@0 27 ok(!svg.animationsPaused(), "still shouldn't be paused, after pause/unpause");
michael@0 28 }
michael@0 29
michael@0 30 function trySeeking(svg) {
michael@0 31 // Check that seeking is ineffective
michael@0 32 is(svg.getCurrentTime(), 0, "should start out at time=0");
michael@0 33 svg.setCurrentTime(1);
michael@0 34 is(svg.getCurrentTime(), 0, "shouldn't be able to seek away from time=0");
michael@0 35 }
michael@0 36
michael@0 37 function tryBeginEnd(anim) {
michael@0 38 // Check that beginning / ending a particular animation element will trigger
michael@0 39 // exceptions.
michael@0 40 var didThrow = false;
michael@0 41 ok(anim, "need a non-null animate element");
michael@0 42 try {
michael@0 43 anim.beginElement();
michael@0 44 } catch (e) {
michael@0 45 didThrow = true;
michael@0 46 }
michael@0 47 ok(didThrow, "beginElement should fail");
michael@0 48
michael@0 49 didThrow = false;
michael@0 50 try {
michael@0 51 anim.endElement();
michael@0 52 } catch (e) {
michael@0 53 didThrow = true;
michael@0 54 }
michael@0 55 ok(didThrow, "endElement should fail");
michael@0 56 }
michael@0 57
michael@0 58 function main() {
michael@0 59 var xhr = new XMLHttpRequest();
michael@0 60 xhr.open("GET", "smilXHR_helper.svg", false);
michael@0 61 xhr.send();
michael@0 62 var xdoc = xhr.responseXML;
michael@0 63
michael@0 64 var svg = xdoc.getElementById("svg");
michael@0 65 var circ = xdoc.getElementById("circ");
michael@0 66 var animXML = xdoc.getElementById("animXML");
michael@0 67 var animCSS = xdoc.getElementById("animCSS");
michael@0 68
michael@0 69 tryPausing(svg);
michael@0 70 trySeeking(svg);
michael@0 71 tryBeginEnd(animXML);
michael@0 72 tryBeginEnd(animCSS);
michael@0 73
michael@0 74 // Check that the actual values of our animated attr/prop aren't affected
michael@0 75 is(circ.cx.animVal.value, circ.cx.baseVal.value,
michael@0 76 "animation of attribute shouldn't be taking effect");
michael@0 77 is(SMILUtil.getComputedStyleSimple(circ, "opacity"), "1",
michael@0 78 "animation of CSS property shouldn't be taking effect");
michael@0 79
michael@0 80 SimpleTest.finish();
michael@0 81 }
michael@0 82
michael@0 83 window.addEventListener("load", main, false);
michael@0 84 ]]>
michael@0 85 </script>
michael@0 86 </pre>
michael@0 87 </body>
michael@0 88 </html>

mercurial