tor-browser

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

svgstring-animation-fallback-to-discrete.html (1799B)


      1 <!doctype html>
      2 <html>
      3 <title>Tests fallback to calcMode='discrete' on animation of SVGString with 'values'.</title>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="/resources/SVGAnimationTestCase-testharness.js"></script>
      7 
      8 <svg>
      9 </svg>
     10 
     11 <script>
     12 var rootSVGElement = document.querySelector("svg");
     13 var epsilon = 1.0;
     14 
     15 // Setup test document
     16 var rect = createSVGElement("rect");
     17 rect.setAttribute("id", "rect");
     18 rect.setAttribute("width", "100");
     19 rect.setAttribute("height", "100");
     20 rect.setAttribute("fill", "green");
     21 rect.setAttribute("onclick", "executeTest()");
     22 
     23 var animate = createSVGElement("animate");
     24 animate.setAttribute("id", "animation");
     25 animate.setAttribute("attributeName", "visibility");
     26 animate.setAttribute("begin", "0s");
     27 animate.setAttribute("dur", "6s");
     28 animate.setAttribute("calcMode", "linear");
     29 animate.setAttribute("values", "visible ; hidden ; visible");
     30 rect.appendChild(animate);
     31 rootSVGElement.appendChild(rect);
     32 
     33 // Setup animation test
     34 function sample1() {
     35    // Check initial/end conditions
     36    assert_equals(getComputedStyle(rect).visibility, 'visible');
     37    assert_equals(rect.style.visibility, "");
     38 }
     39 
     40 function sample2() {
     41    assert_equals(getComputedStyle(rect).visibility, 'hidden');
     42    assert_equals(rect.style.visibility, "");
     43 }
     44 
     45 function sample3() {
     46    assert_equals(getComputedStyle(rect).visibility, 'visible');
     47    assert_equals(rect.style.visibility, "");
     48 }
     49 
     50 smil_async_test((t) => {
     51    const expectedValues = [
     52        // [animationId, time, sampleCallback]
     53        ["animation", 1.999, sample1],
     54        ["animation", 2.001, sample2],
     55        ["animation", 5.999, sample3],
     56        ["animation", 6.001, sample1]
     57    ];
     58 
     59    runAnimationTest(t, expectedValues);
     60 });
     61 
     62 </script>