OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #library('layout_tests'); | 5 #library('layout_tests'); |
6 | 6 |
7 #import('dart:html'); | 7 #import('dart:html'); |
8 #import('../../../../../ui_lib/base/base.dart'); | 8 #import('../../../../../ui_lib/base/base.dart'); |
9 #import('../../../../../ui_lib/layout/layout.dart'); | 9 #import('../../../../../ui_lib/layout/layout.dart'); |
10 #import('../../../../../ui_lib/view/view.dart'); | 10 #import('../../../../../ui_lib/view/view.dart'); |
11 #import('../../../../../ui_lib/util/utilslib.dart'); | 11 #import('../../../../../ui_lib/util/utilslib.dart'); |
12 #import('../../../../../../lib/unittest/unittest_html.dart'); | 12 #import('../../../../../../lib/unittest/unittest.dart'); |
| 13 #import('../../../../../../lib/unittest/html_config.dart'); |
13 | 14 |
14 #source('GridLayoutDemo.dart'); | 15 #source('GridLayoutDemo.dart'); |
15 #source('GridExamples.dart'); | 16 #source('GridExamples.dart'); |
16 #source('CSS.dart'); | 17 #source('CSS.dart'); |
17 | 18 |
18 // TODO(jmesserly): these tests would be easier to work with if they were WebKit | 19 // TODO(jmesserly): these tests would be easier to work with if they were WebKit |
19 // layout tests. The way DumpRenderTree works is exactly what we want for | 20 // layout tests. The way DumpRenderTree works is exactly what we want for |
20 // testing layout: run the example and then print the element tree with metrics. | 21 // testing layout: run the example and then print the element tree with metrics. |
21 // The UnitTestSuite wrapper gets in our way here, because you can't "see" the | 22 // The UnitTestSuite wrapper gets in our way here, because you can't "see" the |
22 // test layout visually when you're debugging. | 23 // test layout visually when you're debugging. |
23 // See these links for more info: | 24 // See these links for more info: |
24 // http://www.webkit.org/quality/testwriting.html | 25 // http://www.webkit.org/quality/testwriting.html |
25 // http://www.w3.org/Style/CSS/Test/guidelines.html | 26 // http://www.w3.org/Style/CSS/Test/guidelines.html |
26 | 27 |
27 // TODO(jmesserly): need parser unit tests, especially error conditions | 28 // TODO(jmesserly): need parser unit tests, especially error conditions |
28 | 29 |
29 /** | 30 /** |
30 * Tests the grid layout. Currently based on examples from the spec at: | 31 * Tests the grid layout. Currently based on examples from the spec at: |
31 * [http://dev.w3.org/csswg/css3-grid-align/] | 32 * [http://dev.w3.org/csswg/css3-grid-align/] |
32 */ | 33 */ |
33 main() { | 34 main() { |
| 35 useHtmlConfiguration(); |
34 addGridStyles('400px', '400px'); | 36 addGridStyles('400px', '400px'); |
35 | 37 |
36 asyncTest('Spec Example 1', 1, () { | 38 asyncTest('Spec Example 1', 1, () { |
37 verifyExample('1 Adaptive Layouts', { | 39 verifyExample('1 Adaptive Layouts', { |
38 'title': [0, 0, 144, 24], | 40 'title': [0, 0, 144, 24], |
39 'score': [0, 376, 144, 24], | 41 'score': [0, 376, 144, 24], |
40 'stats': [0, 24, 144, 24], | 42 'stats': [0, 24, 144, 24], |
41 'board': [144, 0, 256, 376], | 43 'board': [144, 0, 256, 376], |
42 'controls': [185, 376, 174, 24], | 44 'controls': [185, 376, 174, 24], |
43 }); | 45 }); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 Expect.equals(values[1], offset.top); | 181 Expect.equals(values[1], offset.top); |
180 Expect.equals(values[2], offset.width); | 182 Expect.equals(values[2], offset.width); |
181 Expect.equals(values[3], offset.height); | 183 Expect.equals(values[3], offset.height); |
182 }); | 184 }); |
183 } | 185 } |
184 } | 186 } |
185 | 187 |
186 verifyExample(String example, [Map expected = null]) { | 188 verifyExample(String example, [Map expected = null]) { |
187 usingGrid(example, (grid) => verifyGrid(example, expected)); | 189 usingGrid(example, (grid) => verifyGrid(example, expected)); |
188 } | 190 } |
OLD | NEW |