1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/smil/test/test_smilSyncTransform.xhtml Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,66 @@ 1.4 +<html xmlns="http://www.w3.org/1999/xhtml"> 1.5 +<head> 1.6 + <title>Test for SMIL sync behaviour for transform types</title> 1.7 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.8 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.9 +</head> 1.10 +<body> 1.11 +<p id="display"></p> 1.12 +<div id="content" style="display: none"> 1.13 +<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="120px" height="120px"> 1.14 + <circle cx="20" cy="20" r="15" fill="blue"> 1.15 + <animateTransform attributeName="transform" type="rotate" 1.16 + from="90" to="180" begin="0s" dur="2s" fill="freeze" 1.17 + additive="sum" id="anim1"/> 1.18 + </circle> 1.19 + <circle cx="20" cy="20" r="15" fill="blue"> 1.20 + <animateTransform attributeName="transform" type="scale" 1.21 + from="1" to="2" begin="2s" dur="2s" id="anim2"/> 1.22 + </circle> 1.23 +</svg> 1.24 +</div> 1.25 +<pre id="test"> 1.26 +<script class="testbody" type="text/javascript"> 1.27 +<![CDATA[ 1.28 +/** Test for SMIL sync behavior for transform types **/ 1.29 + 1.30 +/* Global Variables */ 1.31 +var svg = document.getElementById("svg"); 1.32 + 1.33 +SimpleTest.waitForExplicitFinish(); 1.34 + 1.35 +function main() { 1.36 + testChangeBaseVal(document.getElementById("anim1")); 1.37 + SimpleTest.finish(); 1.38 +} 1.39 + 1.40 +function testChangeBaseVal(anim) { 1.41 + // Check that a change to the base value is updated even after animation is 1.42 + // frozen 1.43 + 1.44 + var target = anim.targetElement; 1.45 + 1.46 + var baseList = target.transform.baseVal; 1.47 + var animList = target.transform.animVal; 1.48 + 1.49 + // make sure element has ended 1.50 + svg.setCurrentTime(anim.getSimpleDuration()); 1.51 + 1.52 + // check frozen value is applied 1.53 + is(baseList.numberOfItems, 0); 1.54 + is(animList.numberOfItems, 1); 1.55 + 1.56 + // change base val and re-check 1.57 + var newTransform = svg.createSVGTransform(); 1.58 + newTransform.setScale(1,2); 1.59 + baseList.appendItem(newTransform); 1.60 + is(baseList.numberOfItems, 1); 1.61 + is(animList.numberOfItems, 2); 1.62 +} 1.63 + 1.64 +window.addEventListener("load", main, false); 1.65 +]]> 1.66 +</script> 1.67 +</pre> 1.68 +</body> 1.69 +</html>