tor-browser

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

test_meta_viewport4.html (1633B)


      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  <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
      9  <script src="viewport_helpers.js"></script>
     10 </head>
     11 <body>
     12  <p>initial-scale=1.0, user-scalable=no</p>
     13  <script type="application/javascript">
     14    "use strict";
     15 
     16    add_task(async function test1() {
     17      await SpecialPowers.pushPrefEnv(scaleRatio(1.0));
     18 
     19      let info = getViewportInfo(800, 480);
     20      is(info.defaultZoom, 1,     "initial zoom is set explicitly");
     21      is(info.width,       800,   "width fits the initial zoom level");
     22      is(info.height,      480,   "height fits the initial zoom level");
     23      is(info.autoSize,    true,  "initial-scale=1 enables autoSize");
     24      is(info.allowZoom,   false, "zooming is explicitly disabled");
     25 
     26      info = getViewportInfo(480, 800);
     27      is(info.defaultZoom, 1,     "initial zoom is still set explicitly");
     28      is(info.width,       480,   "width changes to match the displayWidth");
     29      is(info.height,      800,   "height changes to match the 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.defaultZoom, 1.5,   "initial zoom is adjusted for device pixel ratio");
     37      is(info.width,       533,   "width fits the initial zoom");
     38      is(info.height,      320,   "height fits the initial zoom");
     39    });
     40  </script>
     41 </body>
     42 </html>