layout/style/test/test_bug401046.html

Wed, 31 Dec 2014 07:16:47 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:16:47 +0100
branch
TOR_BUG_9701
changeset 3
141e0f1194b1
permissions
-rw-r--r--

Revert simplistic fix pending revisit of Mozilla integration attempt.

     1 <!DOCTYPE HTML>
     2 <html lang="en">
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=401046
     5 -->
     6 <head>
     7   <title>Test for Bug 401046</title>
     8   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
     9   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    10   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    11   <style type="text/css">
    13   #display span { margin-bottom: 1em; }
    15   </style>
    16 </head>
    17 <body>
    18 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=401046">Mozilla Bug 401046</a>
    19 <p id="display" lang="zh-Hans">
    20   <span id="s0" style="font-size: 0">汉字</span>
    21   <span id="s4" style="font-size: 4px">汉字</span>
    22   <span id="s12" style="font-size: 12px">汉字</span>
    23   <span id="s28" style="font-size: 28px">汉字</span>
    24 </p>
    25 <div id="content" style="display: none">
    27 </div>
    28 <pre id="test">
    29 <script class="testbody" type="text/javascript">
    31 /** Test for Bug 401046 **/
    33 SimpleTest.waitForExplicitFinish();
    35 var elts = [
    36   document.getElementById("s0"),
    37   document.getElementById("s4"),
    38   document.getElementById("s12"),
    39   document.getElementById("s28")
    40 ];
    42 function fs(idx) {
    43   // The computed font size actually *doesn't* currently reflect the
    44   // minimum font size preference, but things in em units do.  Not sure
    45   // if this is how it ought to be...
    46   return getComputedStyle(elts[idx], "").marginBottom;
    47 }
    49 SpecialPowers.pushPrefEnv({'clear': [['font.minimum-size.zh-CN']]}, step1);
    51 function step1() {
    52     is(fs(0), "0px", "at min font size 0, 0px should compute to 0px");
    53     is(fs(1), "4px", "at min font size 0, 4px should compute to 4px");
    54     is(fs(2), "12px", "at min font size 0, 12px should compute to 12px");
    55     is(fs(3), "28px", "at min font size 0, 28px should compute to 28px");
    57     SpecialPowers.pushPrefEnv({'set': [['font.minimum-size.zh-CN', 7]]}, step2);
    58 }
    60 function step2() {
    61     is(fs(0), "0px", "at min font size 7, 0px should compute to 0px");
    62     is(fs(1), "7px", "at min font size 7, 4px should compute to 7px");
    63     is(fs(2), "12px", "at min font size 7, 12px should compute to 12px");
    64     is(fs(3), "28px", "at min font size 7, 28px should compute to 28px");
    66     SpecialPowers.pushPrefEnv({'set': [['font.minimum-size.zh-CN', 18]]}, step3);
    67 }
    69 function step3() {
    70     is(fs(0), "0px", "at min font size 18, 0px should compute to 0px");
    71     is(fs(1), "18px", "at min font size 18, 4px should compute to 18px");
    72     is(fs(2), "18px", "at min font size 18, 12px should compute to 18px");
    73     is(fs(3), "28px", "at min font size 18, 28px should compute to 28px");
    75     SpecialPowers.pushPrefEnv({'clear': [['font.minimum-size.zh-CN']]}, SimpleTest.finish);
    76 }
    78 </script>
    79 </pre>
    80 </body>
    81 </html>

mercurial