tor-browser

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

struct-svg-02-f-isvalid.html (6036B)


      1 <!DOCTYPE html>
      2 <html lang='en'>
      3 <head>
      4 <title>struct-svg-02-f-manual.svg</title>
      5 <meta charset='utf-8'>
      6 </head>
      7 <body>
      8 <h1>Source SVG: struct-svg-02-f-manual.svg</h1>
      9 <svg id="svg-root" width="100%" height="100%"
     10  viewBox="0 0 480 360" xmlns="http://www.w3.org/2000/svg"
     11  xmlns:xlink="http://www.w3.org/1999/xlink">
     12  <!--======================================================================-->
     13  <!--=  Copyright 2008 World Wide Web Consortium, (Massachusetts          =-->
     14  <!--=  Institute of Technology, European Research Consortium for         =-->
     15  <!--=  Informatics and Mathematics (ERCIM), Keio University).            =-->
     16  <!--=  All Rights Reserved.                                              =-->
     17  <!--=  See http://www.w3.org/Consortium/Legal/.                          =-->
     18  <!--======================================================================-->
     19  
     20  <title id="test-title">$RCSfile: struct-svg-02-f.svg,v $</title>
     21  <defs>
     22    <font-face
     23      font-family="SVGFreeSansASCII"
     24      unicode-range="U+0-7F">
     25      <font-face-src>
     26        <font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/>
     27      </font-face-src>
     28    </font-face>
     29  </defs>
     30  <g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18">
     31    <script type="text/ecmascript" xlink:href="../resources/testharness.js"/>
     32    
     33    <!-- The testroot is here only to get a predictable 480x360 viewport -->
     34    <svg id="testroot" width="480" height="360">
     35     <svg id="testSVG1" />
     36     <svg id="testSVG2" />
     37     <svg id="subSVG" width="300" height="175"/>
     38 	</svg>
     39 
     40    <g id="testoutput"/>
     41    
     42    <!-- Cover the whole testframe with a simple visual result -->
     43    <rect id="status" width="100%" height="100%" fill="none"/>
     44    
     45    <script><![CDATA[
     46      var passes = 0;
     47      var ypos = 50;
     48 
     49      function verify(str, result)
     50      {
     51        var g = document.createElementNS("http://www.w3.org/2000/svg", "g");
     52        var r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
     53        var t = document.createElementNS("http://www.w3.org/2000/svg", "text");
     54        var tc = document.createTextNode(str); 
     55        t.appendChild(tc);
     56        t.setAttribute("class", "result");
     57        t.setAttribute("font-family", "monospace");
     58        t.setAttribute("font-size", "9px");
     59        t.setAttribute("fill", "black");
     60        t.setAttribute("x", "10");
     61        t.setAttribute("y", "7");
     62        r.setAttribute("y", "1");
     63        r.setAttribute("width", "5");
     64        r.setAttribute("height", "5");
     65        g.setAttribute("class", result ? "passed" : "failed");
     66        g.setAttribute("fill", result ? "lime" : "red");
     67        g.appendChild(r);
     68        g.appendChild(t);
     69        g.setAttribute("transform", "translate(10 " + ypos + ")");
     70        ypos += 10;
     71        document.getElementById("testoutput").appendChild(g);
     72        
     73        if (result)
     74          passes++;
     75      }
     76 
     77      try
     78      {
     79          var testSVG = document.getElementById("testSVG1");
     80          var subSVG = document.getElementById("subSVG");
     81          var status = document.getElementById("status");
     82          
     83          var base = testSVG.width.baseVal;
     84          
     85          verify("value: " + base.value, base.value == 480);
     86          test(function() {assert_equals(base.value, 480)}, "Assert that the width baseVal is 100% computed to user units.");
     87 
     88          verify("valueInSpecifiedUnits: " + base.valueInSpecifiedUnits, base.valueInSpecifiedUnits == 100);
     89          test(function() {assert_equals(base.value, 100)}, "Assert that the default width baseVal is 100.");
     90          
     91          // set the value in user units and then read it back
     92          base.value = 240;
     93          verify("value: " + base.value, base.value == 240);
     94          test(function() {assert_equals(base.value, 240)}, "Assert that the width baseVal is 240 after setting it.");
     95          verify("valueInSpecifiedUnits: " + base.valueInSpecifiedUnits, base.valueInSpecifiedUnits == 50);
     96          test(function() {assert_equals(base.valueInSpecifiedUnits, 50)}, "Assert that the value in specified units is now 50.");
     97          
     98          // move the svg to be child of another viewport and read values again
     99          subSVG.appendChild(testSVG);
    100          verify("value: " + base.value, base.value == 150);
    101          test(function() {assert_equals(base.value, 150)}, "Assert that the value changes to 150 after being moved to a new viewport.");
    102          verify("valueInSpecifiedUnits: " + base.valueInSpecifiedUnits, base.valueInSpecifiedUnits == 50);
    103          test(function() {assert_equals(base.valueInSpecifiedUnits, 50)}, "Assert that the value in specified units is still 50 after being moved to a new viewport.");
    104          
    105          // move an svg that hasn't been modified to another viewport and read values
    106          testSVG = document.getElementById("testSVG2");
    107          subSVG.appendChild(testSVG);
    108          base = testSVG.width.baseVal;
    109          verify("value: " + base.value, base.value == 300);
    110          test(function() {assert_equals(base.value, 300)}, "Assert that the width baseVal is 300 user units after being moved to a new viewport.");
    111      }
    112      catch(ex)
    113      {
    114      }
    115      
    116      status.setAttribute("fill", passes == 7 ? "lime" : "red");
    117      test(function() {assert_equals(passes,7)}, "Assert that all subtests passed.");
    118  ]]></script>
    119 
    120  </g>
    121  <g font-family="SVGFreeSansASCII,sans-serif" font-size="32">
    122    <text id="revision" x="10" y="340" stroke="none"
    123      fill="black">$Revision: 1.5 $</text>
    124  </g>
    125  <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000"/>
    126  <!-- comment out this watermark once the test is approved -->
    127  <g id="draft-watermark">
    128    <rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/>
    129    <text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240"
    130      text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text>
    131  </g>
    132 </svg>
    133 </body>
    134 </html>