tor-browser

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

svgnumber-animation-3.html (1489B)


      1 <!doctype html>
      2 <html>
      3 <meta charset="utf-8">
      4 <title>Test for SVGNumber animation with invalid units.</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>
     10 </svg>
     11 
     12 <script>
     13 var rootSVGElement = document.querySelector("svg");
     14 var epsilon = 1.0;
     15 
     16 // Setup test document
     17 var rect = createSVGElement("rect");
     18 rect.setAttribute("id", "rect");
     19 rect.setAttribute("x", "0");
     20 rect.setAttribute("width", "100");
     21 rect.setAttribute("height", "100");
     22 rect.setAttribute("fill", "green");
     23 rect.setAttribute("opacity", "0");
     24 rect.setAttribute("onclick", "executeTest()");
     25 
     26 var animate = createSVGElement("animate");
     27 animate.setAttribute("id", "animation");
     28 animate.setAttribute("attributeName", "opacity");
     29 animate.setAttribute("begin", "0s");
     30 animate.setAttribute("dur", "4s");
     31 animate.setAttribute("from", "0px");
     32 animate.setAttribute("to", "1px");
     33 rect.appendChild(animate);
     34 rootSVGElement.appendChild(rect);
     35 
     36 // Setup animation test
     37 function sample() {
     38    // Check initial/end conditions
     39    assert_equals(getComputedStyle(rect).opacity, '0');
     40 }
     41 
     42 smil_async_test((t) => {
     43    const expectedValues = [
     44        // [animationId, time, sampleCallback]
     45        ["animation", 0.0,   sample],
     46        ["animation", 2.0,   sample],
     47        ["animation", 3.999, sample],
     48        ["animation", 4.001, sample]
     49    ];
     50 
     51    runAnimationTest(t, expectedValues);
     52 });
     53 
     54 </script>