<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  <title>initial-scale=0.5 in meta viewport</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  <meta name="viewport" content="initial-scale=0.5">
  <script src="viewport_helpers.js"></script>
</head>
<body>
  <p>initial-scale=0.5</p>
  <script type="application/javascript">
    "use strict";

    add_task(async function initial_scale_0_5() {
      await SpecialPowers.pushPrefEnv(scaleRatio(1.0));

      let info = getViewportInfo(800, 480);
      // 'min-width' is 'display width / initial-scale', thus the value will be
      // bigger than the display width in the case where the initial-scale is
      // less than 1, thus the final viewport width will be the 'min-width'.
      // See 'Resolve initial width and height from min/max descriptors' section
      // in the spec for more detail.
      // height is calculated by the same rule.
      // https://drafts.csswg.org/css-device-adapt/#resolve-initial-width-height
      is(info.width, 1600, "width should be scaled by 1 / initial-scale");
      is(info.height, 960, "height should be scaled by 1 / initial-scale");
      is(info.defaultZoom, 0.5, "initial-scale should be 0.5");
    });
  </script>
</body>
</html>
