tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_lang.xhtml (3000B)


      1 <!DOCTYPE html>
      2 <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=721920
      5 -->
      6 <head>
      7  <title>Test for Bug 721920</title>
      8  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
      9  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     10  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     11  <style type="text/css">
     12 
     13 svg text { word-spacing: 1em; }
     14 
     15  </style>
     16 </head>
     17 <body>
     18 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=721920">Mozilla Bug 721920</a>
     19 <p id="display">
     20  <svg xmlns="http://www.w3.org/2000/svg" width="400" height="300">
     21    <g lang="zh-Hans">
     22      <text id="s0" y="40" style="font-size: 0">汉字</text>
     23      <text id="s4" y="80" style="font-size: 4px">汉字</text>
     24      <text id="s12" y="120" style="font-size: 12px">汉字</text>
     25      <text id="s28" y="160" style="font-size: 28px">汉字</text>
     26    </g>
     27  </svg>
     28 </p>
     29 <div id="content" style="display: none">
     30  
     31 </div>
     32 <pre id="test">
     33 <script class="testbody" type="text/javascript">
     34 //<![CDATA[
     35 
     36 /** Test for Bug 721920 */
     37 
     38 SimpleTest.waitForExplicitFinish();
     39 
     40 var elts = [
     41  document.getElementById("s0"),
     42  document.getElementById("s4"),
     43  document.getElementById("s12"),
     44  document.getElementById("s28"),
     45 ];
     46 
     47 function fs(idx) {
     48  // The computed font size actually *doesn't* currently reflect the
     49  // minimum font size preference, but things in em units do.  Hence
     50  // why we use word-spacing here.
     51  // test_bug401046.html uses margin-bottom instead, but there's an
     52  // SVG bug that prevents that working in SVG (bug 728723).
     53  return getComputedStyle(elts[idx], "").wordSpacing;
     54 }
     55 
     56 SpecialPowers.pushPrefEnv({"clear": [["font.minimum-size.zh-CN"]]}, step1);
     57 
     58 function step1() {
     59    is(fs(0), "0px", "at min font size 0, 0px should compute to 0px");
     60    is(fs(1), "4px", "at min font size 0, 4px should compute to 4px");
     61    is(fs(2), "12px", "at min font size 0, 12px should compute to 12px");
     62    is(fs(3), "28px", "at min font size 0, 28px should compute to 28px");
     63 
     64    SpecialPowers.pushPrefEnv({"set": [["font.minimum-size.zh-CN", 7]]}, step2);
     65 }
     66 
     67 function step2() {
     68    is(fs(0), "0px", "at min font size 7, 0px should compute to 0px");
     69    is(fs(1), "7px", "at min font size 7, 4px should compute to 7px");
     70    is(fs(2), "12px", "at min font size 7, 12px should compute to 12px");
     71    is(fs(3), "28px", "at min font size 7, 28px should compute to 28px");
     72 
     73    SpecialPowers.pushPrefEnv({"set": [["font.minimum-size.zh-CN", 18]]}, step3);
     74 }
     75 
     76 function step3() {
     77    is(fs(0), "0px", "at min font size 18, 0px should compute to 0px");
     78    is(fs(1), "18px", "at min font size 18, 4px should compute to 18px");
     79    is(fs(2), "18px", "at min font size 18, 12px should compute to 18px");
     80    is(fs(3), "28px", "at min font size 18, 28px should compute to 28px");
     81 
     82    SpecialPowers.pushPrefEnv({"clear": [["font.minimum-size.zh-CN"]]}, SimpleTest.finish);
     83 }
     84 
     85 //]]>
     86 </script>
     87 </pre>
     88 </body>
     89 </html>