tor-browser

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

cyclic-syncbase.html (1484B)


      1 <!doctype html>
      2 <html>
      3 <meta charset="utf-8">
      4 <title>Test cyclic for svg animations for syncbases</title>
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script src="/resources/SVGAnimationTestCase-testharness.js"></script>
      8 
      9 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
     10  <animate id="anim" attributeName="visibility" to="visible" begin="0s" end="5s"/>
     11  <rect x="0" y="0" width="50" height="50" fill="green">
     12    <set attributeName="x" to="100" id="anim1" begin="0; anim2.end" dur="1s"/>
     13    <set attributeName="y" to="100" id="anim2" begin="anim1.end" dur="1s"/>
     14  </rect>
     15 </svg>
     16 
     17 <script>
     18 var rootSVGElement = document.querySelector("svg");
     19 var epsilon = 1.0;
     20 
     21 // Setup animation test
     22 function sample1() {
     23    assert_approx_equals(rootSVGElement.getBBox().x, 100, epsilon);
     24    assert_approx_equals(rootSVGElement.getBBox().y, 0, epsilon);
     25 }
     26 
     27 function sample2() {
     28    assert_approx_equals(rootSVGElement.getBBox().x, 0, epsilon);
     29    assert_approx_equals(rootSVGElement.getBBox().y, 100, epsilon);
     30 }
     31 
     32 smil_async_test((t) => {
     33 
     34    const expectedValues = [
     35        // [animationId, time, sampleCallback]
     36        ["anim", 0.01,   sample1],
     37        ["anim", 1.01,   sample2],
     38        ["anim", 2.01,   sample1],
     39        ["anim", 3.01,   sample2],
     40        ["anim", 4.01,   sample1]
     41    ];
     42 
     43    runAnimationTest(t, expectedValues);
     44 });
     45 
     46 window.animationStartsImmediately = true;
     47 
     48 </script>