content/xml/document/test/test_viewport.xhtml

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     1 <?xml version="1.0"?>
     2 <html xmlns="http://www.w3.org/1999/xhtml">
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=436083
     5 -->
     6 <head>
     7   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
     8   <meta name="viewport" content="height=398, width=4224, minimum-scale=0.1,
     9   initial-scale=2.3, maximum-scale=45.2, user-scalable=no" />
    10   <title>Test for Viewport META Tag Parsing</title>
    11   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>        
    12   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    13 </head>
    14 <body>
    15 <a target="_blank"
    16 href="https://bugzilla.mozilla.org/show_bug.cgi?id=436083">Mozilla Bug 436083</a>
    17 <pre id="test">
    18 <script class="testbody" type="text/javascript">
    19 <![CDATA[
    21 /** Test for Viewport META Tag **/
    23 SimpleTest.waitForExplicitFinish();
    25 function testViewport() {
    27   /* Grab Viewport Metadata from the document header. */
    28   var windowUtils = SpecialPowers.getDOMWindowUtils(window);
    29   var vpWidth =
    30     parseInt(windowUtils.getDocumentMetadata("viewport-width"));
    31   var vpHeight =
    32     parseInt(windowUtils.getDocumentMetadata("viewport-height"));
    33   var vpInitialScale = 
    34     parseFloat(windowUtils.getDocumentMetadata("viewport-initial-scale"));
    35   var vpMaxScale = 
    36     parseFloat(windowUtils.getDocumentMetadata("viewport-maximum-scale"));
    37   var vpMinScale = 
    38     parseFloat(windowUtils.getDocumentMetadata("viewport-minimum-scale"));
    39   var vpUserScalable = 
    40     windowUtils.getDocumentMetadata("viewport-user-scalable");
    42   is(vpWidth, 4224, "Should get proper width");
    43   is(vpHeight, 398, "Should get proper height");
    44   is(vpInitialScale, 2.3, "Should get proper initial scale");
    45   is(vpMaxScale, 45.2, "Should get proper max scale");
    46   is(vpMinScale, 0.1, "Should get proper min scale");
    47   is(vpUserScalable, "no", "Should get proper user scalable parameter");
    48 }
    50 addLoadEvent(testViewport);
    51 addLoadEvent(SimpleTest.finish);
    52 ]]>
    54 </script>
    55 </pre>
    56 </body>
    57 </html>

mercurial