test_meta_viewport6.html (2067B)
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="width=2000, minimum-scale=0.75"> 9 <script src="viewport_helpers.js"></script> 10 </head> 11 <body> 12 <p>width=2000, minimum-scale=0.75</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.minZoom, 0.75, "minumum scale is set explicitly"); 21 is(info.defaultZoom, 0.75, "initial scale is bounded by the minimum scale"); 22 is(info.maxZoom, 10, "maximum scale defaults to the absolute maximum"); 23 is(info.width, 2000, "width is set explicitly"); 24 is(info.height, 1200, "height is proportional to displayHeight"); 25 is(info.autoSize, false, "autoSize is disabled by default"); 26 is(info.allowZoom, true, "zooming is enabled by default"); 27 28 info = getViewportInfo(2000, 1000); 29 is(info.minZoom, 0.75, "minumum scale is still set explicitly"); 30 is(info.defaultZoom, 1, "initial scale fits the width"); 31 is(info.width, 2000, "width is set explicitly"); 32 is(info.height, 1000, "height is proportional to the new displayHeight"); 33 }); 34 35 add_task(async function test2() { 36 await SpecialPowers.pushPrefEnv(scaleRatio(1.5)); 37 38 let info = getViewportInfo(800, 480); 39 is(info.minZoom, 1.125, "minumum scale is converted to device pixel scale"); 40 is(info.defaultZoom, 1.125, "initial scale is bounded by the minimum scale"); 41 is(info.maxZoom, 15, "maximum scale defaults to the absolute maximum"); 42 is(info.width, 2000, "width is still set explicitly"); 43 is(info.height, 1200, "height is still proportional to displayHeight"); 44 }); 45 </script> 46 </body> 47 </html>