|
|
@ -17,11 +17,23 @@ void main() {
|
|
|
|
|
|
|
|
|
|
|
|
group('BonusBallController', () {
|
|
|
|
group('BonusBallController', () {
|
|
|
|
late Ball ball;
|
|
|
|
late Ball ball;
|
|
|
|
|
|
|
|
late GameBloc gameBloc;
|
|
|
|
|
|
|
|
|
|
|
|
setUp(() {
|
|
|
|
setUp(() {
|
|
|
|
ball = Ball(baseColor: const Color(0xFF00FFFF));
|
|
|
|
ball = Ball(baseColor: const Color(0xFF00FFFF));
|
|
|
|
|
|
|
|
gameBloc = MockGameBloc();
|
|
|
|
|
|
|
|
whenListen(
|
|
|
|
|
|
|
|
gameBloc,
|
|
|
|
|
|
|
|
const Stream<GameState>.empty(),
|
|
|
|
|
|
|
|
initialState: const GameState.initial(),
|
|
|
|
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final flameBlocTester = FlameBlocTester(
|
|
|
|
|
|
|
|
gameBuilder: EmptyPinballGameTest.new,
|
|
|
|
|
|
|
|
blocBuilder: () => gameBloc,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
test('can be instantiated', () {
|
|
|
|
test('can be instantiated', () {
|
|
|
|
expect(
|
|
|
|
expect(
|
|
|
|
BonusBallController(ball),
|
|
|
|
BonusBallController(ball),
|
|
|
@ -29,9 +41,9 @@ void main() {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
flameTester.test(
|
|
|
|
flameBlocTester.testGameWidget(
|
|
|
|
'lost removes ball',
|
|
|
|
'lost removes ball',
|
|
|
|
(game) async {
|
|
|
|
setUp: (game, tester) async {
|
|
|
|
await game.add(ball);
|
|
|
|
await game.add(ball);
|
|
|
|
final controller = BonusBallController(ball);
|
|
|
|
final controller = BonusBallController(ball);
|
|
|
|
await ball.ensureAdd(controller);
|
|
|
|
await ball.ensureAdd(controller);
|
|
|
|