tor-browser

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

animateMotion-still.html (1611B)


      1 <!doctype html>
      2 <html>
      3 <meta charset="utf-8">
      4 <title>Test animations that only express an offset</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  <rect width="50" height="50" x="0" y="0" fill="green">
     11    <animateMotion id="anim" path="M 100 100 L 100 100"
     12        begin="0s" dur="2s" repeatCount="2" accumulate="sum" fill="remove" />
     13  </rect>
     14 </svg>
     15 
     16 <script>
     17 var rootSVGElement = document.querySelector("svg");
     18 var epsilon = 1.0;
     19 
     20 // Setup animation test
     21 function sample1() {
     22    assert_approx_equals(rootSVGElement.getBBox().x, 100, epsilon);
     23 }
     24 
     25 function sample2() {
     26    assert_approx_equals(rootSVGElement.getBBox().x, 200, epsilon);
     27 }
     28 
     29 function sample3() {
     30    assert_approx_equals(rootSVGElement.getBBox().x, 200, epsilon);
     31 }
     32 
     33 function sample4() {
     34    assert_approx_equals(rootSVGElement.getBBox().x, 0, epsilon);
     35 }
     36 
     37 function sample5() {
     38    assert_approx_equals(rootSVGElement.getBBox().x, 0, epsilon);
     39 }
     40 
     41 smil_async_test((t) => {
     42    var rects = rootSVGElement.ownerDocument.getElementsByTagName("rect");
     43    rect1 = rects[0];
     44 
     45    const expectedValues = [
     46        // [animationId, time, sampleCallback]
     47        ["anim", 1.0,   sample1],
     48        ["anim", 2.0,   sample2],
     49        ["anim", 3.0,   sample3],
     50        ["anim", 4.0,   sample4],
     51        ["anim", 5.0,   sample5]
     52    ];
     53 
     54    runAnimationTest(t, expectedValues);
     55 });
     56 
     57 window.animationStartsImmediately = true;
     58 
     59 </script>