tor-browser

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

test_markerOrient.xhtml (3634B)


      1 <html xmlns="http://www.w3.org/1999/xhtml">
      2 <!--
      3 https://bugzilla.mozilla.org/show_bug.cgi?id=892372
      4 -->
      5 <head>
      6  <title>Test for Bug 892372</title>
      7  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      8  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
      9  <script type="application/javascript">
     10  <![CDATA[
     11 
     12  /** Test for Bug 892372 */
     13  SimpleTest.waitForExplicitFinish();
     14 
     15  function testAutoIsSet(marker) {
     16    is(marker.orientType.baseVal, SVGMarkerElement.SVG_MARKER_ORIENT_AUTO,
     17       "orientType baseVal for auto");
     18    is(marker.orientType.animVal, SVGMarkerElement.SVG_MARKER_ORIENT_AUTO,
     19       "orientType animVal for auto");
     20    is(marker.orientAngle.baseVal.value, 0, "orientAngle baseVal for auto");
     21    is(marker.orientAngle.animVal.value, 0, "orientAngle animVal for auto");
     22  }
     23 
     24  function testAutoStartReverseIsSet(marker) {
     25    is(marker.orientType.baseVal, SVGMarkerElement.SVG_MARKER_ORIENT_AUTO_START_REVERSE,
     26       "orientType baseVal for auto-start-reverse");
     27    is(marker.orientType.animVal, SVGMarkerElement.SVG_MARKER_ORIENT_AUTO_START_REVERSE,
     28       "orientType animVal for auto-start-reverse");
     29    is(marker.orientAngle.baseVal.value, 0,
     30       "orientAngle baseVal for auto-start-reverse");
     31    is(marker.orientAngle.animVal.value, 0,
     32       "orientAngle animVal for auto-start-reverse");
     33  }
     34 
     35  function testAngleIsSet(marker, angleVal) {
     36    is(marker.orientType.baseVal, SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE,
     37       "orientType baseVal after numeric angle is set");
     38    is(marker.orientType.animVal, SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE,
     39       "orientType animVal after numeric angle is set");
     40    is(marker.orientAngle.baseVal.value, angleVal,
     41       "orientAngle baseVal after numeric angle is set");
     42    is(marker.orientAngle.animVal.value, angleVal,
     43       "orientAngle animVal after numeric angle is set");
     44  }
     45 
     46  function run() {
     47    var m = $("m");
     48 
     49    // Testing two conditions:
     50    // 1) If orient is set to a numeric angle and then set to auto or
     51    //    auto-start-reverse, orientAngle should return a value of 0
     52    // 2) If orient is set to something of type other than
     53    //    SVG_MARKER_ORIENT_ANGLE and then set to a numeric angle,
     54    //    orientType should return SVG_MARKER_ORIENT_ANGLE
     55 
     56    // default is orient="0"
     57    testAngleIsSet(m, 0);
     58 
     59    m.setOrientToAuto();
     60    testAutoIsSet(m);
     61 
     62    // testing condition 2 for an angle set using setOrientToAngle
     63    var a = $("svg").createSVGAngle();
     64    a.newValueSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_DEG, 90);
     65    m.setOrientToAngle(a);
     66    testAngleIsSet(m, a.value);
     67 
     68    // testing condition 1 for orient set using setOrientToAuto
     69    m.setOrientToAuto();
     70    testAutoIsSet(m);
     71 
     72    // testing condition 2 for an angle set using setAttribute
     73    m.setAttribute("orient", "180");
     74    testAngleIsSet(m, 180);
     75 
     76    // testing condition 1 for orient set to "auto" using setAttribute
     77    m.setAttribute("orient", "auto");
     78    testAutoIsSet(m);
     79 
     80    m.setAttribute("orient", "270");
     81 
     82    // testing condition 1 for orient set to "auto-start-reverse" using
     83    // setAttribute
     84    m.setAttribute("orient", "auto-start-reverse");
     85    testAutoStartReverseIsSet(m);
     86 
     87    SimpleTest.finish();
     88  }
     89 
     90  window.addEventListener("load", run);
     91 
     92  ]]>
     93 </script>
     94 </head>
     95 <body>
     96 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=892372">Mozilla Bug 892372</a>
     97 <p id="display"></p>
     98 <div id="content" style="display: none">
     99 
    100  <svg xmlns="http://www.w3.org/2000/svg" id="svg">
    101    <defs>
    102      <marker id="m" />
    103    </defs>
    104  </svg>
    105 
    106 </div>
    107 <pre id="test">
    108 </pre>
    109 </body>
    110 </html>