1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/smil/test/test_smilXHR.xhtml Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,88 @@ 1.4 +<html xmlns="http://www.w3.org/1999/xhtml"> 1.5 +<head> 1.6 + <title>Test for SMIL Behavior in Data Documents</title> 1.7 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.8 + <script type="text/javascript" src="smilTestUtils.js"></script> 1.9 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.10 +</head> 1.11 +<body> 1.12 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=529387">Mozilla Bug 529387</a> 1.13 +<p id="display"></p> 1.14 +<div id="content" style="display: none"> 1.15 +</div> 1.16 +<pre id="test"> 1.17 +<script class="testbody" type="text/javascript"> 1.18 +<![CDATA[ 1.19 +/** Test for SMIL Behavior in Data Documents, with XMLHttpRequest **/ 1.20 + 1.21 +SimpleTest.waitForExplicitFinish(); 1.22 + 1.23 +function tryPausing(svg) { 1.24 + // Check that pausing has no effect 1.25 + ok(!svg.animationsPaused(), 1.26 + "shouldn't be paused (because we shouldn't have even started"); 1.27 + svg.pauseAnimations(); 1.28 + ok(!svg.animationsPaused(), "attempts to pause should have no effect"); 1.29 + svg.unpauseAnimations(); 1.30 + ok(!svg.animationsPaused(), "still shouldn't be paused, after pause/unpause"); 1.31 +} 1.32 + 1.33 +function trySeeking(svg) { 1.34 + // Check that seeking is ineffective 1.35 + is(svg.getCurrentTime(), 0, "should start out at time=0"); 1.36 + svg.setCurrentTime(1); 1.37 + is(svg.getCurrentTime(), 0, "shouldn't be able to seek away from time=0"); 1.38 +} 1.39 + 1.40 +function tryBeginEnd(anim) { 1.41 + // Check that beginning / ending a particular animation element will trigger 1.42 + // exceptions. 1.43 + var didThrow = false; 1.44 + ok(anim, "need a non-null animate element"); 1.45 + try { 1.46 + anim.beginElement(); 1.47 + } catch (e) { 1.48 + didThrow = true; 1.49 + } 1.50 + ok(didThrow, "beginElement should fail"); 1.51 + 1.52 + didThrow = false; 1.53 + try { 1.54 + anim.endElement(); 1.55 + } catch (e) { 1.56 + didThrow = true; 1.57 + } 1.58 + ok(didThrow, "endElement should fail"); 1.59 +} 1.60 + 1.61 +function main() { 1.62 + var xhr = new XMLHttpRequest(); 1.63 + xhr.open("GET", "smilXHR_helper.svg", false); 1.64 + xhr.send(); 1.65 + var xdoc = xhr.responseXML; 1.66 + 1.67 + var svg = xdoc.getElementById("svg"); 1.68 + var circ = xdoc.getElementById("circ"); 1.69 + var animXML = xdoc.getElementById("animXML"); 1.70 + var animCSS = xdoc.getElementById("animCSS"); 1.71 + 1.72 + tryPausing(svg); 1.73 + trySeeking(svg); 1.74 + tryBeginEnd(animXML); 1.75 + tryBeginEnd(animCSS); 1.76 + 1.77 + // Check that the actual values of our animated attr/prop aren't affected 1.78 + is(circ.cx.animVal.value, circ.cx.baseVal.value, 1.79 + "animation of attribute shouldn't be taking effect"); 1.80 + is(SMILUtil.getComputedStyleSimple(circ, "opacity"), "1", 1.81 + "animation of CSS property shouldn't be taking effect"); 1.82 + 1.83 + SimpleTest.finish(); 1.84 +} 1.85 + 1.86 +window.addEventListener("load", main, false); 1.87 +]]> 1.88 +</script> 1.89 +</pre> 1.90 +</body> 1.91 +</html>