tor-browser

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

test_meta_viewport0.html (1640B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <meta charset="utf-8">
      5  <title>meta viewport test</title>
      6  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      7  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
      8  <script src="viewport_helpers.js"></script>
      9 </head>
     10 <body>
     11  <p>No &lt;meta name="viewport"&gt; tag</p>
     12  <script type="application/javascript">
     13    "use strict";
     14 
     15    add_task(async function test1() {
     16      await SpecialPowers.pushPrefEnv(scaleRatio(1.0));
     17 
     18      let info = getViewportInfo(800, 480);
     19      fuzzeq(info.defaultZoom, 0.25, "initial scale is clamped to the default mimumim scale");
     20      fuzzeq(info.minZoom, 0.25,     "minimum scale defaults to the absolute minimum");
     21      is(info.maxZoom,     10,       "maximum scale defaults to the absolute maximum");
     22      is(info.width,       980,      "width is the default width");
     23      is(info.height,      588,      "height is proportional to displayHeight");
     24      is(info.autoSize,    false,    "autoSize is disabled by default");
     25      is(info.allowZoom,   true,     "zooming is enabled by default");
     26 
     27      info = getViewportInfo(490, 600);
     28      is(info.width,       980,     "width is still the default width");
     29      is(info.height,      1200,    "height is proportional to the new displayHeight");
     30    });
     31 
     32    add_task(async function test2() {
     33      await SpecialPowers.pushPrefEnv(scaleRatio(1.5));
     34 
     35      let info = getViewportInfo(800, 480);
     36      is(info.width,       980,     "width is still the default width");
     37      is(info.height,      588,     "height is still proportional to displayHeight");
     38    });
     39  </script>
     40 </body>
     41 </html>