gecko-dev/content/smil/test/test_smilSyncTransform.xhtml
Brian Birtles 7e4a16aa3b Bug 474357, Calls to setCurrentTime, beginElementAt etc. should update the DOM state immediately. r+sr=roc
--HG--
extra : rebase_source : 7c69aae13ee1c1b4fff077a046e042bae9a4970d
2009-01-22 14:00:27 +13:00

72 lines
2.2 KiB
HTML

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test for SMIL sync behaviour for transform types</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="120px" height="120px">
<circle cx="20" cy="20" r="15" fill="blue">
<animateTransform attributeName="transform" type="rotate"
from="90" to="180" begin="0s" dur="2s" fill="freeze"
additive="sum" id="anim1"/>
</circle>
<circle cx="20" cy="20" r="15" fill="blue">
<animateTransform attributeName="transform" type="scale"
from="1" to="2" begin="2s" dur="2s" id="anim2"/>
</circle>
</svg>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
<![CDATA[
/** Test for SMIL sync behavior for transform types **/
/* Global Variables */
var svg = document.getElementById("svg");
SimpleTest.waitForExplicitFinish();
function main() {
testChangeBaseVal(document.getElementById("anim1"));
SimpleTest.finish();
}
function testChangeBaseVal(anim) {
// Check that a change to the base value is updated even after animation is
// frozen
var target = anim.targetElement;
// we haven't fully implemented the transform type yet
// - when the target isn't animated baseVal and animVal may be the same object
// - attempts to change the animVal don't throw exceptions
// XXX in the future store the anim val here and query it
var transformList = target.transform;
// make sure element has ended
svg.setCurrentTime(anim.getSimpleDuration());
// check frozen value is applied
is(transformList.baseVal.numberOfItems, 0);
is(transformList.animVal.numberOfItems, 1);
// change base val and re-check
var newTransform = svg.createSVGTransform();
newTransform.setScale(1,2);
transformList.baseVal.appendItem(newTransform);
is(transformList.baseVal.numberOfItems, 1);
// Not done yet
todo_is(transformList.animVal.numberOfItems, 2);
}
window.addEventListener("load", main, false);
]]>
</script>
</pre>
</body>
</html>