4 https://bugzilla.mozilla.org/show_bug.cgi?id=401046
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=
"/MochiKit/MochiKit.js"></script>
10 <script type=
"text/javascript" src=
"/tests/SimpleTest/SimpleTest.js"></script>
11 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css" />
12 <style type=
"text/css">
14 #display span
{ margin-bottom: 1em; }
19 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=401046">Mozilla Bug
401046</a>
20 <!-- FIXME tried changing the zh-CN pref instead of x-western, but the language
21 is based only on the document *charset* -->
23 <p id="display" lang="zh-Hans">
24 <span id="s0" style="font-size: 0">汉字</span>
25 <span id="s4" style="font-size: 4px">汉字</span>
26 <span id="s12" style="font-size: 12px">汉字</span>
27 <span id="s28" style="font-size: 28px">汉字</span>
31 <span id=
"s0" style=
"font-size: 0">Ép
</span>
32 <span id=
"s4" style=
"font-size: 4px">Ép
</span>
33 <span id=
"s12" style=
"font-size: 12px">Ép
</span>
34 <span id=
"s28" style=
"font-size: 28px">Ép
</span>
36 <div id=
"content" style=
"display: none">
40 <script class=
"testbody" type=
"text/javascript">
42 /** Test for Bug
401046 **/
44 SimpleTest.waitForExplicitFinish();
47 document.getElementById(
"s0"),
48 document.getElementById(
"s4"),
49 document.getElementById(
"s12"),
50 document.getElementById(
"s28")
54 // The computed font size actually *doesn't* currently reflect the
55 // minimum font size preference, but things in em units do. Not sure
56 // if this is how it ought to be...
57 return getComputedStyle(elts[idx],
"").marginBottom;
60 netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
61 var CC = Components.classes;
62 var CI = Components.interfaces;
64 CC[
"@mozilla.org/preferences-service;1"].getService(CI.nsIPrefBranch);
67 prefs.clearUserPref('font.minimum-size.x-western');
69 // throws if it wasn't already set
72 // preference change is async (although one setTimeout might be enough?)
73 setTimeout(setTimeout,
0, step1,
0);
76 netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
78 is(fs(
0),
"0px",
"at min font size 0, 0px should compute to 0px");
79 is(fs(
1),
"4px",
"at min font size 0, 4px should compute to 4px");
80 is(fs(
2),
"12px",
"at min font size 0, 12px should compute to 12px");
81 is(fs(
3),
"28px",
"at min font size 0, 28px should compute to 28px");
83 prefs.setIntPref('font.minimum-size.x-western',
7);
85 // preference change is async (although one setTimeout might be enough?)
86 setTimeout(setTimeout,
0, step2,
0);
90 netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
92 is(fs(
0),
"0px",
"at min font size 7, 0px should compute to 0px");
93 is(fs(
1),
"7px",
"at min font size 7, 4px should compute to 7px");
94 is(fs(
2),
"12px",
"at min font size 7, 12px should compute to 12px");
95 is(fs(
3),
"28px",
"at min font size 7, 28px should compute to 28px");
97 prefs.setIntPref('font.minimum-size.x-western',
18);
99 // preference change is async (although one setTimeout might be enough?)
100 setTimeout(setTimeout,
0, step3,
0);
104 netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
106 is(fs(
0),
"0px",
"at min font size 18, 0px should compute to 0px");
107 is(fs(
1),
"18px",
"at min font size 18, 4px should compute to 18px");
108 is(fs(
2),
"18px",
"at min font size 18, 12px should compute to 18px");
109 is(fs(
3),
"28px",
"at min font size 18, 28px should compute to 28px");
111 prefs.clearUserPref('font.minimum-size.x-western');