|
|
@ -1,6 +1,7 @@
|
|
|
|
// ignore_for_file: cascade_invocations
|
|
|
|
// ignore_for_file: cascade_invocations
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:bloc_test/bloc_test.dart';
|
|
|
|
import 'package:bloc_test/bloc_test.dart';
|
|
|
|
|
|
|
|
import 'package:flame/components.dart';
|
|
|
|
import 'package:flame/extensions.dart';
|
|
|
|
import 'package:flame/extensions.dart';
|
|
|
|
import 'package:flame_forge2d/flame_forge2d.dart';
|
|
|
|
import 'package:flame_forge2d/flame_forge2d.dart';
|
|
|
|
import 'package:flame_test/flame_test.dart';
|
|
|
|
import 'package:flame_test/flame_test.dart';
|
|
|
@ -100,6 +101,7 @@ void main() {
|
|
|
|
group('turboCharge', () {
|
|
|
|
group('turboCharge', () {
|
|
|
|
setUpAll(() {
|
|
|
|
setUpAll(() {
|
|
|
|
registerFallbackValue(Vector2.zero());
|
|
|
|
registerFallbackValue(Vector2.zero());
|
|
|
|
|
|
|
|
registerFallbackValue(Component());
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
flameBlocTester.testGameWidget(
|
|
|
|
flameBlocTester.testGameWidget(
|
|
|
@ -125,7 +127,7 @@ void main() {
|
|
|
|
final controller = _WrappedBallController(ball, gameRef);
|
|
|
|
final controller = _WrappedBallController(ball, gameRef);
|
|
|
|
when(() => gameRef.read<GameBloc>()).thenReturn(gameBloc);
|
|
|
|
when(() => gameRef.read<GameBloc>()).thenReturn(gameBloc);
|
|
|
|
when(() => ball.controller).thenReturn(controller);
|
|
|
|
when(() => ball.controller).thenReturn(controller);
|
|
|
|
when(() => ball.boost(any())).thenAnswer((_) async {});
|
|
|
|
when(() => ball.add(any())).thenAnswer((_) async {});
|
|
|
|
|
|
|
|
|
|
|
|
await controller.turboCharge();
|
|
|
|
await controller.turboCharge();
|
|
|
|
|
|
|
|
|
|
|
@ -141,29 +143,13 @@ void main() {
|
|
|
|
final controller = _WrappedBallController(ball, gameRef);
|
|
|
|
final controller = _WrappedBallController(ball, gameRef);
|
|
|
|
when(() => gameRef.read<GameBloc>()).thenReturn(gameBloc);
|
|
|
|
when(() => gameRef.read<GameBloc>()).thenReturn(gameBloc);
|
|
|
|
when(() => ball.controller).thenReturn(controller);
|
|
|
|
when(() => ball.controller).thenReturn(controller);
|
|
|
|
when(() => ball.boost(any())).thenAnswer((_) async {});
|
|
|
|
when(() => ball.add(any())).thenAnswer((_) async {});
|
|
|
|
|
|
|
|
|
|
|
|
await controller.turboCharge();
|
|
|
|
await controller.turboCharge();
|
|
|
|
|
|
|
|
|
|
|
|
verify(ball.resume).called(1);
|
|
|
|
verify(ball.resume).called(1);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
flameBlocTester.test(
|
|
|
|
|
|
|
|
'boosts the ball',
|
|
|
|
|
|
|
|
(game) async {
|
|
|
|
|
|
|
|
final gameRef = _MockPinballGame();
|
|
|
|
|
|
|
|
final ball = _MockControlledBall();
|
|
|
|
|
|
|
|
final controller = _WrappedBallController(ball, gameRef);
|
|
|
|
|
|
|
|
when(() => gameRef.read<GameBloc>()).thenReturn(gameBloc);
|
|
|
|
|
|
|
|
when(() => ball.controller).thenReturn(controller);
|
|
|
|
|
|
|
|
when(() => ball.boost(any())).thenAnswer((_) async {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await controller.turboCharge();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
verify(() => ball.boost(any())).called(1);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|