Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: LayoutTests/fast/media/w3c/test_media_queries.html

Issue 17570008: Imported latest w3c media queries test suite. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated README. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE HTML> 1 <!DOCTYPE HTML>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>Media Queries Self-Contained Test Suite</title> 4 <title>Media Queries Self-Contained Test Suite</title>
5 <link rel="author" title="L. David Baron" href="http://dbaron.org/"> 5 <link rel="author" title="L. David Baron" href="http://dbaron.org/">
6 <link rel="author" title="Anne van Kesteren" href="http://annevankesteren.nl/" > 6 <link rel="author" title="Anne van Kesteren" href="http://annevankesteren.nl/" >
7 <link rel="author" title="Ms2ger" href="mailto:Ms2ger@gmail.com"> 7 <link rel="author" title="Ms2ger" href="mailto:Ms2ger@gmail.com">
8 <link rel="help" href="http://www.w3.org/TR/css3-mediaqueries/"> 8 <link rel="help" href="http://www.w3.org/TR/css3-mediaqueries/">
9 <script type="text/javascript" src="../../../resources/testharness.js"></scrip t> 9 <script type="text/javascript" src="../../../resources/testharness.js"></scrip t>
10 <script type="text/javascript" src="../../../resources/testharnessreport.js">< /script> 10 <script type="text/javascript" src="../../../resources/testharnessreport.js">< /script>
11 <script id="metadata_cache">/*
12 {
13 "subtest_1": { "assert": "query (orientation) should be parseable" },
14 "subtest_2": { "assert": "query not (orientation) should not be parseable" },
15 "subtest_3": { "assert": "query only (orientation) should not be parseable" },
16 "subtest_4": { "assert": "query all and (orientation) should be parseable" },
17 "subtest_5": { "assert": "query not all and (orientation) should be parseable" },
18 "subtest_6": { "assert": "query only all and (orientation) should be parseable " },
19 "subtest_7": { "assert": "expression width should be parseable" },
20 "subtest_8": { "assert": "expression width: 0 should be parseable" },
21 "subtest_9": { "assert": "expression width: 0px should be parseable" },
22 "subtest_10": { "assert": "expression width: 0em should be parseable" },
23 "subtest_11": { "assert": "expression width: -0 should be parseable" },
24 "subtest_12": { "assert": "expression min-width: -0 should be parseable" },
25 "subtest_13": { "assert": "expression max-width: -0 should be parseable" },
26 "subtest_14": { "assert": "expression width: -0cm should be parseable" },
27 "subtest_15": { "assert": "expression width: 1px should be parseable" },
28 "subtest_16": { "assert": "expression width: 0.001mm should be parseable" },
29 "subtest_17": { "assert": "expression width: 100000px should be parseable" },
30 "subtest_18": { "assert": "expression width: -1px should not be parseable" },
31 "subtest_19": { "assert": "expression min-width: -1px should not be parseable" },
32 "subtest_20": { "assert": "expression max-width: -1px should not be parseable" },
33 "subtest_21": { "assert": "expression width: -0.00001mm should not be parseabl e" },
34 "subtest_22": { "assert": "expression width: -100000em should not be parseable " },
35 "subtest_23": { "assert": "expression min-width should not be parseable" },
36 "subtest_24": { "assert": "expression max-width should not be parseable" },
37 "subtest_25": { "assert": "expression height should be parseable" },
38 "subtest_26": { "assert": "expression height: 0 should be parseable" },
39 "subtest_27": { "assert": "expression height: 0px should be parseable" },
40 "subtest_28": { "assert": "expression height: 0em should be parseable" },
41 "subtest_29": { "assert": "expression height: -0 should be parseable" },
42 "subtest_30": { "assert": "expression min-height: -0 should be parseable" },
43 "subtest_31": { "assert": "expression max-height: -0 should be parseable" },
44 "subtest_32": { "assert": "expression height: -0cm should be parseable" },
45 "subtest_33": { "assert": "expression height: 1px should be parseable" },
46 "subtest_34": { "assert": "expression height: 0.001mm should be parseable" },
47 "subtest_35": { "assert": "expression height: 100000px should be parseable" },
48 "subtest_36": { "assert": "expression height: -1px should not be parseable" },
49 "subtest_37": { "assert": "expression min-height: -1px should not be parseable " },
50 "subtest_38": { "assert": "expression max-height: -1px should not be parseable " },
51 "subtest_39": { "assert": "expression height: -0.00001mm should not be parseab le" },
52 "subtest_40": { "assert": "expression height: -100000em should not be parseabl e" },
53 "subtest_41": { "assert": "expression min-height should not be parseable" },
54 "subtest_42": { "assert": "expression max-height should not be parseable" },
55 "subtest_43": { "assert": "expression device-width should be parseable" },
56 "subtest_44": { "assert": "expression device-width: 0 should be parseable" },
57 "subtest_45": { "assert": "expression device-width: 0px should be parseable" } ,
58 "subtest_46": { "assert": "expression device-width: 0em should be parseable" } ,
59 "subtest_47": { "assert": "expression device-width: -0 should be parseable" },
60 "subtest_48": { "assert": "expression min-device-width: -0 should be parseable " },
61 "subtest_49": { "assert": "expression max-device-width: -0 should be parseable " },
62 "subtest_50": { "assert": "expression device-width: -0cm should be parseable" },
63 "subtest_51": { "assert": "expression device-width: 1px should be parseable" } ,
64 "subtest_52": { "assert": "expression device-width: 0.001mm should be parseabl e" },
65 "subtest_53": { "assert": "expression device-width: 100000px should be parseab le" },
66 "subtest_54": { "assert": "expression device-width: -1px should not be parseab le" },
67 "subtest_55": { "assert": "expression min-device-width: -1px should not be par seable" },
68 "subtest_56": { "assert": "expression max-device-width: -1px should not be par seable" },
69 "subtest_57": { "assert": "expression device-width: -0.00001mm should not be p arseable" },
70 "subtest_58": { "assert": "expression device-width: -100000em should not be pa rseable" },
71 "subtest_59": { "assert": "expression min-device-width should not be parseable " },
72 "subtest_60": { "assert": "expression max-device-width should not be parseable " },
73 "subtest_61": { "assert": "expression device-height should be parseable" },
74 "subtest_62": { "assert": "expression device-height: 0 should be parseable" },
75 "subtest_63": { "assert": "expression device-height: 0px should be parseable" },
76 "subtest_64": { "assert": "expression device-height: 0em should be parseable" },
77 "subtest_65": { "assert": "expression device-height: -0 should be parseable" } ,
78 "subtest_66": { "assert": "expression min-device-height: -0 should be parseabl e" },
79 "subtest_67": { "assert": "expression max-device-height: -0 should be parseabl e" },
80 "subtest_68": { "assert": "expression device-height: -0cm should be parseable" },
81 "subtest_69": { "assert": "expression device-height: 1px should be parseable" },
82 "subtest_70": { "assert": "expression device-height: 0.001mm should be parseab le" },
83 "subtest_71": { "assert": "expression device-height: 100000px should be parsea ble" },
84 "subtest_72": { "assert": "expression device-height: -1px should not be parsea ble" },
85 "subtest_73": { "assert": "expression min-device-height: -1px should not be pa rseable" },
86 "subtest_74": { "assert": "expression max-device-height: -1px should not be pa rseable" },
87 "subtest_75": { "assert": "expression device-height: -0.00001mm should not be parseable" },
88 "subtest_76": { "assert": "expression device-height: -100000em should not be p arseable" },
89 "subtest_77": { "assert": "expression min-device-height should not be parseabl e" },
90 "subtest_78": { "assert": "expression max-device-height should not be parseabl e" },
91 "subtest_79": { "assert": "all and (width: 117px) should apply" },
92 "subtest_80": { "assert": "all and (width: 118px) should not apply" },
93 "subtest_81": { "assert": "all and (width: 116px) should not apply" },
94 "subtest_82": { "assert": "all and (min-width: 117px) should apply" },
95 "subtest_83": { "assert": "all and (min-width: 118px) should not apply" },
96 "subtest_84": { "assert": "all and (min-width: 116px) should apply" },
97 "subtest_85": { "assert": "all and (max-width: 117px) should apply" },
98 "subtest_86": { "assert": "all and (max-width: 118px) should apply" },
99 "subtest_87": { "assert": "all and (max-width: 116px) should not apply" },
100 "subtest_88": { "assert": "all and (min-width: 9em) should not apply" },
101 "subtest_89": { "assert": "all and (min-width: 6em) should apply" },
102 "subtest_90": { "assert": "all and (max-width: 9em) should apply" },
103 "subtest_91": { "assert": "all and (max-width: 6em) should not apply" },
104 "subtest_92": { "assert": "all and (height: 76px) should apply" },
105 "subtest_93": { "assert": "all and (height: 77px) should not apply" },
106 "subtest_94": { "assert": "all and (height: 75px) should not apply" },
107 "subtest_95": { "assert": "all and (min-height: 76px) should apply" },
108 "subtest_96": { "assert": "all and (min-height: 77px) should not apply" },
109 "subtest_97": { "assert": "all and (min-height: 75px) should apply" },
110 "subtest_98": { "assert": "all and (max-height: 76px) should apply" },
111 "subtest_99": { "assert": "all and (max-height: 77px) should apply" },
112 "subtest_100": { "assert": "all and (max-height: 75px) should not apply" },
113 "subtest_101": { "assert": "all and (min-height: 6em) should not apply" },
114 "subtest_102": { "assert": "all and (min-height: 3em) should apply" },
115 "subtest_103": { "assert": "all and (max-height: 6em) should apply" },
116 "subtest_104": { "assert": "all and (max-height: 3em) should not apply" },
117 "subtest_105": { "assert": "all and (device-width: 1920px) should apply" },
118 "subtest_106": { "assert": "all and (device-width: 1921px) should not apply" } ,
119 "subtest_107": { "assert": "all and (device-width: 1919px) should not apply" } ,
120 "subtest_108": { "assert": "all and (min-device-width: 1920px) should apply" } ,
121 "subtest_109": { "assert": "all and (min-device-width: 1921px) should not appl y" },
122 "subtest_110": { "assert": "all and (min-device-width: 1919px) should apply" } ,
123 "subtest_111": { "assert": "all and (max-device-width: 1920px) should apply" } ,
124 "subtest_112": { "assert": "all and (max-device-width: 1921px) should apply" } ,
125 "subtest_113": { "assert": "all and (max-device-width: 1919px) should not appl y" },
126 "subtest_114": { "assert": "all and (min-device-width: 121em) should not apply " },
127 "subtest_115": { "assert": "all and (min-device-width: 119em) should apply" },
128 "subtest_116": { "assert": "all and (max-device-width: 121em) should apply" },
129 "subtest_117": { "assert": "all and (max-device-width: 119em) should not apply " },
130 "subtest_118": { "assert": "all and (device-height: 1200px) should apply" },
131 "subtest_119": { "assert": "all and (device-height: 1201px) should not apply" },
132 "subtest_120": { "assert": "all and (device-height: 1199px) should not apply" },
133 "subtest_121": { "assert": "all and (min-device-height: 1200px) should apply" },
134 "subtest_122": { "assert": "all and (min-device-height: 1201px) should not app ly" },
135 "subtest_123": { "assert": "all and (min-device-height: 1199px) should apply" },
136 "subtest_124": { "assert": "all and (max-device-height: 1200px) should apply" },
137 "subtest_125": { "assert": "all and (max-device-height: 1201px) should apply" },
138 "subtest_126": { "assert": "all and (max-device-height: 1199px) should not app ly" },
139 "subtest_127": { "assert": "all and (min-device-height: 76em) should not apply " },
140 "subtest_128": { "assert": "all and (min-device-height: 74em) should apply" },
141 "subtest_129": { "assert": "all and (max-device-height: 76em) should apply" },
142 "subtest_130": { "assert": "all and (max-device-height: 74em) should not apply " },
143 "subtest_131": { "assert": "all and (height) should apply" },
144 "subtest_132": { "assert": "all and (width) should not apply" },
145 "subtest_133": { "assert": "all and (height) should not apply" },
146 "subtest_134": { "assert": "all and (width) should not apply" },
147 "subtest_135": { "assert": "all and (device-height) should apply" },
148 "subtest_136": { "assert": "all and (device-width) should apply" },
149 "subtest_137": { "assert": "all and (height) should not apply" },
150 "subtest_138": { "assert": "all and (width) should apply" },
151 "subtest_139": { "assert": "all and (height) should apply" },
152 "subtest_140": { "assert": "all and (width) should apply" },
153 "subtest_141": { "assert": "expression orientation should be parseable" },
154 "subtest_142": { "assert": "expression orientation: portrait should be parseab le" },
155 "subtest_143": { "assert": "expression orientation: landscape should be parsea ble" },
156 "subtest_144": { "assert": "expression min-orientation should not be parseable " },
157 "subtest_145": { "assert": "expression min-orientation: portrait should not be parseable" },
158 "subtest_146": { "assert": "expression min-orientation: landscape should not b e parseable" },
159 "subtest_147": { "assert": "expression max-orientation should not be parseable " },
160 "subtest_148": { "assert": "expression max-orientation: portrait should not be parseable" },
161 "subtest_149": { "assert": "expression max-orientation: landscape should not b e parseable" },
162 "subtest_150": { "assert": "(orientation) should apply" },
163 "subtest_151": { "assert": "(orientation: landscape) should apply" },
164 "subtest_152": { "assert": "(orientation: portrait) should not apply" },
165 "subtest_153": { "assert": "not all and (orientation: portrait) should apply" },
166 "subtest_154": { "assert": "(orientation) should apply" },
167 "subtest_155": { "assert": "(orientation: landscape) should not apply" },
168 "subtest_156": { "assert": "not all and (orientation: landscape) should apply" },
169 "subtest_157": { "assert": "(orientation: portrait) should apply" },
170 "subtest_158": { "assert": "(aspect-ratio: 59/80) should apply" },
171 "subtest_159": { "assert": "(aspect-ratio: 58/80) should not apply" },
172 "subtest_160": { "assert": "(aspect-ratio: 59/81) should not apply" },
173 "subtest_161": { "assert": "(aspect-ratio: 60/80) should not apply" },
174 "subtest_162": { "assert": "(aspect-ratio: 59/79) should not apply" },
175 "subtest_163": { "assert": "(aspect-ratio: 177/240) should apply" },
176 "subtest_164": { "assert": "(aspect-ratio: 413/560) should apply" },
177 "subtest_165": { "assert": "(aspect-ratio: 5900/8000) should apply" },
178 "subtest_166": { "assert": "(aspect-ratio: 5901/8000) should not apply" },
179 "subtest_167": { "assert": "(aspect-ratio: 5899/8000) should not apply" },
180 "subtest_168": { "assert": "(aspect-ratio: 5900/8001) should not apply" },
181 "subtest_169": { "assert": "(aspect-ratio: 5900/7999) should not apply" },
182 "subtest_170": { "assert": "(aspect-ratio) should apply" },
183 "subtest_171": { "assert": "(min-aspect-ratio: 59/80) should apply" },
184 "subtest_172": { "assert": "(min-aspect-ratio: 58/80) should apply" },
185 "subtest_173": { "assert": "(min-aspect-ratio: 59/81) should apply" },
186 "subtest_174": { "assert": "(min-aspect-ratio: 60/80) should not apply" },
187 "subtest_175": { "assert": "(min-aspect-ratio: 59/79) should not apply" },
188 "subtest_176": { "assert": "expression min-aspect-ratio should not be parseabl e" },
189 "subtest_177": { "assert": "(max-aspect-ratio: 59/80) should apply" },
190 "subtest_178": { "assert": "(max-aspect-ratio: 58/80) should not apply" },
191 "subtest_179": { "assert": "(max-aspect-ratio: 59/81) should not apply" },
192 "subtest_180": { "assert": "(max-aspect-ratio: 60/80) should apply" },
193 "subtest_181": { "assert": "(max-aspect-ratio: 59/79) should apply" },
194 "subtest_182": { "assert": "expression max-aspect-ratio should not be parseabl e" },
195 "subtest_183": { "assert": "(device-aspect-ratio: 1920/1200) should apply" },
196 "subtest_184": { "assert": "not all and (device-aspect-ratio: 1921/1200) shoul d apply" },
197 "subtest_185": { "assert": "all and (device-aspect-ratio: 1920/1199) should no t apply" },
198 "subtest_186": { "assert": "all and (device-aspect-ratio: 1919/1200) should no t apply" },
199 "subtest_187": { "assert": "not all and (device-aspect-ratio: 1920/1201) shoul d apply" },
200 "subtest_188": { "assert": "(device-aspect-ratio) should apply" },
201 "subtest_189": { "assert": "(min-device-aspect-ratio: 1920/1200) should apply" },
202 "subtest_190": { "assert": "all and (min-device-aspect-ratio: 1921/1200) shoul d not apply" },
203 "subtest_191": { "assert": "not all and (min-device-aspect-ratio: 1920/1199) s hould apply" },
204 "subtest_192": { "assert": "not all and (min-device-aspect-ratio: 1919/1200) s hould not apply" },
205 "subtest_193": { "assert": "all and (min-device-aspect-ratio: 1920/1201) shoul d apply" },
206 "subtest_194": { "assert": "expression min-device-aspect-ratio should not be p arseable" },
207 "subtest_195": { "assert": "all and (max-device-aspect-ratio: 1920/1200) shoul d apply" },
208 "subtest_196": { "assert": "(max-device-aspect-ratio: 1921/1200) should apply" },
209 "subtest_197": { "assert": "(max-device-aspect-ratio: 1920/1199) should apply" },
210 "subtest_198": { "assert": "all and (max-device-aspect-ratio: 1919/1200) shoul d not apply" },
211 "subtest_199": { "assert": "not all and (max-device-aspect-ratio: 1920/1201) s hould apply" },
212 "subtest_200": { "assert": "expression max-device-aspect-ratio should not be p arseable" },
213 "subtest_201": { "assert": "expression max-aspect-ratio: 1/1 should be parseab le" },
214 "subtest_202": { "assert": "expression max-aspect-ratio: 1 /1 should be parse able" },
215 "subtest_203": { "assert": "expression max-aspect-ratio: 1 / \t\n1 should be parseable" },
216 "subtest_204": { "assert": "expression max-aspect-ratio: 1/\r1 should be parse able" },
217 "subtest_205": { "assert": "expression max-aspect-ratio: 1 should not be parse able" },
218 "subtest_206": { "assert": "expression max-aspect-ratio: 0.5 should not be par seable" },
219 "subtest_207": { "assert": "expression max-aspect-ratio: 1.0/1 should not be p arseable" },
220 "subtest_208": { "assert": "expression max-aspect-ratio: 1/1.0 should not be p arseable" },
221 "subtest_209": { "assert": "expression max-aspect-ratio: 1.0/1.0 should not be parseable" },
222 "subtest_210": { "assert": "expression max-aspect-ratio: 0/1 should not be par seable" },
223 "subtest_211": { "assert": "expression max-aspect-ratio: 1/0 should not be par seable" },
224 "subtest_212": { "assert": "expression max-aspect-ratio: 0/0 should not be par seable" },
225 "subtest_213": { "assert": "expression max-aspect-ratio: -1/1 should not be pa rseable" },
226 "subtest_214": { "assert": "expression max-aspect-ratio: 1/-1 should not be pa rseable" },
227 "subtest_215": { "assert": "expression max-aspect-ratio: -1/-1 should not be p arseable" },
228 "subtest_216": { "assert": "expression device-aspect-ratio: 1/1 should be pars eable" },
229 "subtest_217": { "assert": "expression device-aspect-ratio: 1 /1 should be pa rseable" },
230 "subtest_218": { "assert": "expression device-aspect-ratio: 1 / \t\n1 should be parseable" },
231 "subtest_219": { "assert": "expression device-aspect-ratio: 1/\r1 should be pa rseable" },
232 "subtest_220": { "assert": "expression device-aspect-ratio: 1 should not be pa rseable" },
233 "subtest_221": { "assert": "expression device-aspect-ratio: 0.5 should not be parseable" },
234 "subtest_222": { "assert": "expression device-aspect-ratio: 1.0/1 should not b e parseable" },
235 "subtest_223": { "assert": "expression device-aspect-ratio: 1/1.0 should not b e parseable" },
236 "subtest_224": { "assert": "expression device-aspect-ratio: 1.0/1.0 should not be parseable" },
237 "subtest_225": { "assert": "expression device-aspect-ratio: 0/1 should not be parseable" },
238 "subtest_226": { "assert": "expression device-aspect-ratio: 1/0 should not be parseable" },
239 "subtest_227": { "assert": "expression device-aspect-ratio: 0/0 should not be parseable" },
240 "subtest_228": { "assert": "expression device-aspect-ratio: -1/1 should not be parseable" },
241 "subtest_229": { "assert": "expression device-aspect-ratio: 1/-1 should not be parseable" },
242 "subtest_230": { "assert": "expression device-aspect-ratio: -1/-1 should not b e parseable" },
243 "monochrome_and_color": {},
244 "find_depth": {},
245 "subtest_231": { "assert": "all and (color:8) should apply" },
246 "subtest_232": { "assert": "all and (color:7) should not apply" },
247 "subtest_233": { "assert": "all and (color:9) should not apply" },
248 "subtest_234": { "assert": "all and (max-color:8) should apply" },
249 "subtest_235": { "assert": "all and (max-color:7) should not apply" },
250 "subtest_236": { "assert": "all and (max-color:9) should apply" },
251 "subtest_237": { "assert": "all and (color) should apply" },
252 "subtest_238": { "assert": "expression max-color should not be parseable" },
253 "subtest_239": { "assert": "expression min-color should not be parseable" },
254 "subtest_240": { "assert": "all and (monochrome) should not apply" },
255 "subtest_241": { "assert": "expression max-monochrome should not be parseable" },
256 "subtest_242": { "assert": "expression min-monochrome should not be parseable" },
257 "subtest_243": { "assert": "not all and (monochrome) should apply" },
258 "subtest_244": { "assert": "not all and (color) should not apply" },
259 "subtest_245": { "assert": "only all and (color) should apply" },
260 "subtest_246": { "assert": "only all and (monochrome) should not apply" },
261 "subtest_247": { "assert": "expression color: 1 should be parseable" },
262 "subtest_248": { "assert": "expression color: 327 should be parseable" },
263 "subtest_249": { "assert": "expression color: 0 should be parseable" },
264 "subtest_250": { "assert": "expression color: 1.0 should not be parseable" },
265 "subtest_251": { "assert": "expression color: -1 should not be parseable" },
266 "subtest_252": { "assert": "expression color: 1/1 should not be parseable" },
267 "subtest_253": { "assert": "expression min-monochrome: 1 should be parseable" },
268 "subtest_254": { "assert": "expression min-monochrome: 327 should be parseable " },
269 "subtest_255": { "assert": "expression min-monochrome: 0 should be parseable" },
270 "subtest_256": { "assert": "expression min-monochrome: 1.0 should not be parse able" },
271 "subtest_257": { "assert": "expression min-monochrome: -1 should not be parsea ble" },
272 "subtest_258": { "assert": "expression min-monochrome: 1/1 should not be parse able" },
273 "subtest_259": { "assert": "expression max-color-index: 1 should be parseable" },
274 "subtest_260": { "assert": "expression max-color-index: 327 should be parseabl e" },
275 "subtest_261": { "assert": "expression max-color-index: 0 should be parseable" },
276 "subtest_262": { "assert": "expression max-color-index: 1.0 should not be pars eable" },
277 "subtest_263": { "assert": "expression max-color-index: -1 should not be parse able" },
278 "subtest_264": { "assert": "expression max-color-index: 1/1 should not be pars eable" },
279 "subtest_265": { "assert": "(color-index: 0) should apply" },
280 "subtest_266": { "assert": "(color-index: 1) should not apply" },
281 "subtest_267": { "assert": "(min-color-index: 0) should apply" },
282 "subtest_268": { "assert": "(min-color-index: 1) should not apply" },
283 "subtest_269": { "assert": "(max-color-index: 0) should apply" },
284 "subtest_270": { "assert": "(max-color-index: 1) should apply" },
285 "subtest_271": { "assert": "(max-color-index: 157) should apply" },
286 "subtest_272": { "assert": "expression resolution: 3dpi should be parseable" } ,
287 "subtest_273": { "assert": "expression resolution:3dpi should be parseable" },
288 "subtest_274": { "assert": "expression resolution: 3.0dpi should be parseable" },
289 "subtest_275": { "assert": "expression resolution: 3.4dpi should be parseable" },
290 "subtest_276": { "assert": "expression resolution\t: 120dpcm should be parseab le" },
291 "subtest_277": { "assert": "expression resolution: 0dpi should not be parseabl e" },
292 "subtest_278": { "assert": "expression resolution: -3dpi should not be parseab le" },
293 "subtest_279": { "assert": "expression min-resolution: 3dpi should be parseabl e" },
294 "subtest_280": { "assert": "expression min-resolution:3dpi should be parseable " },
295 "subtest_281": { "assert": "expression min-resolution: 3.0dpi should be parsea ble" },
296 "subtest_282": { "assert": "expression min-resolution: 3.4dpi should be parsea ble" },
297 "subtest_283": { "assert": "expression min-resolution\t: 120dpcm should be par seable" },
298 "subtest_284": { "assert": "expression min-resolution: 0dpi should not be pars eable" },
299 "subtest_285": { "assert": "expression min-resolution: -3dpi should not be par seable" },
300 "subtest_286": { "assert": "expression max-resolution: 3dpi should be parseabl e" },
301 "subtest_287": { "assert": "expression max-resolution:3dpi should be parseable " },
302 "subtest_288": { "assert": "expression max-resolution: 3.0dpi should be parsea ble" },
303 "subtest_289": { "assert": "expression max-resolution: 3.4dpi should be parsea ble" },
304 "subtest_290": { "assert": "expression max-resolution\t: 120dpcm should be par seable" },
305 "subtest_291": { "assert": "expression max-resolution: 0dpi should not be pars eable" },
306 "subtest_292": { "assert": "expression max-resolution: -3dpi should not be par seable" },
307 "find_resolution": {},
308 "subtest_293": { "assert": "(resolution: 133dpi) should apply" },
309 "subtest_294": { "assert": "(resolution: 134dpi) should not apply" },
310 "subtest_295": { "assert": "(resolution: 132dpi) should not apply" },
311 "subtest_296": { "assert": "(min-resolution: 132dpi) should apply" },
312 "subtest_297": { "assert": "not all and (min-resolution: 132dpi) should not ap ply" },
313 "subtest_298": { "assert": "not all and (min-resolution: 134dpi) should apply" },
314 "subtest_299": { "assert": "all and (min-resolution: 134dpi) should not apply" },
315 "subtest_300": { "assert": "(min-resolution: 51dpcm) should apply" },
316 "subtest_301": { "assert": "(max-resolution: 53dpcm) should apply" },
317 "subtest_302": { "assert": "(max-resolution: 51dpcm) should not apply" },
318 "subtest_303": { "assert": "not all and (min-resolution: 53dpcm) should apply" },
319 "subtest_304": { "assert": "expression scan should be parseable" },
320 "subtest_305": { "assert": "expression scan: progressive should be parseable" },
321 "subtest_306": { "assert": "expression scan:interlace should be parseable" },
322 "subtest_307": { "assert": "expression min-scan:interlace should not be parsea ble" },
323 "subtest_308": { "assert": "expression scan: 1 should not be parseable" },
324 "subtest_309": { "assert": "expression max-scan should not be parseable" },
325 "subtest_310": { "assert": "expression max-scan: progressive should not be par seable" },
326 "subtest_311": { "assert": "(scan) should not apply" },
327 "subtest_312": { "assert": "(scan: progressive) should not apply" },
328 "subtest_313": { "assert": "(scan: interlace) should not apply" },
329 "subtest_314": { "assert": "not all and (scan) should apply" },
330 "subtest_315": { "assert": "not all and (scan: progressive) should apply" },
331 "subtest_316": { "assert": "not all and (scan: interlace) should apply" },
332 "subtest_317": { "assert": "expression grid should be parseable" },
333 "subtest_318": { "assert": "expression grid: 0 should be parseable" },
334 "subtest_319": { "assert": "expression grid: 1 should be parseable" },
335 "subtest_320": { "assert": "expression grid: 1 should be parseable" },
336 "subtest_321": { "assert": "expression min-grid should not be parseable" },
337 "subtest_322": { "assert": "expression min-grid:0 should not be parseable" },
338 "subtest_323": { "assert": "expression max-grid: 1 should not be parseable" },
339 "subtest_324": { "assert": "expression grid: 2 should not be parseable" },
340 "subtest_325": { "assert": "expression grid: -1 should not be parseable" },
341 "subtest_326": { "assert": "(grid) should not apply" },
342 "subtest_327": { "assert": "(grid: 0) should apply" },
343 "subtest_328": { "assert": "(grid: 1) should not apply" },
344 "subtest_329": { "assert": "(grid: 2) should not apply" },
345 "subtest_330": { "assert": "(grid: -1) should not apply" },
346 "subtest_331": { "assert": "(orientation should apply" },
347 "subtest_332": { "assert": "not all and (orientation should not apply" },
348 "subtest_333": { "assert": "(orientation: should not apply" },
349 "subtest_334": { "assert": "all,(orientation: should apply" },
350 "subtest_335": { "assert": "(orientation:,all should not apply" },
351 "subtest_336": { "assert": "not all and (grid should apply" },
352 "subtest_337": { "assert": "only all and (grid should not apply" },
353 "subtest_338": { "assert": "(grid should not apply" },
354 "subtest_339": { "assert": "all,(grid should apply" },
355 "subtest_340": { "assert": "(grid,all should not apply" },
356 "subtest_341": { "assert": ",all should apply" },
357 "subtest_342": { "assert": "all, should apply" },
358 "subtest_343": { "assert": ",all, should apply" },
359 "subtest_344": { "assert": "all,badmedium should apply" },
360 "subtest_345": { "assert": "badmedium,all should apply" },
361 "subtest_346": { "assert": ",badmedium, should not apply" },
362 "subtest_347": { "assert": "all,(badexpression) should apply" },
363 "subtest_348": { "assert": "(badexpression),all should apply" },
364 "subtest_349": { "assert": "(badexpression),badmedium should not apply" },
365 "subtest_350": { "assert": "badmedium,(badexpression) should not apply" },
366 "subtest_351": { "assert": "all,[badsyntax] should apply" },
367 "subtest_352": { "assert": "[badsyntax],all should apply" },
368 "subtest_353": { "assert": "badmedium,[badsyntax] should not apply" },
369 "subtest_354": { "assert": "[badsyntax],badmedium should not apply" },
370 "subtest_355": { "assert": "query all and color : should not be parseable" },
371 "subtest_356": { "assert": "query all and color : 1 should not be parseable" } ,
372 "subtest_357": { "assert": "all and min-color : 1 should not apply" },
373 "subtest_358": { "assert": "(bogus) should not apply" },
374 "subtest_359": { "assert": "not all and (bogus) should not apply" },
375 "subtest_360": { "assert": "only all and (bogus) should not apply" }
376 }
377 */</script>
11 </head> 378 </head>
12 <body onload="run()"> 379 <body onload="run()">
13 <div id=log></div> 380 <div id=log></div>
14 <iframe id="subdoc" src="resources/media_queries_iframe.html"></iframe> 381 <iframe id="subdoc" src="resources/media_queries_iframe.html"></iframe>
15 <div id="content" style="display: none"></div> 382 <div id="content" style="display: none"></div>
16 383
17 <script type="text/javascript"> 384 <script type="text/javascript">
18 setup({ "explicit_done": true }); 385 setup({ "explicit_done": true });
19 386
20 function assert_false_wrapper(fnc) {
21 try {
22 assert_false(fnc);
23 } catch (e) {
24 throw {message: e.message, stack: undefined};
25 }
26 }
27
28 function assert_true_wrapper(fnc) {
29 try {
30 assert_true(fnc);
31 } catch (e) {
32 throw {message: e.message, stack: undefined};
33 }
34 }
35
36
37 function run() { 387 function run() {
38 var subdoc = document.getElementById("subdoc").contentDocument; 388 var subdoc = document.getElementById("subdoc").contentDocument;
39 var subwin = document.getElementById("subdoc").contentWindow; 389 var subwin = document.getElementById("subdoc").contentWindow;
40 var style = subdoc.getElementById("style"); 390 var style = subdoc.getElementById("style");
41 var iframe_style = document.getElementById("subdoc").style; 391 var iframe_style = document.getElementById("subdoc").style;
42 var body_cs = subdoc.defaultView.getComputedStyle(subdoc.body, ""); 392 var body_cs = subdoc.defaultView.getComputedStyle(subdoc.body, "");
393 var testNum = 0;
43 394
44 function query_applies(q) { 395 function query_applies(q) {
45 style.setAttribute("media", q); 396 style.setAttribute("media", q);
46 return body_cs.getPropertyValue("text-decoration") == "underline"; 397 return body_cs.getPropertyValue("text-decoration") == "underline";
47 } 398 }
48 399
49 function should_apply(q, message) { 400 function should_apply(q) {
50 test(function() { 401 test(function() {
51 assert_true_wrapper(query_applies(q)); 402 assert_true(query_applies(q));
52 }, (message !== undefined ? message : q) + " should apply"); 403 }, "subtest_" + ++testNum, {assert: q + " should apply"});
53 } 404 }
54 405
55 function should_not_apply(q, message) { 406 function should_not_apply(q) {
56 test(function() { 407 test(function() {
57 assert_false_wrapper(query_applies(q)); 408 assert_false(query_applies(q));
58 }, (message !== undefined ? message : q) + " should not apply"); 409 }, "subtest_" + ++testNum, {assert: q + " should not apply"});
59 } 410 }
60 411
61 /* 412 /*
62 * Functions to test whether a query is parseable at all. (Should not 413 * Functions to test whether a query is parseable at all. (Should not
63 * be used for parse errors within expressions.) 414 * be used for parse errors within expressions.)
64 */ 415 */
65 var parse_test_style_element = document.createElement("style"); 416 var parse_test_style_element = document.createElement("style");
66 parse_test_style_element.type = "text/css"; 417 parse_test_style_element.type = "text/css";
67 parse_test_style_element.disabled = true; // for performance, hopefully 418 parse_test_style_element.disabled = true; // for performance, hopefully
68 var parse_test_style_text = document.createTextNode(""); 419 var parse_test_style_text = document.createTextNode("");
69 parse_test_style_element.appendChild(parse_test_style_text); 420 parse_test_style_element.appendChild(parse_test_style_text);
70 document.getElementsByTagName("head")[0] 421 document.getElementsByTagName("head")[0]
71 .appendChild(parse_test_style_element); 422 .appendChild(parse_test_style_element);
72 423
73 function query_is_parseable(q) { 424 function query_is_parseable(q) {
74 parse_test_style_text.data = "@media screen, " + q + " {}"; 425 parse_test_style_text.data = "@media screen, " + q + " {}";
75 var sheet = parse_test_style_element.sheet; // XXX yikes, not live! 426 var sheet = parse_test_style_element.sheet; // XXX yikes, not live!
76 if (sheet.cssRules.length == 1 && 427 if (sheet.cssRules.length == 1 &&
77 sheet.cssRules[0].type == CSSRule.MEDIA_RULE) 428 sheet.cssRules[0].type == CSSRule.MEDIA_RULE)
78 return sheet.cssRules[0].media.mediaText != "screen, not all"; 429 return sheet.cssRules[0].media.mediaText != "screen, not all";
79 430
80 assert_unreached( 431 assert_unreached(
81 "unexpected result testing whether query " + q + " is parseable"); 432 "unexpected result testing whether query " + q + " is parseable");
82 } 433 }
83 434
84 function query_should_be_parseable(q) { 435 function query_should_be_parseable(q) {
85 test(function() { 436 test(function() {
86 assert_true_wrapper(query_is_parseable(q)) 437 assert_true(query_is_parseable(q))
87 },"query " + q + " should be parseable"); 438 }, "subtest_" + ++testNum, {assert: "query " + q + " should be parseable"} );
88 } 439 }
89 440
90 function query_should_not_be_parseable(q) { 441 function query_should_not_be_parseable(q) {
91 test(function() { 442 test(function() {
92 assert_false_wrapper(query_is_parseable(q)) 443 assert_false(query_is_parseable(q))
93 },"query " + q + " should not be parseable"); 444 }, "subtest_" + ++testNum, {assert: "query " + q + " should not be parseab le"});
94 } 445 }
95 446
96 /* 447 /*
97 * Functions to test whether a single media expression is parseable. 448 * Functions to test whether a single media expression is parseable.
98 */ 449 */
99 function expression_is_parseable(e) { 450 function expression_is_parseable(e) {
100 style.setAttribute("media", "all and (" + e + ")"); 451 style.setAttribute("media", "all and (" + e + ")");
101 return style.sheet.media.mediaText != "not all"; 452 return style.sheet.media.mediaText != "not all";
102 } 453 }
103 454
104 function expression_should_be_parseable(e) { 455 function expression_should_be_parseable(e) {
105 test(function() { 456 test(function() {
106 assert_true_wrapper(expression_is_parseable(e)); 457 assert_true(expression_is_parseable(e));
107 },"expression " + e + " should be parseable"); 458 }, "subtest_" + ++testNum, {assert: "expression " + e + " should be parsea ble"});
108 } 459 }
109 460
110 function expression_should_not_be_parseable(e) { 461 function expression_should_not_be_parseable(e) {
111 test(function() { 462 test(function() {
112 assert_false_wrapper(expression_is_parseable(e)); 463 assert_false(expression_is_parseable(e));
113 },"expression " + e + " should not be parseable"); 464 }, "subtest_" + ++testNum, {assert: "expression " + e + " should not be pa rseable"});
114 } 465 }
115 466
116 // The no-type syntax doesn't mix with the not and only keywords. 467 // The no-type syntax doesn't mix with the not and only keywords.
117 query_should_be_parseable("(orientation)"); 468 query_should_be_parseable("(orientation)");
118 query_should_not_be_parseable("not (orientation)"); 469 query_should_not_be_parseable("not (orientation)");
119 query_should_not_be_parseable("only (orientation)"); 470 query_should_not_be_parseable("only (orientation)");
120 query_should_be_parseable("all and (orientation)"); 471 query_should_be_parseable("all and (orientation)");
121 query_should_be_parseable("not all and (orientation)"); 472 query_should_be_parseable("not all and (orientation)");
122 query_should_be_parseable("only all and (orientation)") 473 query_should_be_parseable("only all and (orientation)");
123 query_should_not_be_parseable("(orientation: 'landscape')");
124 474
125 var features = [ "width", "height", "device-width", "device-height" ]; 475 var features = [ "width", "height", "device-width", "device-height" ];
126 var feature; 476 var feature;
127 var i; 477 var i;
128 for (i in features) { 478 for (i in features) {
129 feature = features[i]; 479 feature = features[i];
130 expression_should_be_parseable(feature); 480 expression_should_be_parseable(feature);
131 expression_should_be_parseable(feature + ": 0"); 481 expression_should_be_parseable(feature + ": 0");
132 expression_should_be_parseable(feature + ": 0px"); 482 expression_should_be_parseable(feature + ": 0px");
133 expression_should_be_parseable(feature + ": 0em"); 483 expression_should_be_parseable(feature + ": 0em");
134 expression_should_be_parseable(feature + ": -0"); 484 expression_should_be_parseable(feature + ": -0");
135 expression_should_be_parseable("min-" + feature + ": -0"); 485 expression_should_be_parseable("min-" + feature + ": -0");
136 expression_should_be_parseable("max-" + feature + ": -0"); 486 expression_should_be_parseable("max-" + feature + ": -0");
137 expression_should_be_parseable(feature + ": -0cm"); 487 expression_should_be_parseable(feature + ": -0cm");
138 expression_should_be_parseable(feature + ": 1px"); 488 expression_should_be_parseable(feature + ": 1px");
139 expression_should_be_parseable(feature + ": 0.001mm"); 489 expression_should_be_parseable(feature + ": 0.001mm");
140 expression_should_be_parseable(feature + ": 100000px"); 490 expression_should_be_parseable(feature + ": 100000px");
141 expression_should_not_be_parseable(feature + ": -1px"); 491 expression_should_not_be_parseable(feature + ": -1px");
142 expression_should_not_be_parseable(feature + ": '20px'");
143 expression_should_not_be_parseable("min-" + feature + ": -1px"); 492 expression_should_not_be_parseable("min-" + feature + ": -1px");
144 expression_should_not_be_parseable("max-" + feature + ": -1px"); 493 expression_should_not_be_parseable("max-" + feature + ": -1px");
145 expression_should_not_be_parseable("min-" + feature + ": '10px'");
146 expression_should_not_be_parseable("max-" + feature + ": '10px'");
147 expression_should_not_be_parseable(feature + ": -0.00001mm"); 494 expression_should_not_be_parseable(feature + ": -0.00001mm");
148 expression_should_not_be_parseable(feature + ": -100000em"); 495 expression_should_not_be_parseable(feature + ": -100000em");
149 expression_should_not_be_parseable("min-" + feature); 496 expression_should_not_be_parseable("min-" + feature);
150 expression_should_not_be_parseable("max-" + feature); 497 expression_should_not_be_parseable("max-" + feature);
151 } 498 }
152 499
153 var content_div = document.getElementById("content"); 500 var content_div = document.getElementById("content");
154 content_div.style.font = "medium sans-serif"; 501 content_div.style.font = "medium sans-serif";
155 var em_size = 502 var em_size =
156 getComputedStyle(content_div, "").fontSize.match(/^(\d+)px$/)[1]; 503 getComputedStyle(content_div, "").fontSize.match(/^(\d+)px$/)[1];
157 504
158 // in this test, assume the common underlying implementation is correct 505 // in this test, assume the common underlying implementation is correct
159 var width_val = 117; // pick two not-too-round numbers 506 var width_val = 117; // pick two not-too-round numbers
160 var height_val = 76; 507 var height_val = 76;
161 iframe_style.width = width_val + "px"; 508 iframe_style.width = width_val + "px";
162 iframe_style.height = height_val + "px"; 509 iframe_style.height = height_val + "px";
163 var device_width = window.screen.width; 510 var device_width = window.screen.width;
164 var device_height = window.screen.height; 511 var device_height = window.screen.height;
165 features = { "width": width_val, 512 features = { "width": width_val,
166 "height": height_val, 513 "height": height_val,
167 "device-width": device_width, 514 "device-width": device_width,
168 "device-height": device_height }; 515 "device-height": device_height };
169 for (feature in features) { 516 for (feature in features) {
170 var value = features[feature]; 517 var value = features[feature];
171 should_apply("all and (" + feature + ": " + value + "px)", "all and (" + f eature + ": " + feature + " px)"); 518 should_apply("all and (" + feature + ": " + value + "px)");
172 should_not_apply("all and (" + feature + ": " + (value + 1) + "px)", "all and (" + feature + ": " + feature + " +1 px)"); 519 should_not_apply("all and (" + feature + ": " + (value + 1) + "px)");
173 should_not_apply("all and (" + feature + ": " + (value - 1) + "px)", "all and (" + feature + ": " + feature + " -1 px)"); 520 should_not_apply("all and (" + feature + ": " + (value - 1) + "px)");
174 should_apply("all and (min-" + feature + ": " + value + "px)", "all and (m in-" + feature + ": " + feature + " px)"); 521 should_apply("all and (min-" + feature + ": " + value + "px)");
175 should_not_apply("all and (min-" + feature + ": " + (value + 1) + "px)", " all and (min-" + feature + ": " + feature + " +1 px)"); 522 should_not_apply("all and (min-" + feature + ": " + (value + 1) + "px)");
176 should_apply("all and (min-" + feature + ": " + (value - 1) + "px)", "all and (min-" + feature + ": " + feature + " -1 px)"); 523 should_apply("all and (min-" + feature + ": " + (value - 1) + "px)");
177 should_apply("all and (max-" + feature + ": " + value + "px)", "all and (m ax-" + feature + ": " + feature + " px)"); 524 should_apply("all and (max-" + feature + ": " + value + "px)");
178 should_apply("all and (max-" + feature + ": " + (value + 1) + "px)", "all and (max-" + feature + ": " + feature + " +1 px)"); 525 should_apply("all and (max-" + feature + ": " + (value + 1) + "px)");
179 should_not_apply("all and (max-" + feature + ": " + (value - 1) + "px)", " all and (max-" + feature + ": " + feature + " +1 px)"); 526 should_not_apply("all and (max-" + feature + ": " + (value - 1) + "px)");
180 should_not_apply("all and (min-" + feature + ": " + 527 should_not_apply("all and (min-" + feature + ": " +
181 (Math.ceil(value/em_size) + 1) + "em)", "all and (min-" + feature + ": " + feature + " +1 em)"); 528 (Math.ceil(value/em_size) + 1) + "em)");
182 should_apply("all and (min-" + feature + ": " + 529 should_apply("all and (min-" + feature + ": " +
183 (Math.floor(value/em_size) - 1) + "em)", "all and (min-" + fe ature + ": " + feature + " -1 em)"); 530 (Math.floor(value/em_size) - 1) + "em)");
184 should_apply("all and (max-" + feature + ": " + 531 should_apply("all and (max-" + feature + ": " +
185 (Math.ceil(value/em_size) + 1) + "em)", "all and (max-" + fea ture + ": " + feature + " +1 em)"); 532 (Math.ceil(value/em_size) + 1) + "em)");
186 should_not_apply("all and (max-" + feature + ": " + 533 should_not_apply("all and (max-" + feature + ": " +
187 (Math.floor(value/em_size) - 1) + "em)", "all and (max-" + feature + ": " + feature + " -1 em)"); 534 (Math.floor(value/em_size) - 1) + "em)");
188 } 535 }
189 536
190 iframe_style.width = "0"; 537 iframe_style.width = "0";
191 should_apply("all and (height)"); 538 should_apply("all and (height)");
192 should_not_apply("all and (width)"); 539 should_not_apply("all and (width)");
193 iframe_style.height = "0"; 540 iframe_style.height = "0";
194 should_not_apply("all and (height)"); 541 should_not_apply("all and (height)");
195 should_not_apply("all and (width)"); 542 should_not_apply("all and (width)");
196 should_apply("all and (device-height)"); 543 should_apply("all and (device-height)");
197 should_apply("all and (device-width)"); 544 should_apply("all and (device-width)");
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 should_not_apply("(max-aspect-ratio: 59/81)"); 598 should_not_apply("(max-aspect-ratio: 59/81)");
252 should_apply("(max-aspect-ratio: 60/80)"); 599 should_apply("(max-aspect-ratio: 60/80)");
253 should_apply("(max-aspect-ratio: 59/79)"); 600 should_apply("(max-aspect-ratio: 59/79)");
254 expression_should_not_be_parseable("max-aspect-ratio"); 601 expression_should_not_be_parseable("max-aspect-ratio");
255 602
256 var real_dar = device_width + "/" + device_height; 603 var real_dar = device_width + "/" + device_height;
257 var high_dar_1 = (device_width + 1) + "/" + device_height; 604 var high_dar_1 = (device_width + 1) + "/" + device_height;
258 var high_dar_2 = device_width + "/" + (device_height - 1); 605 var high_dar_2 = device_width + "/" + (device_height - 1);
259 var low_dar_1 = (device_width - 1) + "/" + device_height; 606 var low_dar_1 = (device_width - 1) + "/" + device_height;
260 var low_dar_2 = device_width + "/" + (device_height + 1); 607 var low_dar_2 = device_width + "/" + (device_height + 1);
261 should_apply("(device-aspect-ratio: " + real_dar + ")", "(device-aspect-rati o: device-width / device-height)"); 608 should_apply("(device-aspect-ratio: " + real_dar + ")");
262 should_apply("not all and (device-aspect-ratio: " + high_dar_1 + ")", "not a ll and (device-aspect-ratio: device-width + 1 / device-height)"); 609 should_apply("not all and (device-aspect-ratio: " + high_dar_1 + ")");
263 should_not_apply("all and (device-aspect-ratio: " + high_dar_2 + ")", "all a nd (device-aspect-ratio: device-width / device-height - 1)"); 610 should_not_apply("all and (device-aspect-ratio: " + high_dar_2 + ")");
264 should_not_apply("all and (device-aspect-ratio: " + low_dar_1 + ")", "all an d (device-aspect-ratio: device-width - 1 / device-height)"); 611 should_not_apply("all and (device-aspect-ratio: " + low_dar_1 + ")");
265 should_apply("not all and (device-aspect-ratio: " + low_dar_2 + ")", "not al l and (device-aspect-ratio: device-width / device-height + 1)"); 612 should_apply("not all and (device-aspect-ratio: " + low_dar_2 + ")");
266 should_apply("(device-aspect-ratio)"); 613 should_apply("(device-aspect-ratio)");
267 614
268 should_apply("(min-device-aspect-ratio: " + real_dar + ")", "(min-device-asp ect-ratio: device-width / device-height)"); 615 should_apply("(min-device-aspect-ratio: " + real_dar + ")");
269 should_not_apply("all and (min-device-aspect-ratio: " + high_dar_1 + ")", "n ot all and (device-aspect-ratio: device-width + 1 / device-height)"); 616 should_not_apply("all and (min-device-aspect-ratio: " + high_dar_1 + ")");
270 should_apply("not all and (min-device-aspect-ratio: " + high_dar_2 + ")", "n ot all and (min-device-aspect-ratio: device-width / device-height - 1)"); 617 should_apply("not all and (min-device-aspect-ratio: " + high_dar_2 + ")");
271 should_not_apply("not all and (min-device-aspect-ratio: " + low_dar_1 + ")", "not all and (min-device-aspect-ratio: device-width - 1 / device-height)" ); 618 should_not_apply("not all and (min-device-aspect-ratio: " + low_dar_1 + ")") ;
272 should_apply("all and (min-device-aspect-ratio: " + low_dar_2 + ")", "all an d (min-device-aspect-ratio: device-width / device-height + 1)"); 619 should_apply("all and (min-device-aspect-ratio: " + low_dar_2 + ")");
273 expression_should_not_be_parseable("min-device-aspect-ratio"); 620 expression_should_not_be_parseable("min-device-aspect-ratio");
274 621
275 should_apply("all and (max-device-aspect-ratio: " + real_dar + ")", "all and (max-device-aspect-ratio: device-width / device-height)"); 622 should_apply("all and (max-device-aspect-ratio: " + real_dar + ")");
276 should_apply("(max-device-aspect-ratio: " + high_dar_1 + ")", "(max-device-a spect-ratio: device-width + 1 / device-height)"); 623 should_apply("(max-device-aspect-ratio: " + high_dar_1 + ")");
277 should_apply("(max-device-aspect-ratio: " + high_dar_2 + ")", "(max-device-a spect-ratio: device-width / device-height - 1"); 624 should_apply("(max-device-aspect-ratio: " + high_dar_2 + ")");
278 should_not_apply("all and (max-device-aspect-ratio: " + low_dar_1 + ")", "al l and (max-device-aspect-ratio: device-width - 1 / device-height)"); 625 should_not_apply("all and (max-device-aspect-ratio: " + low_dar_1 + ")");
279 should_apply("not all and (max-device-aspect-ratio: " + low_dar_2 + ")", "no t all and (max-device-aspect-ratio: device-width / device-height + 1)"); 626 should_apply("not all and (max-device-aspect-ratio: " + low_dar_2 + ")");
280 expression_should_not_be_parseable("max-device-aspect-ratio"); 627 expression_should_not_be_parseable("max-device-aspect-ratio");
281 628
282 features = [ "max-aspect-ratio", "device-aspect-ratio" ]; 629 features = [ "max-aspect-ratio", "device-aspect-ratio" ];
283 for (i in features) { 630 for (i in features) {
284 feature = features[i]; 631 feature = features[i];
285 expression_should_be_parseable(feature + ": 1/1"); 632 expression_should_be_parseable(feature + ": 1/1");
286 expression_should_be_parseable(feature + ": 1 /1"); 633 expression_should_be_parseable(feature + ": 1 /1");
287 expression_should_be_parseable(feature + ": 1 / \t\n1"); 634 expression_should_be_parseable(feature + ": 1 / \t\n1");
288 expression_should_be_parseable(feature + ": 1/\r1"); 635 expression_should_be_parseable(feature + ": 1/\r1");
289 expression_should_not_be_parseable(feature + ": 1"); 636 expression_should_not_be_parseable(feature + ": 1");
290 expression_should_not_be_parseable(feature + ": 0.5"); 637 expression_should_not_be_parseable(feature + ": 0.5");
291 expression_should_not_be_parseable(feature + ": 1.0/1"); 638 expression_should_not_be_parseable(feature + ": 1.0/1");
292 expression_should_not_be_parseable(feature + ": 1/1.0"); 639 expression_should_not_be_parseable(feature + ": 1/1.0");
293 expression_should_not_be_parseable(feature + ": 1.0/1.0"); 640 expression_should_not_be_parseable(feature + ": 1.0/1.0");
294 expression_should_not_be_parseable(feature + ": 0/1"); 641 expression_should_not_be_parseable(feature + ": 0/1");
295 expression_should_not_be_parseable(feature + ": 1/0"); 642 expression_should_not_be_parseable(feature + ": 1/0");
296 expression_should_not_be_parseable(feature + ": 0/0"); 643 expression_should_not_be_parseable(feature + ": 0/0");
297 expression_should_not_be_parseable(feature + ": -1/1"); 644 expression_should_not_be_parseable(feature + ": -1/1");
298 expression_should_not_be_parseable(feature + ": 1/-1"); 645 expression_should_not_be_parseable(feature + ": 1/-1");
299 expression_should_not_be_parseable(feature + ": -1/-1"); 646 expression_should_not_be_parseable(feature + ": -1/-1");
300 } 647 }
301 648
302 var is_monochrome = query_applies("all and (min-monochrome: 1)"); 649 var is_monochrome = query_applies("all and (min-monochrome: 1)");
303 var is_color = query_applies("all and (min-color: 1)"); 650 var is_color = query_applies("all and (min-color: 1)");
304 var colorString = is_color ? "color" : "monochrome";
305 test(function() { 651 test(function() {
306 assert_not_equals(is_monochrome, is_color, "should be either monochrome or color"); 652 assert_not_equals(is_monochrome, is_color, "should be either monochrome or color");
307 }, "monochrome_and_color"); 653 }, "monochrome_and_color");
308 654
309 function depth_query(prefix, depth) { 655 function depth_query(prefix, depth) {
310 return "all and (" + prefix + colorString + 656 return "all and (" + prefix + (is_color ? "color" : "monochrome") +
311 ":" + depth + ")"; 657 ":" + depth + ")";
312 } 658 }
313 659
314 var depth = 0; 660 var depth = 0;
315 do { 661 do {
316 if (depth > 50) { 662 if (depth > 50) {
317 break; 663 break;
318 } 664 }
319 } while (query_applies(depth_query("min-", ++depth))); 665 } while (query_applies(depth_query("min-", ++depth)));
320 test(function() { 666 test(function() {
321 assert_false_wrapper(50 < depth); 667 assert_false(50 < depth);
322 }, "find_depth"); 668 }, "find_depth");
323 --depth; 669 --depth;
324 670
325 should_apply(depth_query("", depth), "all and (" + colorString + ": depth)") ; 671 should_apply(depth_query("", depth));
326 should_not_apply(depth_query("", depth - 1), "all and (" + colorString + ": depth - 1)"); 672 should_not_apply(depth_query("", depth - 1));
327 should_not_apply(depth_query("", depth + 1), "all and (" + colorString + ": depth + 1)"); 673 should_not_apply(depth_query("", depth + 1));
328 should_apply(depth_query("max-", depth), "all and (max-" + colorString + ": depth)"); 674 should_apply(depth_query("max-", depth));
329 should_not_apply(depth_query("max-", depth - 1), "all and (max-" + colorStri ng + ": depth - 1)"); 675 should_not_apply(depth_query("max-", depth - 1));
330 should_apply(depth_query("max-", depth + 1), "all and (max-" + colorString + ": depth + 1)"); 676 should_apply(depth_query("max-", depth + 1));
331 677
332 (is_color ? should_apply : should_not_apply)("all and (color)"); 678 (is_color ? should_apply : should_not_apply)("all and (color)");
333 expression_should_not_be_parseable("max-color"); 679 expression_should_not_be_parseable("max-color");
334 expression_should_not_be_parseable("min-color"); 680 expression_should_not_be_parseable("min-color");
335 (is_color ? should_not_apply : should_apply)("all and (monochrome)"); 681 (is_color ? should_not_apply : should_apply)("all and (monochrome)");
336 expression_should_not_be_parseable("max-monochrome"); 682 expression_should_not_be_parseable("max-monochrome");
337 expression_should_not_be_parseable("min-monochrome"); 683 expression_should_not_be_parseable("min-monochrome");
338 (is_color ? should_apply : should_not_apply)("not all and (monochrome)"); 684 (is_color ? should_apply : should_not_apply)("not all and (monochrome)");
339 (is_color ? should_not_apply : should_apply)("not all and (color)"); 685 (is_color ? should_not_apply : should_apply)("not all and (color)");
340 (is_color ? should_apply : should_not_apply)("only all and (color)"); 686 (is_color ? should_apply : should_not_apply)("only all and (color)");
341 (is_color ? should_not_apply : should_apply)("only all and (monochrome)"); 687 (is_color ? should_not_apply : should_apply)("only all and (monochrome)");
342 688
343 features = [ "color", "min-monochrome" ]; 689 features = [ "color", "min-monochrome", "max-color-index" ];
344 for (i in features) { 690 for (i in features) {
345 feature = features[i]; 691 feature = features[i];
346 expression_should_be_parseable(feature + ": 1"); 692 expression_should_be_parseable(feature + ": 1");
347 expression_should_be_parseable(feature + ": 327"); 693 expression_should_be_parseable(feature + ": 327");
348 expression_should_be_parseable(feature + ": 0"); 694 expression_should_be_parseable(feature + ": 0");
349 expression_should_not_be_parseable(feature + ": 1.0"); 695 expression_should_not_be_parseable(feature + ": 1.0");
350 expression_should_not_be_parseable(feature + ": -1"); 696 expression_should_not_be_parseable(feature + ": -1");
351 expression_should_not_be_parseable(feature + ": 1/1"); 697 expression_should_not_be_parseable(feature + ": 1/1");
352 } 698 }
353 699
700 // Presume that we never support indexed color (at least not usefully
701 // enough to call it indexed color).
702 should_apply("(color-index: 0)");
703 should_not_apply("(color-index: 1)");
704 should_apply("(min-color-index: 0)");
705 should_not_apply("(min-color-index: 1)");
706 should_apply("(max-color-index: 0)");
707 should_apply("(max-color-index: 1)");
708 should_apply("(max-color-index: 157)");
709
710 features = [ "resolution", "min-resolution", "max-resolution" ];
711 for (i in features) {
712 feature = features[i];
713 expression_should_be_parseable(feature + ": 3dpi");
714 expression_should_be_parseable(feature + ":3dpi");
715 expression_should_be_parseable(feature + ": 3.0dpi");
716 expression_should_be_parseable(feature + ": 3.4dpi");
717 expression_should_be_parseable(feature + "\t: 120dpcm");
718 expression_should_not_be_parseable(feature + ": 0dpi");
719 expression_should_not_be_parseable(feature + ": -3dpi");
720 }
721
354 // Find the resolution using max-resolution 722 // Find the resolution using max-resolution
355 var resolution = 0; 723 var resolution = 0;
356 var max_resolution = 1000; 724 do {
357 725 ++resolution;
358 if (query_applies("(resolution)")) { 726 if (resolution > 10000) {
359 do { 727 break;
360 ++resolution; 728 }
361 if (resolution > max_resolution) { 729 } while (!query_applies("(max-resolution: " + resolution + "dpi)"));
362 break;
363 }
364 } while (!query_applies("(max-resolution: " + resolution + "dpi)"));
365 } else {
366 resolution = max_resolution + 1;
367 }
368
369 test(function() { 730 test(function() {
370 assert_false_wrapper(max_resolution < resolution); 731 assert_false(10000 < resolution);
371 }, "find_resolution"); 732 }, "find_resolution");
372 733
373 // resolution should now be Math.ceil() of the actual resolution. 734 // resolution should now be Math.ceil() of the actual resolution.
374 var dpi_high; 735 var dpi_high;
375 var dpi_low = resolution - 1; 736 var dpi_low = resolution - 1;
376 var dpi_low_str = "dpi - 1";
377 var dpi_high_str = "dpi + 1";
378 if (query_applies("(min-resolution: " + resolution + "dpi)")) { 737 if (query_applies("(min-resolution: " + resolution + "dpi)")) {
379 // It's exact! 738 // It's exact!
380 should_apply("(resolution: " + resolution + "dpi)", "(resolution: dpi)"); 739 should_apply("(resolution: " + resolution + "dpi)");
381 should_not_apply("(resolution: " + (resolution + 1) + "dpi)", "(resolution : dpi + 1)"); 740 should_not_apply("(resolution: " + (resolution + 1) + "dpi)");
382 should_not_apply("(resolution: " + (resolution - 1) + "dpi)", "(resolution : dpi - 1)"); 741 should_not_apply("(resolution: " + (resolution - 1) + "dpi)");
383 dpi_high = resolution + 1; 742 dpi_high = resolution + 1;
384 } else { 743 } else {
385 // We have no way to test resolution applying since it need not be 744 // We have no way to test resolution applying since it need not be
386 // an integer. 745 // an integer.
387 should_not_apply("(resolution: " + resolution + "dpi)", "(resolution: dpi) "); 746 should_not_apply("(resolution: " + resolution + "dpi)");
388 should_not_apply("(resolution: " + (resolution - 1) + "dpi)", "(resolution : dpi + 1)"); 747 should_not_apply("(resolution: " + (resolution - 1) + "dpi)");
389 dpi_high = resolution; 748 dpi_high = resolution;
390 } 749 }
391 750
392 should_apply("(min-resolution: " + dpi_low + "dpi)", "(min-resolution: " + d pi_low_str + " )"); 751 should_apply("(min-resolution: " + dpi_low + "dpi)");
393 should_not_apply("not all and (min-resolution: " + dpi_low + "dpi)", "not al l and (min-resolution: " + dpi_low_str + " )"); 752 should_not_apply("not all and (min-resolution: " + dpi_low + "dpi)");
394 should_apply("not all and (min-resolution: " + dpi_high + "dpi)", "not all a nd (min-resolution: " + dpi_high_str + " )"); 753 should_apply("not all and (min-resolution: " + dpi_high + "dpi)");
395 should_not_apply("all and (min-resolution: " + dpi_high + "dpi)", "all and ( min-resolution: " + dpi_high_str + " )"); 754 should_not_apply("all and (min-resolution: " + dpi_high + "dpi)");
396 755
397 // Test dpcm units based on what we computed in dpi. 756 // Test dpcm units based on what we computed in dpi.
398 var dpcm_high = Math.ceil(dpi_high / 2.54); 757 var dpcm_high = Math.ceil(dpi_high / 2.54);
399 var dpcm_low = Math.floor(dpi_low / 2.54); 758 var dpcm_low = Math.floor(dpi_low / 2.54);
400 should_apply("(min-resolution: " + dpcm_low + "dpcm)", "(min-resolution: dpc m (" + dpi_low_str + ") )"); 759 should_apply("(min-resolution: " + dpcm_low + "dpcm)");
401 should_apply("(max-resolution: " + dpcm_high + "dpcm)", "(max-resolution: dp cm (" + dpi_high_str + ") )"); 760 should_apply("(max-resolution: " + dpcm_high + "dpcm)");
402 should_not_apply("(max-resolution: " + dpcm_low + "dpcm)", "(max-resolution: dpcm (" + dpi_low_str + ") )"); 761 should_not_apply("(max-resolution: " + dpcm_low + "dpcm)");
403 should_apply("not all and (min-resolution: " + dpcm_high + "dpcm)", "not all and (min-resolution: dpcm (" + dpi_high_str + ") )"); 762 should_apply("not all and (min-resolution: " + dpcm_high + "dpcm)");
763
764 expression_should_be_parseable("scan");
765 expression_should_be_parseable("scan: progressive");
766 expression_should_be_parseable("scan:interlace");
767 expression_should_not_be_parseable("min-scan:interlace");
768 expression_should_not_be_parseable("scan: 1");
769 expression_should_not_be_parseable("max-scan");
770 expression_should_not_be_parseable("max-scan: progressive");
771 // Assume we don't support tv devices.
772 should_not_apply("(scan)");
773 should_not_apply("(scan: progressive)");
774 should_not_apply("(scan: interlace)");
775 should_apply("not all and (scan)");
776 should_apply("not all and (scan: progressive)");
777 should_apply("not all and (scan: interlace)");
404 778
405 expression_should_be_parseable("grid"); 779 expression_should_be_parseable("grid");
406 expression_should_be_parseable("grid: 0"); 780 expression_should_be_parseable("grid: 0");
407 expression_should_be_parseable("grid: 1"); 781 expression_should_be_parseable("grid: 1");
408 expression_should_be_parseable("grid: 1"); 782 expression_should_be_parseable("grid: 1");
409 expression_should_not_be_parseable("min-grid"); 783 expression_should_not_be_parseable("min-grid");
410 expression_should_not_be_parseable("min-grid:0"); 784 expression_should_not_be_parseable("min-grid:0");
411 expression_should_not_be_parseable("max-grid: 1"); 785 expression_should_not_be_parseable("max-grid: 1");
412 expression_should_not_be_parseable("grid: 2"); 786 expression_should_not_be_parseable("grid: 2");
413 expression_should_not_be_parseable("grid: -1"); 787 expression_should_not_be_parseable("grid: -1");
414 788
415 // Assume we don't support grid devices 789 // Assume we don't support grid devices
416 should_not_apply("(grid)"); 790 should_not_apply("(grid)");
417 should_apply("(grid: 0)"); 791 should_apply("(grid: 0)");
418 should_not_apply("(grid: 1)"); 792 should_not_apply("(grid: 1)");
419 should_not_apply("(grid: 2)"); 793 should_not_apply("(grid: 2)");
420 should_not_apply("(grid: -1)"); 794 should_not_apply("(grid: -1)");
421 795
796 // Parsing tests
797 // bug 454227
798 should_apply("(orientation");
799 should_not_apply("not all and (orientation");
800 should_not_apply("(orientation:");
801 should_apply("all,(orientation:");
802 should_not_apply("(orientation:,all");
803 should_apply("not all and (grid");
804 should_not_apply("only all and (grid");
805 should_not_apply("(grid");
806 should_apply("all,(grid");
807 should_not_apply("(grid,all");
808 // bug 454226
809 should_apply(",all");
810 should_apply("all,");
811 should_apply(",all,");
812 should_apply("all,badmedium");
813 should_apply("badmedium,all");
814 should_not_apply(",badmedium,");
815 should_apply("all,(badexpression)");
816 should_apply("(badexpression),all");
817 should_not_apply("(badexpression),badmedium");
818 should_not_apply("badmedium,(badexpression)");
819 should_apply("all,[badsyntax]");
820 should_apply("[badsyntax],all");
821 should_not_apply("badmedium,[badsyntax]");
822 should_not_apply("[badsyntax],badmedium");
823
824 // Parsing tests based on Acid3
825 query_should_not_be_parseable("all and color :");
826 query_should_not_be_parseable("all and color : 1");
827 should_not_apply("all and min-color : 1");
828 should_not_apply("(bogus)");
829 should_not_apply("not all and (bogus)")
830 should_not_apply("only all and (bogus)")
831
422 done(); 832 done();
423 } 833 }
424 834
425 </script> 835 </script>
426 </body> 836 </body>
427 </html> 837 </html>
OLDNEW
« no previous file with comments | « LayoutTests/fast/media/w3c/README ('k') | LayoutTests/fast/media/w3c/test_media_queries-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698