|
|
|
@ -53,30 +53,39 @@ void main() {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
flameBlocTester.testGameWidget(
|
|
|
|
|
'when loaded adds BallAdded to GameBloc',
|
|
|
|
|
"lost doesn't adds RoundLost to GameBloc "
|
|
|
|
|
'when there are balls left',
|
|
|
|
|
setUp: (game, tester) async {
|
|
|
|
|
final controller = BallController(ball);
|
|
|
|
|
await ball.add(controller);
|
|
|
|
|
await game.ensureAdd(ball);
|
|
|
|
|
|
|
|
|
|
final otherBall = Ball(baseColor: const Color(0xFF00FFFF));
|
|
|
|
|
final otherController = BallController(otherBall);
|
|
|
|
|
await otherBall.add(otherController);
|
|
|
|
|
await game.ensureAdd(otherBall);
|
|
|
|
|
|
|
|
|
|
controller.lost();
|
|
|
|
|
await game.ready();
|
|
|
|
|
},
|
|
|
|
|
verify: (game, tester) async {
|
|
|
|
|
verify(() => gameBloc.add(const BallAdded())).called(1);
|
|
|
|
|
verifyNever(() => gameBloc.add(const RoundLost()));
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
flameBlocTester.testGameWidget(
|
|
|
|
|
'lost adds BallLost to GameBloc',
|
|
|
|
|
'lost adds RoundLost to GameBloc '
|
|
|
|
|
'when there are no balls left',
|
|
|
|
|
setUp: (game, tester) async {
|
|
|
|
|
final controller = BallController(ball);
|
|
|
|
|
await ball.add(controller);
|
|
|
|
|
await game.ensureAdd(ball);
|
|
|
|
|
|
|
|
|
|
controller.lost();
|
|
|
|
|
await game.ready();
|
|
|
|
|
},
|
|
|
|
|
verify: (game, tester) async {
|
|
|
|
|
verify(() => gameBloc.add(const BallLost())).called(1);
|
|
|
|
|
verify(() => gameBloc.add(const RoundLost())).called(1);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|