dom/smil/test/test_smilCSSInherit.xhtml

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/smil/test/test_smilCSSInherit.xhtml	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,85 @@
     1.4 +<html xmlns="http://www.w3.org/1999/xhtml">
     1.5 +<head>
     1.6 +  <title>Test for Animation Behavior on CSS Properties</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 +<p id="display"></p>
    1.13 +<div id="content" style="display: none">
    1.14 +<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="300px" height="200px"
    1.15 +     onload="this.pauseAnimations()">
    1.16 +  <!--  At 50% through the animation, the following should be true:
    1.17 +   * First <g> has font-size = 5px (1/2 between 0px and 10px)
    1.18 +   * Next <g> has font-size = 10px (1/2 between inherit=5px and 15px)
    1.19 +   * Next <g> has font-size = 15px (1/2 between inherit=10px and 20px)
    1.20 +   * Next <g> has font-size = 20px (1/2 between inherit=15px and 25px)
    1.21 +   * Next <g> has font-size = 25px (1/2 between inherit=20px and 30px)
    1.22 +   * Next <g> has font-size = 30px (1/2 between inherit=25px and 35px)
    1.23 +   * Next <g> has font-size = 35px (1/2 between inherit=30px and 40px)
    1.24 +   * Next <g> has font-size = 40px (1/2 between inherit=35px and 45px)
    1.25 +   * Next <g> has font-size = 45px (1/2 between inherit=40px and 50px)
    1.26 +   * Next <g> has font-size = 50px (1/2 between inherit=45px and 55px)
    1.27 +   * <text> has font-size = 75px (1/2 between inherit=50px and 100px)
    1.28 +  -->
    1.29 +  <g><animate attributeName="font-size" attributeType="CSS"
    1.30 +              from="0px"     to="10px" begin="0s" dur="1s"/>
    1.31 +  <g><animate attributeName="font-size" attributeType="CSS"
    1.32 +              from="inherit" to="15px" begin="0s" dur="1s"/>
    1.33 +  <g><animate attributeName="font-size" attributeType="CSS"
    1.34 +              from="inherit" to="20px" begin="0s" dur="1s"/>
    1.35 +  <g><animate attributeName="font-size" attributeType="CSS"
    1.36 +              from="inherit" to="25px" begin="0s" dur="1s"/>
    1.37 +  <g><animate attributeName="font-size" attributeType="CSS"
    1.38 +              from="inherit" to="30px" begin="0s" dur="1s"/>
    1.39 +  <g><animate attributeName="font-size" attributeType="CSS"
    1.40 +              from="inherit" to="35px" begin="0s" dur="1s"/>
    1.41 +  <g><animate attributeName="font-size" attributeType="CSS"
    1.42 +              from="inherit" to="40px" begin="0s" dur="1s"/>
    1.43 +  <g><animate attributeName="font-size" attributeType="CSS"
    1.44 +              from="inherit" to="45px" begin="0s" dur="1s"/>
    1.45 +  <g><animate attributeName="font-size" attributeType="CSS"
    1.46 +              from="inherit" to="50px" begin="0s" dur="1s"/>
    1.47 +  <g><animate attributeName="font-size" attributeType="CSS"
    1.48 +              from="inherit" to="55px" begin="0s" dur="1s"/>
    1.49 +  <text y="100px" x="0px">
    1.50 +    abc
    1.51 +    <animate attributeName="font-size" attributeType="CSS"
    1.52 +             from="inherit" to="100px" begin="0s" dur="1s"/>
    1.53 +  </text></g></g></g></g></g></g></g></g></g></g>
    1.54 +</svg>
    1.55 +</div>
    1.56 +<pre id="test">
    1.57 +<script class="testbody" type="text/javascript">
    1.58 +<![CDATA[
    1.59 +SimpleTest.waitForExplicitFinish();
    1.60 +
    1.61 +function main() {
    1.62 +  // Pause & seek to halfway through animation
    1.63 +  var svg = SMILUtil.getSVGRoot();
    1.64 +  ok(svg.animationsPaused(), "should be paused by <svg> load handler");
    1.65 +  is(svg.getCurrentTime(), 0, "should be paused at 0 in <svg> load handler");
    1.66 +  svg.setCurrentTime(0.5);
    1.67 +
    1.68 +  var text = document.getElementsByTagName("text")[0];
    1.69 +  var computedVal = SMILUtil.getComputedStyleSimple(text, "font-size");
    1.70 +  var expectedVal = "75px";
    1.71 +
    1.72 +  // NOTE: There's a very small chance (1/11! = 1/39,916,800) that we'll happen
    1.73 +  // to composite our 11 animations in the correct order, in which cast this
    1.74 +  // "todo_is" test would sporadically pass. I think this is infrequent enough
    1.75 +  // to accept as a sporadic pass rate until this bug is fixed (at which point
    1.76 +  // this "todo_is" will become an "is")
    1.77 +  todo_is(computedVal, expectedVal,
    1.78 +         "deeply-inherited font-size halfway through animation");
    1.79 +
    1.80 +  SimpleTest.finish();
    1.81 +}
    1.82 +
    1.83 +window.addEventListener("load", main, false);
    1.84 +]]>
    1.85 +</script>
    1.86 +</pre>
    1.87 +</body>
    1.88 +</html>

mercurial