| 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'); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 window.setTimeout(expectAsync0(() { grid.removeFromDocument(); }), 0); | 161 window.setTimeout(expectAsync0(() { grid.removeFromDocument(); }), 0); |
| 162 }, 0); | 162 }, 0); |
| 163 } | 163 } |
| 164 | 164 |
| 165 verifyGrid(String example, [Map expected = null]) { | 165 verifyGrid(String example, [Map expected = null]) { |
| 166 printMetrics(example); | 166 printMetrics(example); |
| 167 if (expected == null) { | 167 if (expected == null) { |
| 168 return; | 168 return; |
| 169 } | 169 } |
| 170 | 170 |
| 171 for (String name in expected.getKeys()) { | 171 for (String name in expected.keys) { |
| 172 final values = expected[name]; | 172 final values = expected[name]; |
| 173 final node = document.body.query('#$name'); | 173 final node = document.body.query('#$name'); |
| 174 Expect.isNotNull(node); | 174 Expect.isNotNull(node); |
| 175 node.rect.then(expectAsync0((rect) { | 175 node.rect.then(expectAsync0((rect) { |
| 176 final offset = rect.offset; | 176 final offset = rect.offset; |
| 177 Expect.equals(values[0], offset.left); | 177 Expect.equals(values[0], offset.left); |
| 178 Expect.equals(values[1], offset.top); | 178 Expect.equals(values[1], offset.top); |
| 179 Expect.equals(values[2], offset.width); | 179 Expect.equals(values[2], offset.width); |
| 180 Expect.equals(values[3], offset.height); | 180 Expect.equals(values[3], offset.height); |
| 181 })); | 181 })); |
| 182 } | 182 } |
| 183 } | 183 } |
| 184 | 184 |
| 185 verifyExample(String example, [Map expected = null]) { | 185 verifyExample(String example, [Map expected = null]) { |
| 186 usingGrid(example, (grid) => verifyGrid(example, expected)); | 186 usingGrid(example, (grid) => verifyGrid(example, expected)); |
| 187 } | 187 } |
| OLD | NEW |