tor-browser

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

test_nonAnimStrings.xhtml (2821B)


      1 <html xmlns="http://www.w3.org/1999/xhtml">
      2 <!--
      3 https://bugzilla.mozilla.org/show_bug.cgi?id=589436
      4 -->
      5 <head>
      6  <title>Test for non-animated strings</title>
      7  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      8  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
      9 </head>
     10 <body>
     11 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=589436">Mozilla Bug 589436</a>
     12 <p id="display"></p>
     13 <div id="content" style="display: none">
     14 <svg id="svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="120px" height="120px"
     15     onload="this.pauseAnimations()">
     16  <defs>
     17    <path id="moveFarAway"      d="M300,300 h0"/>
     18    <path id="moveToUpperLeft"  d="M100,100 h0"/>
     19  </defs>
     20  <script id="script">
     21    <animate attributeName="xlink:href" from="" to="animated" dur="0.5s" begin="1s"
     22      fill="freeze" id="animate"/>
     23  </script>
     24  <rect class="test" x="0" y="0" width="50" height="50">
     25    <animateMotion begin="1" dur="1" fill="freeze">
     26      <mpath id="mpath" xlink:href="#moveFarAway">
     27        <animate attributeName="xlink:href" from="#moveFarAway" to="#moveToUpperLeft" dur="0.5s" begin="1s"
     28          fill="freeze"/>
     29      </mpath>
     30    </animateMotion>
     31  </rect>
     32 </svg>
     33 </div>
     34 <pre id="test">
     35 <script class="testbody" type="text/javascript">
     36 <![CDATA[
     37 /** Test some strings are not animatable **/
     38 
     39 /* Global Variables */
     40 var svg = document.getElementById("svg");
     41 var script = document.getElementById("script");
     42 var mpath = document.getElementById("mpath");
     43 var animate = document.getElementById("animate");
     44 
     45 SimpleTest.waitForExplicitFinish();
     46 
     47 function main() {
     48  ok(svg.animationsPaused(), "should be paused by <svg> load handler");
     49  is(svg.getCurrentTime(), 0, "should be paused at 0 in <svg> load handler");
     50 
     51  // Sanity check: check initial values
     52  is(script.href.baseVal, "", "Unexpected initial script baseVal");
     53  is(script.href.animVal, "", "Unexpected initial script animVal");
     54  is(mpath.href.baseVal, "#moveFarAway", "Unexpected initial mpath baseVal");
     55  is(mpath.href.animVal, "#moveFarAway", "Unexpected initial mpath animVal");
     56 
     57  // Move to the end of the animation - should make no difference
     58  svg.setCurrentTime(2);
     59 
     60  is(script.href.baseVal, "", "Unexpected value for script baseVal after animation");
     61  is(script.href.animVal, "", "Unexpected value for script animVal after animation");
     62  is(mpath.href.baseVal, "#moveFarAway", "Unexpected value for mpath baseVal after animation");
     63  is(mpath.href.animVal, "#moveFarAway", "Unexpected value for mpath animVal after animation");
     64 
     65  SimpleTest.finish();
     66 }
     67 
     68 if (animate && animate.targetElement) {
     69  window.addEventListener("load", main);
     70 } else {
     71  ok(true); // Skip tests but don't report 'todo' either
     72  SimpleTest.finish();
     73 }
     74 ]]>
     75 </script>
     76 </pre>
     77 </body>
     78 </html>