|
|
@ -66,12 +66,12 @@ void main() {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
final tester = flameBlocTester<PinballGame>(
|
|
|
|
final flameBlocTester = FlameBlocTester<PinballGame, GameBloc>(
|
|
|
|
game: PinballGameTest.create,
|
|
|
|
gameBuilder: PinballGameTest.create,
|
|
|
|
gameBloc: () => gameBloc,
|
|
|
|
blocBuilder: () => gameBloc,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
tester.testGameWidget(
|
|
|
|
flameBlocTester.testGameWidget(
|
|
|
|
'lost adds BallLost to GameBloc',
|
|
|
|
'lost adds BallLost to GameBloc',
|
|
|
|
setUp: (game, tester) async {
|
|
|
|
setUp: (game, tester) async {
|
|
|
|
final controller = LaunchedBallController(ball);
|
|
|
|
final controller = LaunchedBallController(ball);
|
|
|
@ -86,7 +86,7 @@ void main() {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
group('listenWhen', () {
|
|
|
|
group('listenWhen', () {
|
|
|
|
tester.testGameWidget(
|
|
|
|
flameBlocTester.testGameWidget(
|
|
|
|
'listens when a ball has been lost',
|
|
|
|
'listens when a ball has been lost',
|
|
|
|
setUp: (game, tester) async {
|
|
|
|
setUp: (game, tester) async {
|
|
|
|
final controller = LaunchedBallController(ball);
|
|
|
|
final controller = LaunchedBallController(ball);
|
|
|
@ -107,7 +107,7 @@ void main() {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
tester.testGameWidget(
|
|
|
|
flameBlocTester.testGameWidget(
|
|
|
|
'does not listen when a ball has not been lost',
|
|
|
|
'does not listen when a ball has not been lost',
|
|
|
|
setUp: (game, tester) async {
|
|
|
|
setUp: (game, tester) async {
|
|
|
|
final controller = LaunchedBallController(ball);
|
|
|
|
final controller = LaunchedBallController(ball);
|
|
|
@ -130,7 +130,7 @@ void main() {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
group('onNewState', () {
|
|
|
|
group('onNewState', () {
|
|
|
|
tester.testGameWidget(
|
|
|
|
flameBlocTester.testGameWidget(
|
|
|
|
'removes ball',
|
|
|
|
'removes ball',
|
|
|
|
setUp: (game, tester) async {
|
|
|
|
setUp: (game, tester) async {
|
|
|
|
final controller = LaunchedBallController(ball);
|
|
|
|
final controller = LaunchedBallController(ball);
|
|
|
@ -147,7 +147,7 @@ void main() {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
tester.testGameWidget(
|
|
|
|
flameBlocTester.testGameWidget(
|
|
|
|
'spawns a new ball when the ball is not the last one',
|
|
|
|
'spawns a new ball when the ball is not the last one',
|
|
|
|
setUp: (game, tester) async {
|
|
|
|
setUp: (game, tester) async {
|
|
|
|
final controller = LaunchedBallController(ball);
|
|
|
|
final controller = LaunchedBallController(ball);
|
|
|
@ -168,7 +168,7 @@ void main() {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
tester.testGameWidget(
|
|
|
|
flameBlocTester.testGameWidget(
|
|
|
|
'does not spawn a new ball is the last one',
|
|
|
|
'does not spawn a new ball is the last one',
|
|
|
|
setUp: (game, tester) async {
|
|
|
|
setUp: (game, tester) async {
|
|
|
|
final controller = LaunchedBallController(ball);
|
|
|
|
final controller = LaunchedBallController(ball);
|
|
|
|