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 | 5 |
6 #library('dartcombat_tests'); | 6 #library('dartcombat_tests'); |
7 | 7 |
8 #import('dart:html'); | 8 #import('dart:html'); |
9 #import('dart:isolate'); | 9 #import('dart:isolate'); |
10 #import('../../../../pkg/unittest/unittest.dart'); | 10 #import('../../../../pkg/unittest/lib/unittest.dart'); |
11 #import('../../../../pkg/unittest/html_config.dart'); | 11 #import('../../../../pkg/unittest/lib/html_config.dart'); |
12 #import('../../../dartcombat/dartcombatlib.dart'); | 12 #import('../../../dartcombat/dartcombatlib.dart'); |
13 | 13 |
14 ReceivePort testPort; | 14 ReceivePort testPort; |
15 | 15 |
16 main() { | 16 main() { |
17 useHtmlConfiguration(); | 17 useHtmlConfiguration(); |
18 testPort = new ReceivePort(); | 18 testPort = new ReceivePort(); |
19 | 19 |
20 setupUI(); | 20 setupUI(); |
21 // add relative URL to stylesheet to the correct location. Note: The CSS is | 21 // add relative URL to stylesheet to the correct location. Note: The CSS is |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 List<int> expectedShots = const [ | 106 List<int> expectedShots = const [ |
107 Constants.HIT, 8, 4, // initial shot (center) | 107 Constants.HIT, 8, 4, // initial shot (center) |
108 Constants.MISS, 7, 4, // left (miss - stop this direction) | 108 Constants.MISS, 7, 4, // left (miss - stop this direction) |
109 Constants.MISS, 9, 4, // right (miss - stop this direction) | 109 Constants.MISS, 9, 4, // right (miss - stop this direction) |
110 Constants.HIT, 8, 3, // up | 110 Constants.HIT, 8, 3, // up |
111 Constants.MISS, 8, 2, // up (miss - stop this direction) | 111 Constants.MISS, 8, 2, // up (miss - stop this direction) |
112 Constants.HIT, 8, 5, // down | 112 Constants.HIT, 8, 5, // down |
113 Constants.HIT, 8, 6, // down | 113 Constants.HIT, 8, 6, // down |
114 Constants.SUNK, 8, 7]; // down (sunk - done) | 114 Constants.SUNK, 8, 7]; // down (sunk - done) |
115 _expectShotSequence(expectedShots, p2OwnBoard, 2, callback); | 115 _expectShotSequence(expectedShots, p2OwnBoard, 2, callback); |
116 | 116 |
117 // hit the boat from the enemy side. | 117 // hit the boat from the enemy side. |
118 var p1EnemyBoard = document.query("#p1enemy"); | 118 var p1EnemyBoard = document.query("#p1enemy"); |
119 var hitCell = p1EnemyBoard.nodes[0].nodes[4].nodes[8]; | 119 var hitCell = p1EnemyBoard.nodes[0].nodes[4].nodes[8]; |
120 doMouseEvent("click", hitCell); | 120 doMouseEvent("click", hitCell); |
121 } | 121 } |
122 ]); | 122 ]); |
123 }); | 123 }); |
124 } | 124 } |
125 | 125 |
126 _expectShotSequence(List<int> expectedShots, Element playerBoard, | 126 _expectShotSequence(List<int> expectedShots, Element playerBoard, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 void invokeNext() { | 169 void invokeNext() { |
170 closures[i](); | 170 closures[i](); |
171 i++; | 171 i++; |
172 if (i < length) { | 172 if (i < length) { |
173 window.setTimeout(expectAsync0(invokeNext), 0); | 173 window.setTimeout(expectAsync0(invokeNext), 0); |
174 } | 174 } |
175 } | 175 } |
176 window.setTimeout(expectAsync0(invokeNext), 0); | 176 window.setTimeout(expectAsync0(invokeNext), 0); |
177 } | 177 } |
178 } | 178 } |
OLD | NEW |