Bug 460926 A11y hierachy is broken on Ubuntu 8.10 (GNOME 2.24), r=Evan.Yan sr=roc
[wine-gecko.git] / layout / style / test / test_bug401046.html
blob22d79c0a4c8c2ce8b66f1cce8ec831ca7c20d34d
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="/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; }
16 </style>
17 </head>
18 <body>
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* -->
22 <!--
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>
28 </p>
29 -->
30 <p id="display">
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>
35 </p>
36 <div id="content" style="display: none">
38 </div>
39 <pre id="test">
40 <script class="testbody" type="text/javascript">
42 /** Test for Bug 401046 **/
44 SimpleTest.waitForExplicitFinish();
46 var elts = [
47 document.getElementById("s0"),
48 document.getElementById("s4"),
49 document.getElementById("s12"),
50 document.getElementById("s28")
53 function fs(idx) {
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;
63 var prefs =
64 CC["@mozilla.org/preferences-service;1"].getService(CI.nsIPrefBranch);
66 try {
67 prefs.clearUserPref('font.minimum-size.x-western');
68 } catch (ex) {
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);
75 function step1() {
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);
89 function step2() {
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);
103 function step3() {
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');
113 SimpleTest.finish();
116 </script>
117 </pre>
118 </body>
119 </html>