tor-browser

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

svgstring-animation-1.html (1817B)


      1 <!doctype html>
      2 <html>
      3 <title>Test animVal support for SVGAnimatedString animations.</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 aElement = createSVGElement("a");
     17 aElement.setAttribute("target", "base");
     18 
     19 var textElement = createSVGElement("text");
     20 textElement.setAttribute("id", "text");
     21 textElement.setAttribute("y", "50");
     22 textElement.textContent = "Test";
     23 aElement.appendChild(textElement);
     24 rootSVGElement.appendChild(aElement);
     25 
     26 var animate = createSVGElement("animate");
     27 animate.setAttribute("id", "animation");
     28 animate.setAttribute("attributeName", "target");
     29 animate.setAttribute("begin", "0s");
     30 animate.setAttribute("dur", "4s");
     31 animate.setAttribute("values", "a;b");
     32 aElement.appendChild(animate);
     33 
     34 // Setup animation test
     35 function sample1() {
     36    assert_equals(aElement.target.animVal, "base");
     37    assert_equals(aElement.target.baseVal, "base");
     38 }
     39 
     40 function sample2() {
     41    assert_equals(aElement.target.animVal, "a");
     42    assert_equals(aElement.target.baseVal, "base");
     43 }
     44 
     45 function sample3() {
     46    assert_equals(aElement.target.animVal, "b");
     47    assert_equals(aElement.target.baseVal, "base");
     48 }
     49 
     50 smil_async_test((t) => {
     51    const expectedValues = [
     52        // [animationId, time, sampleCallback]
     53        ["animation", 0.0,   sample1],
     54        ["animation", 0.001, sample2],
     55        ["animation", 1.999, sample2],
     56        ["animation", 2.001, sample3],
     57        ["animation", 3.999, sample3],
     58        ["animation", 4.001, sample1]
     59    ];
     60 
     61    runAnimationTest(t, expectedValues);
     62 });
     63 
     64 window.animationStartsImmediately = true;
     65 
     66 </script>