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_acid3_test46.html
blob0227a52bbf80a3cff4c7a5eff8e5380204486580
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=156716
5 -->
6 <!--
8 This is test 46 from the Acid3 test, http://acid3.acidtests.org/
9 extracted from the test framework there and put into Mochitest.
11 (from irc.mozilla.org, developers)
12 [2008-05-14 18:07:38] <Hixie> dbaron: I hereby grant all files available from the server http://acid3.acidtests.org/ under the following license: (c) copyright 2008 Ian Hickson. These documents may be used under the terms of any of the following licenses: MPL. GPL. LGPL. BSD.
14 -->
15 <head>
16 <title>Test for Bug 156716</title>
17 <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
18 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
19 <style type="text/css">
20 iframe#selectors { width: 0; height: 0; }
21 </style>
22 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
23 </head>
24 <body>
25 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=156716">Mozilla Bug 156716</a>
26 <p id="display">
27 <iframe src="empty.html" id="selectors"></iframe>
28 </p>
29 <div id="content" style="display: none">
31 </div>
32 <pre id="test">
33 <script class="testbody" type="text/javascript">
35 /** Test for Bug 156716 **/
37 function getTestDocument() {
38 var iframe = document.getElementById("selectors");
39 var doc = iframe.contentDocument;
40 for (var i = doc.documentElement.childNodes.length-1; i >= 0; i -= 1)
41 doc.documentElement.removeChild(doc.documentElement.childNodes[i]);
42 doc.documentElement.appendChild(doc.createElement('head'));
43 doc.documentElement.firstChild.appendChild(doc.createElement('title'));
44 doc.documentElement.appendChild(doc.createElement('body'));
45 return doc;
48 // test 46: media queries
49 var doc = getTestDocument();
50 var style = doc.createElement('style');
51 style.setAttribute('type', 'text/css');
52 style.appendChild(doc.createTextNode('@media all and (min-color: 0) { #a { text-transform: uppercase; } }')); // matches
53 style.appendChild(doc.createTextNode('@media not all and (min-color: 0) { #b { text-transform: uppercase; } }'));
54 style.appendChild(doc.createTextNode('@media only all and (min-color: 0) { #c { text-transform: uppercase; } }')); // matches
55 style.appendChild(doc.createTextNode('@media (bogus) { #d { text-transform: uppercase; } }'));
56 style.appendChild(doc.createTextNode('@media all and (bogus) { #e { text-transform: uppercase; } }'));
57 style.appendChild(doc.createTextNode('@media not all and (bogus) { #f { text-transform: uppercase; } }')); // matches
58 style.appendChild(doc.createTextNode('@media only all and (bogus) { #g { text-transform: uppercase; } }'));
59 style.appendChild(doc.createTextNode('@media (bogus), all { #h { text-transform: uppercase; } }')); // matches
60 style.appendChild(doc.createTextNode('@media all and (bogus), all { #i { text-transform: uppercase; } }')); // matches
61 style.appendChild(doc.createTextNode('@media not all and (bogus), all { #j { text-transform: uppercase; } }')); // matches
62 style.appendChild(doc.createTextNode('@media only all and (bogus), all { #k { text-transform: uppercase; } }')); // matches
63 style.appendChild(doc.createTextNode('@media all, (bogus) { #l { text-transform: uppercase; } }')); // matches
64 style.appendChild(doc.createTextNode('@media all, all and (bogus) { #m { text-transform: uppercase; } }')); // matches
65 style.appendChild(doc.createTextNode('@media all, not all and (bogus) { #n { text-transform: uppercase; } }')); // matches
66 style.appendChild(doc.createTextNode('@media all, only all and (bogus) { #o { text-transform: uppercase; } }')); // matches
67 style.appendChild(doc.createTextNode('@media all and color { #p { text-transform: uppercase; } }'));
68 style.appendChild(doc.createTextNode('@media all and min-color: 0 { #q { text-transform: uppercase; } }'));
69 style.appendChild(doc.createTextNode('@media all, all and color { #r { text-transform: uppercase; } }'));
70 style.appendChild(doc.createTextNode('@media all, all and min-color: 0 { #s { text-transform: uppercase; } }'));
71 style.appendChild(doc.createTextNode('@media all and min-color: 0, all { #t { text-transform: uppercase; } }'));
72 style.appendChild(doc.createTextNode('@media (max-color: 0) and (max-monochrome: 0) { #u { text-transform: uppercase; } }'));
73 style.appendChild(doc.createTextNode('@media (min-color: 1), (min-monochrome: 1) { #v { text-transform: uppercase; } }')); // matches
74 style.appendChild(doc.createTextNode('@media all and (min-color: 0) and (min-monochrome: 0) { #w { text-transform: uppercase; } }')); // matches
75 style.appendChild(doc.createTextNode('@media not all and (min-color: 1), not all and (min-monochrome: 1) { #x { text-transform: uppercase; } }')); // matches
76 style.appendChild(doc.createTextNode('@media all and (min-height: 1em) and (min-width: 1em) { #y1 { text-transform: uppercase; } }'));
77 style.appendChild(doc.createTextNode('@media all and (max-height: 1em) and (min-width: 1em) { #y2 { text-transform: uppercase; } }'));
78 style.appendChild(doc.createTextNode('@media all and (min-height: 1em) and (max-width: 1em) { #y3 { text-transform: uppercase; } }'));
79 style.appendChild(doc.createTextNode('@media all and (max-height: 1em) and (max-width: 1em) { #y4 { text-transform: uppercase; } }')); // matches
80 doc.getElementsByTagName('head')[0].appendChild(style);
81 var names = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y1', 'y2', 'y3', 'y4'];
82 for (var i in names) {
83 var p = doc.createElement('p');
84 p.id = names[i];
85 doc.body.appendChild(p);
87 var count = 0;
88 var check = function (c, e) {
89 count += 1;
90 var p = doc.getElementById(c);
91 is(doc.defaultView.getComputedStyle(p, '').textTransform, e ? 'uppercase' : 'none', "case " + c + " failed (index " + count + ")");
93 check('a', true); // 1
94 check('b', false);
95 check('c', true);
96 check('d', false);
97 check('e', false);
98 check('f', false); // true in old spec; commented out in real Acid3
99 check('g', false);
100 check('h', true);
101 check('i', true);
102 check('j', true); // 10
103 check('k', true);
104 check('l', true);
105 check('m', true);
106 check('n', true);
107 check('o', true);
108 check('p', false);
109 check('q', false);
110 check('r', true); // false in old spec
111 check('s', true); // false in old spec
112 check('t', true); // 20 - false in old spec
113 check('u', false);
114 check('v', true);
115 check('w', true);
116 check('x', true);
117 // here the viewport is 0x0
118 check('y1', false); // 25
119 check('y2', false);
120 check('y3', false);
121 check('y4', true);
122 document.getElementById("selectors").setAttribute("style", "height: 100px; width: 100px");
123 // now the viewport is more than 1em by 1em
124 check('y1', true); // 29
125 check('y2', false);
126 check('y3', false);
127 check('y4', false);
128 document.getElementById("selectors").removeAttribute("style");
129 // here the viewport is 0x0 again
130 check('y1', false); // 33
131 check('y2', false);
132 check('y3', false);
133 check('y4', true);
135 </script>
136 </pre>
137 </body>
138 </html>