tor-browser

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

animate-end-attribute-numeric-precision.html (1594B)


      1 <!doctype html>
      2 <html>
      3 <meta charset="utf-8">
      4 <title>Tests end conditions are respected properly near the limits of float numeric precision</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", "100");
     20 rect.setAttribute("width", "100");
     21 rect.setAttribute("height", "100");
     22 rect.setAttribute("fill", "green");
     23 
     24 var animate = createSVGElement("animate");
     25 animate.setAttribute("id", "animation");
     26 animate.setAttribute("attributeName", "x");
     27 animate.setAttribute("values", "0;300");
     28 animate.setAttribute("begin", "0.333333333333333s");
     29 animate.setAttribute("dur", "0.4256483205159505s");
     30 animate.setAttribute("fill", "freeze");
     31 rect.appendChild(animate);
     32 rootSVGElement.appendChild(rect);
     33 
     34 // Setup animation test
     35 function sample1() {
     36    assert_approx_equals(rect.x.animVal.value, 100, epsilon);
     37    assert_equals(rect.x.baseVal.value, 100);
     38 }
     39 
     40 function sample2() {
     41    assert_approx_equals(rect.x.animVal.value, 300, epsilon);
     42    assert_equals(rect.x.baseVal.value, 100);
     43 }
     44 
     45 smil_async_test((t) => {
     46    const expectedValues = [
     47        // [animationId, time, sampleCallback]
     48        ["animation", 0.0, sample1],
     49        ["animation", 1.0, sample2]
     50    ];
     51 
     52    runAnimationTest(t, expectedValues);
     53 });
     54 
     55 var animationStartsImmediately = true;
     56 
     57 </script>