content/xml/document/test/test_viewport.xhtml

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/xml/document/test/test_viewport.xhtml	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,57 @@
     1.4 +<?xml version="1.0"?>
     1.5 +<html xmlns="http://www.w3.org/1999/xhtml">
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=436083
     1.8 +-->
     1.9 +<head>
    1.10 +  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    1.11 +  <meta name="viewport" content="height=398, width=4224, minimum-scale=0.1,
    1.12 +  initial-scale=2.3, maximum-scale=45.2, user-scalable=no" />
    1.13 +  <title>Test for Viewport META Tag Parsing</title>
    1.14 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>        
    1.15 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.16 +</head>
    1.17 +<body>
    1.18 +<a target="_blank"
    1.19 +href="https://bugzilla.mozilla.org/show_bug.cgi?id=436083">Mozilla Bug 436083</a>
    1.20 +<pre id="test">
    1.21 +<script class="testbody" type="text/javascript">
    1.22 +<![CDATA[
    1.23 +
    1.24 +/** Test for Viewport META Tag **/
    1.25 +
    1.26 +SimpleTest.waitForExplicitFinish();
    1.27 +
    1.28 +function testViewport() {
    1.29 +
    1.30 +  /* Grab Viewport Metadata from the document header. */
    1.31 +  var windowUtils = SpecialPowers.getDOMWindowUtils(window);
    1.32 +  var vpWidth =
    1.33 +    parseInt(windowUtils.getDocumentMetadata("viewport-width"));
    1.34 +  var vpHeight =
    1.35 +    parseInt(windowUtils.getDocumentMetadata("viewport-height"));
    1.36 +  var vpInitialScale = 
    1.37 +    parseFloat(windowUtils.getDocumentMetadata("viewport-initial-scale"));
    1.38 +  var vpMaxScale = 
    1.39 +    parseFloat(windowUtils.getDocumentMetadata("viewport-maximum-scale"));
    1.40 +  var vpMinScale = 
    1.41 +    parseFloat(windowUtils.getDocumentMetadata("viewport-minimum-scale"));
    1.42 +  var vpUserScalable = 
    1.43 +    windowUtils.getDocumentMetadata("viewport-user-scalable");
    1.44 +
    1.45 +  is(vpWidth, 4224, "Should get proper width");
    1.46 +  is(vpHeight, 398, "Should get proper height");
    1.47 +  is(vpInitialScale, 2.3, "Should get proper initial scale");
    1.48 +  is(vpMaxScale, 45.2, "Should get proper max scale");
    1.49 +  is(vpMinScale, 0.1, "Should get proper min scale");
    1.50 +  is(vpUserScalable, "no", "Should get proper user scalable parameter");
    1.51 +}
    1.52 +
    1.53 +addLoadEvent(testViewport);
    1.54 +addLoadEvent(SimpleTest.finish);
    1.55 +]]>
    1.56 +
    1.57 +</script>
    1.58 +</pre>
    1.59 +</body>
    1.60 +</html>

mercurial