tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_smilCSSInherit.xhtml (3889B)


      1 <html xmlns="http://www.w3.org/1999/xhtml">
      2 <head>
      3  <title>Test for Animation Behavior on CSS Properties</title>
      4  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      5  <script type="text/javascript" src="smilTestUtils.js"></script>
      6  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
      7 </head>
      8 <body>
      9 <p id="display"></p>
     10 <div id="content" style="display: none">
     11 <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="300px" height="200px"
     12     onload="this.pauseAnimations()">
     13  <!--  At 50% through the animation, the following should be true:
     14   * First <g> has font-size = 5px (1/2 between 0px and 10px)
     15   * Next <g> has font-size = 10px (1/2 between inherit=5px and 15px)
     16   * Next <g> has font-size = 15px (1/2 between inherit=10px and 20px)
     17   * Next <g> has font-size = 20px (1/2 between inherit=15px and 25px)
     18   * Next <g> has font-size = 25px (1/2 between inherit=20px and 30px)
     19   * Next <g> has font-size = 30px (1/2 between inherit=25px and 35px)
     20   * Next <g> has font-size = 35px (1/2 between inherit=30px and 40px)
     21   * Next <g> has font-size = 40px (1/2 between inherit=35px and 45px)
     22   * Next <g> has font-size = 45px (1/2 between inherit=40px and 50px)
     23   * Next <g> has font-size = 50px (1/2 between inherit=45px and 55px)
     24   * <text> has font-size = 75px (1/2 between inherit=50px and 100px)
     25  -->
     26  <g><animate attributeName="font-size" attributeType="CSS"
     27              from="0px"     to="10px" begin="0s" dur="1s"/>
     28  <g><animate attributeName="font-size" attributeType="CSS"
     29              from="inherit" to="15px" begin="0s" dur="1s"/>
     30  <g><animate attributeName="font-size" attributeType="CSS"
     31              from="inherit" to="20px" begin="0s" dur="1s"/>
     32  <g><animate attributeName="font-size" attributeType="CSS"
     33              from="inherit" to="25px" begin="0s" dur="1s"/>
     34  <g><animate attributeName="font-size" attributeType="CSS"
     35              from="inherit" to="30px" begin="0s" dur="1s"/>
     36  <g><animate attributeName="font-size" attributeType="CSS"
     37              from="inherit" to="35px" begin="0s" dur="1s"/>
     38  <g><animate attributeName="font-size" attributeType="CSS"
     39              from="inherit" to="40px" begin="0s" dur="1s"/>
     40  <g><animate attributeName="font-size" attributeType="CSS"
     41              from="inherit" to="45px" begin="0s" dur="1s"/>
     42  <g><animate attributeName="font-size" attributeType="CSS"
     43              from="inherit" to="50px" begin="0s" dur="1s"/>
     44  <g><animate attributeName="font-size" attributeType="CSS"
     45              from="inherit" to="55px" begin="0s" dur="1s"/>
     46  <text y="100px" x="0px">
     47    abc
     48    <animate attributeName="font-size" attributeType="CSS"
     49             from="inherit" to="100px" begin="0s" dur="1s"/>
     50  </text></g></g></g></g></g></g></g></g></g></g>
     51 </svg>
     52 </div>
     53 <pre id="test">
     54 <script class="testbody" type="text/javascript">
     55 <![CDATA[
     56 SimpleTest.waitForExplicitFinish();
     57 
     58 function main() {
     59  // Pause & seek to halfway through animation
     60  var svg = SMILUtil.getSVGRoot();
     61  ok(svg.animationsPaused(), "should be paused by <svg> load handler");
     62  is(svg.getCurrentTime(), 0, "should be paused at 0 in <svg> load handler");
     63  svg.setCurrentTime(0.5);
     64 
     65  var text = document.getElementsByTagName("text")[0];
     66  var computedVal = SMILUtil.getComputedStyleSimple(text, "font-size");
     67  var expectedVal = "75px";
     68 
     69  // NOTE: There's a very small chance (1/11! = 1/39,916,800) that we'll happen
     70  // to composite our 11 animations in the correct order, in which cast this
     71  // "todo_is" test would sporadically pass. I think this is infrequent enough
     72  // to accept as a sporadic pass rate until this bug is fixed (at which point
     73  // this "todo_is" will become an "is")
     74  todo_is(computedVal, expectedVal,
     75         "deeply-inherited font-size halfway through animation");
     76 
     77  SimpleTest.finish();
     78 }
     79 
     80 window.addEventListener("load", main);
     81 ]]>
     82 </script>
     83 </pre>
     84 </body>
     85 </html>