tor-browser

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

animate-elem-18-t-drt.html (6767B)


      1 <!doctype html>
      2 <html>
      3 <meta charset="utf-8">
      4 <title>A copy of the corresponding W3C-SVG-1.1 test, which dumps the animation at certain times</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 
     10 <!--======================================================================-->
     11 <!--=  Copyright 2000 World Wide Web Consortium, (Massachusetts          =-->
     12 <!--=  Institute of Technology, Institut National de Recherche en        =-->
     13 <!--=  Informatique et en Automatique, Keio University). All Rights      =-->
     14 <!--=  Reserved. See http://www.w3.org/Consortium/Legal/.                =-->
     15 <!--======================================================================-->
     16 <!-- =====================================================================-->
     17 <!--                                                                      -->
     18 <!-- animation-add-BE-08.svg                                              -->
     19 <!-- renamed for 1.1 suite to animate-elem-07-f.svg                       -->
     20 <!-- renamed and split for svgt/b to animate-elem-18-t.svg              -->
     21 <!--                                                                      -->
     22 <!-- Test possible values for 'keyTimes'                                  -->
     23 <!--                                                                      -->
     24 <!-- Author : Jon Ferraiolo 11-Aug-2000                                   -->
     25 <!-- Revised for 1.1 : Mathias Larsson Carlander Feb/12/2002              -->
     26 <!-- Revised for svgt/b: Ola Andersson Jun/26/2002                        -->
     27 <!--                                                                      -->
     28 <!-- History:                                                             -->
     29 <!--  11-Aug-2000, JF: Serial#1 created.                                  -->
     30 <!--                                                                      -->
     31 <!-- =====================================================================-->
     32 <!--======================================================================-->
     33 <!--= Note. After October 2000, revision history is kept as CVS 'commit' =-->
     34 <!--= log messages, and therefore is no longer in the preceding preamble.=-->
     35 <!--======================================================================-->
     36 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"  id="svg-root" width="100%" height="100%" viewBox="0 0 480 360" version="1.1" baseProfile="tiny">
     37   <SVGTestCase xmlns="http://www.w3.org/2000/02/svg/testsuite/description/">
     38      <OperatorScript version="$Revision: 1.1 $" testname="animate-elem-07-t-e.svg">
     39         <Paragraph>
     40            Test 'calcMode'=discrete
     41         </Paragraph>
     42         <Paragraph>
     43            One animation has been defined to animate the height of a rectangle. Ruler lines and text are provided
     44            to help show what the correct behavior is. The red text shows the values for the 'calcMode' and 'keyTimes' attributes. The
     45            black text and ruler lines help show the size and movement of the rectangle over time.
     46         </Paragraph>
     47         <Paragraph>
     48             This test shows an animation with calcMode="discrete" (i.e., a jumping animation).
     49         </Paragraph>
     50      </OperatorScript>
     51   </SVGTestCase>
     52   <title id="test-title">animate-elem-18-t</title>
     53   <desc id="test-desc">Test possible values for 'keyTimes'</desc>
     54   <!--======================================================================-->
     55   <!--Content of Test Case follows...                  =====================-->
     56   <!--======================================================================-->
     57   <g id="test-body-content">
     58      <text font-family="Arial" fill="red" font-size="40"  x="3" y="45">calcMode="discrete"</text>
     59      <text font-family="Arial" fill="red" font-size="40"  x="3" y="100">keyTimes="0;.2;.6;.8"</text>
     60      <g xml:space="preserve" font-family="Arial" font-size="13.5" stroke-width="3" >
     61         <g transform="translate(150,140)">
     62            <text font-size="36" x="-140" y="140">Time (s):</text>
     63            <text font-size="36" x="290" y="140">0</text>
     64            <line x1="300" y1="0" x2="300" y2="100" fill="none" stroke="#880000" />
     65            <text font-size="36" x="245" y="140">2</text>
     66            <line x1="255" y1="0" x2="255" y2="100" fill="none" stroke="#880000" />
     67            <text font-size="36" x="170" y="140">6</text>
     68            <line x1="180" y1="0" x2="180" y2="100" fill="none" stroke="#880000" />
     69            <text font-size="36" x="20" y="140">8</text>
     70            <line x1="30" y1="0" x2="30" y2="100" fill="none" stroke="#880000" />
     71            <rect x="0" y="0" width="300" height="80" fill="#44AAFF" stroke="#880088" stroke-width="4" >
     72               <animate id="an1" attributeName="width" calcMode="discrete" values="300;255;180;30" keyTimes="0;.2;.6;.8" begin="0s" dur="10s" fill="freeze"/>
     73            </rect>
     74 
     75         </g>
     76 
     77      </g>
     78   </g>
     79   <text id="revision" x="10" y="340" font-size="40" stroke="none" fill="black">$Revision: 1.1 $</text>
     80   <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/>
     81  <script>
     82    // Pause the animation at t=0.
     83    document.querySelector("svg").pauseAnimations();
     84  </script>
     85 </svg>
     86 
     87 <script>
     88 var rootSVGElement = document.querySelector("svg");
     89 var epsilon = 1.0;
     90 
     91 // Setup animation test
     92 function sample1() { // From 0s to 2s
     93    assert_approx_equals(rect.width.animVal.value, 300, epsilon);
     94    assert_equals(rect.width.baseVal.value, 300);
     95 }
     96 
     97 function sample2() { // From 2s to 6s
     98    assert_approx_equals(rect.width.animVal.value, 255, epsilon);
     99    assert_equals(rect.width.baseVal.value, 300);
    100 }
    101 
    102 function sample3() { // From 6s to 8s
    103    assert_approx_equals(rect.width.animVal.value, 180, epsilon);
    104    assert_equals(rect.width.baseVal.value, 300);
    105 }
    106 
    107 function sample4() { // From 8s to 10s
    108    assert_approx_equals(rect.width.animVal.value, 30, epsilon);
    109    assert_equals(rect.width.baseVal.value, 300);
    110 }
    111 
    112 smil_async_test((t) => {
    113    rect = rootSVGElement.ownerDocument.getElementsByTagName("rect")[0];
    114 
    115    // Sampling according to: keyTimes="0;.2;.6;.8" begin="0s" dur="10s"
    116    const expectedValues = [
    117        // [animationId, time, sampleCallback]
    118        ["an1", 0.0,    sample1],
    119        ["an1", 1.999,  sample1],
    120        ["an1", 2.001,  sample2],
    121        ["an1", 5.999,  sample2],
    122        ["an1", 6.001,  sample3],
    123        ["an1", 7.999,  sample3],
    124        ["an1", 8.001,  sample4],
    125        ["an1", 9.999,  sample4],
    126        ["an1", 10.001, sample4],
    127        ["an1", 60.0,   sample4]
    128    ];
    129 
    130    runAnimationTest(t, expectedValues);
    131 });
    132 
    133 window.animationStartsImmediately = true;
    134 
    135 </script>