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

Side by Side Diff: samples/tests/samples/lib/layout/layout_test.dart

Issue 12253011: Reapply remove setInterval. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
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:async';
7 import 'dart:html'; 8 import 'dart:html';
8 import '../../../../swarm/swarm_ui_lib/base/base.dart'; 9 import '../../../../swarm/swarm_ui_lib/base/base.dart';
9 import '../../../../swarm/swarm_ui_lib/layout/layout.dart'; 10 import '../../../../swarm/swarm_ui_lib/layout/layout.dart';
10 import '../../../../swarm/swarm_ui_lib/view/view.dart'; 11 import '../../../../swarm/swarm_ui_lib/view/view.dart';
11 import '../../../../swarm/swarm_ui_lib/util/utilslib.dart'; 12 import '../../../../swarm/swarm_ui_lib/util/utilslib.dart';
12 import '../../../../../pkg/unittest/lib/unittest.dart'; 13 import '../../../../../pkg/unittest/lib/unittest.dart';
13 import '../../../../../pkg/unittest/lib/html_config.dart'; 14 import '../../../../../pkg/unittest/lib/html_config.dart';
14 15
15 part 'grid_layout_demo.dart'; 16 part 'grid_layout_demo.dart';
16 part 'grid_examples.dart'; 17 part 'grid_examples.dart';
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 }); 150 });
150 }); 151 });
151 } 152 }
152 153
153 // Note: to debug failures, best bet is to use GridLayoutDemo to run an 154 // Note: to debug failures, best bet is to use GridLayoutDemo to run an
154 // individual asyncTest and see the resulting layout. 155 // individual asyncTest and see the resulting layout.
155 156
156 usingGrid(String example, void test_(View grid)) { 157 usingGrid(String example, void test_(View grid)) {
157 final grid = createGrid(GridExamples.styles[example]); 158 final grid = createGrid(GridExamples.styles[example]);
158 grid.addToDocument(document.body); 159 grid.addToDocument(document.body);
159 window.setTimeout(() { 160 Timer.run(() {
160 test_(grid); 161 test_(grid);
161 window.setTimeout(expectAsync0(() { grid.removeFromDocument(); }), 0); 162 Timer.run(expectAsync0(() { grid.removeFromDocument(); }));
162 }, 0); 163 });
163 } 164 }
164 165
165 verifyGrid(String example, [Map expected = null]) { 166 verifyGrid(String example, [Map expected = null]) {
166 printMetrics(example); 167 printMetrics(example);
167 if (expected == null) { 168 if (expected == null) {
168 return; 169 return;
169 } 170 }
170 171
171 for (String name in expected.keys) { 172 for (String name in expected.keys) {
172 final values = expected[name]; 173 final values = expected[name];
173 final node = document.body.query('#$name'); 174 final node = document.body.query('#$name');
174 Expect.isNotNull(node); 175 Expect.isNotNull(node);
175 window.setImmediate(expectAsync0(() { 176 window.setImmediate(expectAsync0(() {
176 Expect.equals(values[0], node.offsetLeft); 177 Expect.equals(values[0], node.offsetLeft);
177 Expect.equals(values[1], node.offsetTop); 178 Expect.equals(values[1], node.offsetTop);
178 Expect.equals(values[2], node.offsetWidth); 179 Expect.equals(values[2], node.offsetWidth);
179 Expect.equals(values[3], node.offsetHeight); 180 Expect.equals(values[3], node.offsetHeight);
180 })); 181 }));
181 } 182 }
182 } 183 }
183 184
184 verifyExample(String example, [Map expected = null]) { 185 verifyExample(String example, [Map expected = null]) {
185 usingGrid(example, (grid) => verifyGrid(example, expected)); 186 usingGrid(example, (grid) => verifyGrid(example, expected));
186 } 187 }
OLDNEW
« no previous file with comments | « samples/tests/samples/dartcombat/dartcombat_test.dart ('k') | samples/tests/samples/swarm/swarm_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698