diff --git a/packages/pinball_components/lib/src/components/spaceship_ramp/spaceship_ramp.dart b/packages/pinball_components/lib/src/components/spaceship_ramp/spaceship_ramp.dart index 3e4c5d6e..5bf6418c 100644 --- a/packages/pinball_components/lib/src/components/spaceship_ramp/spaceship_ramp.dart +++ b/packages/pinball_components/lib/src/components/spaceship_ramp/spaceship_ramp.dart @@ -53,7 +53,17 @@ class SpaceshipRamp extends Component { /// /// This can be used for testing [SpaceshipRamp]'s behaviors in isolation. @visibleForTesting - SpaceshipRamp.test() : super(); + SpaceshipRamp.test({ + required SpaceshipRampCubit bloc, + Iterable? children, + }) : super( + children: [ + FlameBlocProvider( + create: () => bloc, + children: [...?children], + ), + ], + ); } class _SpaceshipRampBackground extends BodyComponent diff --git a/packages/pinball_components/test/src/components/spaceship_ramp/failures/active1_isolatedDiff.png b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active1_isolatedDiff.png new file mode 100644 index 00000000..9336b99e Binary files /dev/null and b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active1_isolatedDiff.png differ diff --git a/packages/pinball_components/test/src/components/spaceship_ramp/failures/active1_maskedDiff.png b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active1_maskedDiff.png new file mode 100644 index 00000000..cab2c9ba Binary files /dev/null and b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active1_maskedDiff.png differ diff --git a/packages/pinball_components/test/src/components/spaceship_ramp/failures/active1_masterImage.png b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active1_masterImage.png new file mode 100644 index 00000000..1342e4a9 Binary files /dev/null and b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active1_masterImage.png differ diff --git a/packages/pinball_components/test/src/components/spaceship_ramp/failures/active1_testImage.png b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active1_testImage.png new file mode 100644 index 00000000..e403c805 Binary files /dev/null and b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active1_testImage.png differ diff --git a/packages/pinball_components/test/src/components/spaceship_ramp/failures/active2_isolatedDiff.png b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active2_isolatedDiff.png new file mode 100644 index 00000000..9336b99e Binary files /dev/null and b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active2_isolatedDiff.png differ diff --git a/packages/pinball_components/test/src/components/spaceship_ramp/failures/active2_maskedDiff.png b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active2_maskedDiff.png new file mode 100644 index 00000000..cab2c9ba Binary files /dev/null and b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active2_maskedDiff.png differ diff --git a/packages/pinball_components/test/src/components/spaceship_ramp/failures/active2_masterImage.png b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active2_masterImage.png new file mode 100644 index 00000000..daf85a54 Binary files /dev/null and b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active2_masterImage.png differ diff --git a/packages/pinball_components/test/src/components/spaceship_ramp/failures/active2_testImage.png b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active2_testImage.png new file mode 100644 index 00000000..e403c805 Binary files /dev/null and b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active2_testImage.png differ diff --git a/packages/pinball_components/test/src/components/spaceship_ramp/failures/active3_isolatedDiff.png b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active3_isolatedDiff.png new file mode 100644 index 00000000..9336b99e Binary files /dev/null and b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active3_isolatedDiff.png differ diff --git a/packages/pinball_components/test/src/components/spaceship_ramp/failures/active3_maskedDiff.png b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active3_maskedDiff.png new file mode 100644 index 00000000..cab2c9ba Binary files /dev/null and b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active3_maskedDiff.png differ diff --git a/packages/pinball_components/test/src/components/spaceship_ramp/failures/active3_masterImage.png b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active3_masterImage.png new file mode 100644 index 00000000..3d9f1998 Binary files /dev/null and b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active3_masterImage.png differ diff --git a/packages/pinball_components/test/src/components/spaceship_ramp/failures/active3_testImage.png b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active3_testImage.png new file mode 100644 index 00000000..e403c805 Binary files /dev/null and b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active3_testImage.png differ diff --git a/packages/pinball_components/test/src/components/spaceship_ramp/failures/active4_isolatedDiff.png b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active4_isolatedDiff.png new file mode 100644 index 00000000..9336b99e Binary files /dev/null and b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active4_isolatedDiff.png differ diff --git a/packages/pinball_components/test/src/components/spaceship_ramp/failures/active4_maskedDiff.png b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active4_maskedDiff.png new file mode 100644 index 00000000..cab2c9ba Binary files /dev/null and b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active4_maskedDiff.png differ diff --git a/packages/pinball_components/test/src/components/spaceship_ramp/failures/active4_masterImage.png b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active4_masterImage.png new file mode 100644 index 00000000..aa7eac8f Binary files /dev/null and b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active4_masterImage.png differ diff --git a/packages/pinball_components/test/src/components/spaceship_ramp/failures/active4_testImage.png b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active4_testImage.png new file mode 100644 index 00000000..e403c805 Binary files /dev/null and b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active4_testImage.png differ diff --git a/packages/pinball_components/test/src/components/spaceship_ramp/failures/active5_isolatedDiff.png b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active5_isolatedDiff.png new file mode 100644 index 00000000..9336b99e Binary files /dev/null and b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active5_isolatedDiff.png differ diff --git a/packages/pinball_components/test/src/components/spaceship_ramp/failures/active5_maskedDiff.png b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active5_maskedDiff.png new file mode 100644 index 00000000..cab2c9ba Binary files /dev/null and b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active5_maskedDiff.png differ diff --git a/packages/pinball_components/test/src/components/spaceship_ramp/failures/active5_masterImage.png b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active5_masterImage.png new file mode 100644 index 00000000..597b1b66 Binary files /dev/null and b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active5_masterImage.png differ diff --git a/packages/pinball_components/test/src/components/spaceship_ramp/failures/active5_testImage.png b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active5_testImage.png new file mode 100644 index 00000000..e403c805 Binary files /dev/null and b/packages/pinball_components/test/src/components/spaceship_ramp/failures/active5_testImage.png differ diff --git a/packages/pinball_components/test/src/components/spaceship_ramp/failures/inactive_isolatedDiff.png b/packages/pinball_components/test/src/components/spaceship_ramp/failures/inactive_isolatedDiff.png new file mode 100644 index 00000000..9336b99e Binary files /dev/null and b/packages/pinball_components/test/src/components/spaceship_ramp/failures/inactive_isolatedDiff.png differ diff --git a/packages/pinball_components/test/src/components/spaceship_ramp/failures/inactive_maskedDiff.png b/packages/pinball_components/test/src/components/spaceship_ramp/failures/inactive_maskedDiff.png new file mode 100644 index 00000000..cab2c9ba Binary files /dev/null and b/packages/pinball_components/test/src/components/spaceship_ramp/failures/inactive_maskedDiff.png differ diff --git a/packages/pinball_components/test/src/components/spaceship_ramp/failures/inactive_masterImage.png b/packages/pinball_components/test/src/components/spaceship_ramp/failures/inactive_masterImage.png new file mode 100644 index 00000000..edd38070 Binary files /dev/null and b/packages/pinball_components/test/src/components/spaceship_ramp/failures/inactive_masterImage.png differ diff --git a/packages/pinball_components/test/src/components/spaceship_ramp/failures/inactive_testImage.png b/packages/pinball_components/test/src/components/spaceship_ramp/failures/inactive_testImage.png new file mode 100644 index 00000000..e403c805 Binary files /dev/null and b/packages/pinball_components/test/src/components/spaceship_ramp/failures/inactive_testImage.png differ diff --git a/packages/pinball_components/test/src/components/spaceship_ramp/spaceship_ramp_test.dart b/packages/pinball_components/test/src/components/spaceship_ramp/spaceship_ramp_test.dart index 015dd5aa..c2086682 100644 --- a/packages/pinball_components/test/src/components/spaceship_ramp/spaceship_ramp_test.dart +++ b/packages/pinball_components/test/src/components/spaceship_ramp/spaceship_ramp_test.dart @@ -30,20 +30,6 @@ class _TestGame extends Forge2DGame { Assets.images.android.ramp.arrow.active5.keyName, ]); } - - Future pump( - SpaceshipRamp child, { - required SpaceshipRampCubit spaceshipRampCubit, - }) async { - await ensureAdd( - FlameBlocProvider.value( - value: spaceshipRampCubit, - children: [ - ZCanvasComponent(children: [child]), - ], - ), - ); - } } class _MockSpaceshipRampCubit extends Mock implements SpaceshipRampCubit {} @@ -82,31 +68,31 @@ void main() { streamController.stream, initialState: SpaceshipRampState.initial(), ); - final ramp = SpaceshipRamp(); - await game.pump( - ramp, - spaceshipRampCubit: bloc, - ); + final ramp = SpaceshipRamp.test(bloc: bloc); + await game.ensureAdd(ramp); expect(game.descendants(), contains(ramp)); }, ); group('loads', () { + flameTester.test('adds a FlameBlocProvider', (game) async { + final ramp = SpaceshipRamp(); + await game.ensureAdd(ramp); + expect( + ramp.children + .whereType< + FlameBlocProvider>() + .single, + isNotNull, + ); + }); + flameTester.test( 'a SpaceshipRampBoardOpening', (game) async { - final bloc = _MockSpaceshipRampCubit(); - final streamController = StreamController(); - whenListen( - bloc, - streamController.stream, - initialState: SpaceshipRampState.initial(), - ); final ramp = SpaceshipRamp(); - await game.pump( - ramp, - spaceshipRampCubit: bloc, - ); + await game.ensureAdd(ramp); + expect( game.descendants().whereType().length, equals(1), @@ -117,18 +103,9 @@ void main() { flameTester.test( 'a SpaceshipRampArrowSpriteComponent', (game) async { - final bloc = _MockSpaceshipRampCubit(); - final streamController = StreamController(); - whenListen( - bloc, - streamController.stream, - initialState: SpaceshipRampState.initial(), - ); final ramp = SpaceshipRamp(); - await game.pump( - ramp, - spaceshipRampCubit: bloc, - ); + await game.ensureAdd(ramp); + expect( game .descendants() @@ -155,11 +132,8 @@ void main() { streamController.stream, initialState: SpaceshipRampState.initial(), ); - final ramp = SpaceshipRamp(); - await game.pump( - ramp, - spaceshipRampCubit: bloc, - ); + final ramp = SpaceshipRamp.test(bloc: bloc); + await game.ensureAdd(ramp); await tester.pump(); @@ -194,11 +168,8 @@ void main() { streamController.stream, initialState: state, ); - final ramp = SpaceshipRamp(); - await game.pump( - ramp, - spaceshipRampCubit: bloc, - ); + final ramp = SpaceshipRamp.test(bloc: bloc); + await game.ensureAdd(ramp); streamController.add( state.copyWith(lightState: ArrowLightState.active1), @@ -238,11 +209,8 @@ void main() { streamController.stream, initialState: state, ); - final ramp = SpaceshipRamp(); - await game.pump( - ramp, - spaceshipRampCubit: bloc, - ); + final ramp = SpaceshipRamp.test(bloc: bloc); + await game.ensureAdd(ramp); streamController.add( state.copyWith(lightState: ArrowLightState.active2), @@ -282,11 +250,8 @@ void main() { streamController.stream, initialState: state, ); - final ramp = SpaceshipRamp(); - await game.pump( - ramp, - spaceshipRampCubit: bloc, - ); + final ramp = SpaceshipRamp.test(bloc: bloc); + await game.ensureAdd(ramp); streamController.add( state.copyWith(lightState: ArrowLightState.active3), @@ -326,11 +291,8 @@ void main() { streamController.stream, initialState: state, ); - final ramp = SpaceshipRamp(); - await game.pump( - ramp, - spaceshipRampCubit: bloc, - ); + final ramp = SpaceshipRamp.test(bloc: bloc); + await game.ensureAdd(ramp); streamController.add( state.copyWith(lightState: ArrowLightState.active4), @@ -370,11 +332,8 @@ void main() { streamController.stream, initialState: state, ); - final ramp = SpaceshipRamp(); - await game.pump( - ramp, - spaceshipRampCubit: bloc, - ); + final ramp = SpaceshipRamp.test(bloc: bloc); + await game.ensureAdd(ramp); streamController.add( state.copyWith(lightState: ArrowLightState.active5), @@ -413,12 +372,10 @@ void main() { initialState: SpaceshipRampState.initial(), ); final component = Component(); - final ramp = SpaceshipRamp(children: [component]); - await game.pump( - ramp, - spaceshipRampCubit: bloc, - ); - expect(ramp.children, contains(component)); + final ramp = SpaceshipRamp.test(bloc: bloc, children: [component]); + await game.ensureAdd(ramp); + + expect(ramp.descendants(), contains(component)); }); }); }); @@ -472,23 +429,19 @@ void main() { flameTester.test('can be loaded', (game) async { final component = SpaceshipRampBoardOpening(); - final parent = SpaceshipRamp.test(); - await game.pump( - parent, - spaceshipRampCubit: _MockSpaceshipRampCubit(), - ); + final parent = SpaceshipRamp.test(bloc: _MockSpaceshipRampCubit()); + await game.ensureAdd(parent); + await parent.ensureAdd(component); expect(parent.children, contains(component)); }); flameTester.test('adds a RampBallAscendingContactBehavior', (game) async { final component = SpaceshipRampBoardOpening(); - final ramp = SpaceshipRamp.test(); - await game.pump( - ramp, - spaceshipRampCubit: _MockSpaceshipRampCubit(), - ); - await ramp.ensureAdd(component); + final parent = SpaceshipRamp.test(bloc: _MockSpaceshipRampCubit()); + await game.ensureAdd(parent); + + await parent.ensureAdd(component); expect( component.children.whereType().length, equals(1), diff --git a/test/game/components/android_acres/behaviors/ramp_bonus_behavior_test.dart b/test/game/components/android_acres/behaviors/ramp_bonus_behavior_test.dart index 6df83e2a..6b36aa49 100644 --- a/test/game/components/android_acres/behaviors/ramp_bonus_behavior_test.dart +++ b/test/game/components/android_acres/behaviors/ramp_bonus_behavior_test.dart @@ -37,19 +37,13 @@ class _TestGame extends Forge2DGame { Future pump( SpaceshipRamp child, { - required SpaceshipRampCubit spaceshipRampCubit, required GameBloc gameBloc, }) async { await ensureAdd( FlameBlocProvider.value( value: gameBloc, children: [ - FlameBlocProvider.value( - value: spaceshipRampCubit, - children: [ - ZCanvasComponent(children: [child]), - ], - ), + ZCanvasComponent(children: [child]), ], ), ); @@ -86,14 +80,15 @@ void main() { initialState: state, ); final behavior = RampBonusBehavior(points: shotPoints); - final parent = SpaceshipRamp.test(); + final parent = SpaceshipRamp.test( + bloc: bloc, + children: [behavior], + ); await game.pump( parent, gameBloc: gameBloc, - spaceshipRampCubit: bloc, ); - await parent.ensureAdd(behavior); streamController.add(state.copyWith(hits: 10)); @@ -116,14 +111,15 @@ void main() { initialState: state, ); final behavior = RampBonusBehavior(points: shotPoints); - final parent = SpaceshipRamp.test(); + final parent = SpaceshipRamp.test( + bloc: bloc, + children: [behavior], + ); await game.pump( parent, gameBloc: gameBloc, - spaceshipRampCubit: bloc, ); - await parent.ensureAdd(behavior); streamController.add(state.copyWith(hits: 9)); diff --git a/test/game/components/android_acres/behaviors/ramp_multiplier_behavior_test.dart b/test/game/components/android_acres/behaviors/ramp_multiplier_behavior_test.dart index 7430841a..a77684bf 100644 --- a/test/game/components/android_acres/behaviors/ramp_multiplier_behavior_test.dart +++ b/test/game/components/android_acres/behaviors/ramp_multiplier_behavior_test.dart @@ -36,19 +36,13 @@ class _TestGame extends Forge2DGame { Future pump( SpaceshipRamp child, { - required SpaceshipRampCubit spaceshipRampCubit, required GameBloc gameBloc, }) async { await ensureAdd( FlameBlocProvider.value( value: gameBloc, children: [ - FlameBlocProvider.value( - value: spaceshipRampCubit, - children: [ - ZCanvasComponent(children: [child]), - ], - ), + ZCanvasComponent(children: [child]), ], ), ); @@ -94,14 +88,15 @@ void main() { when(() => gameBloc.add(any())).thenAnswer((_) async {}); final behavior = RampMultiplierBehavior(); - final parent = SpaceshipRamp.test(); + final parent = SpaceshipRamp.test( + bloc: bloc, + children: [behavior], + ); await game.pump( parent, gameBloc: gameBloc, - spaceshipRampCubit: bloc, ); - await parent.ensureAdd(behavior); streamController.add(state.copyWith(hits: 5)); @@ -130,14 +125,15 @@ void main() { ); final behavior = RampMultiplierBehavior(); - final parent = SpaceshipRamp.test(); + final parent = SpaceshipRamp.test( + bloc: bloc, + children: [behavior], + ); await game.pump( parent, gameBloc: gameBloc, - spaceshipRampCubit: bloc, ); - await parent.ensureAdd(behavior); streamController.add(state.copyWith(hits: 5)); @@ -166,14 +162,15 @@ void main() { ); final behavior = RampMultiplierBehavior(); - final parent = SpaceshipRamp.test(); + final parent = SpaceshipRamp.test( + bloc: bloc, + children: [behavior], + ); await game.pump( parent, gameBloc: gameBloc, - spaceshipRampCubit: bloc, ); - await parent.ensureAdd(behavior); streamController.add(state.copyWith(hits: 1)); diff --git a/test/game/components/android_acres/behaviors/ramp_progress_behavior_test.dart b/test/game/components/android_acres/behaviors/ramp_progress_behavior_test.dart index e728d8ee..fec9b72b 100644 --- a/test/game/components/android_acres/behaviors/ramp_progress_behavior_test.dart +++ b/test/game/components/android_acres/behaviors/ramp_progress_behavior_test.dart @@ -36,19 +36,13 @@ class _TestGame extends Forge2DGame { Future pump( SpaceshipRamp child, { - required SpaceshipRampCubit spaceshipRampCubit, required GameBloc gameBloc, }) async { await ensureAdd( FlameBlocProvider.value( value: gameBloc, children: [ - FlameBlocProvider.value( - value: spaceshipRampCubit, - children: [ - ZCanvasComponent(children: [child]), - ], - ), + ZCanvasComponent(children: [child]), ], ), ); @@ -93,14 +87,15 @@ void main() { ); final behavior = RampProgressBehavior(); - final parent = SpaceshipRamp.test(); + final parent = SpaceshipRamp.test( + bloc: bloc, + children: [behavior], + ); await game.pump( parent, gameBloc: gameBloc, - spaceshipRampCubit: bloc, ); - await parent.ensureAdd(behavior); streamController.add(state.copyWith(hits: 5)); @@ -129,14 +124,15 @@ void main() { ); final behavior = RampProgressBehavior(); - final parent = SpaceshipRamp.test(); + final parent = SpaceshipRamp.test( + bloc: bloc, + children: [behavior], + ); await game.pump( parent, gameBloc: gameBloc, - spaceshipRampCubit: bloc, ); - await parent.ensureAdd(behavior); streamController.add(state.copyWith(hits: 5)); @@ -165,14 +161,15 @@ void main() { ); final behavior = RampProgressBehavior(); - final parent = SpaceshipRamp.test(); + final parent = SpaceshipRamp.test( + bloc: bloc, + children: [behavior], + ); await game.pump( parent, gameBloc: gameBloc, - spaceshipRampCubit: bloc, ); - await parent.ensureAdd(behavior); streamController.add( state.copyWith( @@ -206,14 +203,15 @@ void main() { ); final behavior = RampProgressBehavior(); - final parent = SpaceshipRamp.test(); + final parent = SpaceshipRamp.test( + bloc: bloc, + children: [behavior], + ); await game.pump( parent, gameBloc: gameBloc, - spaceshipRampCubit: bloc, ); - await parent.ensureAdd(behavior); streamController.add( state.copyWith( @@ -247,14 +245,15 @@ void main() { ); final behavior = RampProgressBehavior(); - final parent = SpaceshipRamp.test(); + final parent = SpaceshipRamp.test( + bloc: bloc, + children: [behavior], + ); await game.pump( parent, gameBloc: gameBloc, - spaceshipRampCubit: bloc, ); - await parent.ensureAdd(behavior); streamController.add( state.copyWith( @@ -288,14 +287,15 @@ void main() { ); final behavior = RampProgressBehavior(); - final parent = SpaceshipRamp.test(); + final parent = SpaceshipRamp.test( + bloc: bloc, + children: [behavior], + ); await game.pump( parent, gameBloc: gameBloc, - spaceshipRampCubit: bloc, ); - await parent.ensureAdd(behavior); streamController.add( state.copyWith(hits: 4), diff --git a/test/game/components/android_acres/behaviors/ramp_reset_behavior_test.dart b/test/game/components/android_acres/behaviors/ramp_reset_behavior_test.dart index b5174509..80cff43a 100644 --- a/test/game/components/android_acres/behaviors/ramp_reset_behavior_test.dart +++ b/test/game/components/android_acres/behaviors/ramp_reset_behavior_test.dart @@ -36,19 +36,13 @@ class _TestGame extends Forge2DGame { Future pump( SpaceshipRamp child, { - required SpaceshipRampCubit spaceshipRampCubit, required GameBloc gameBloc, }) async { await ensureAdd( FlameBlocProvider.value( value: gameBloc, children: [ - FlameBlocProvider.value( - value: spaceshipRampCubit, - children: [ - ZCanvasComponent(children: [child]), - ], - ), + ZCanvasComponent(children: [child]), ], ), ); @@ -83,14 +77,15 @@ void main() { initialState: state, ); final behavior = RampResetBehavior(); - final parent = SpaceshipRamp.test(); + final parent = SpaceshipRamp.test( + bloc: bloc, + children: [behavior], + ); await game.pump( parent, gameBloc: gameBloc, - spaceshipRampCubit: bloc, ); - await parent.ensureAdd(behavior); streamController.add(state.copyWith(rounds: state.rounds - 1)); await game.ready(); @@ -111,14 +106,15 @@ void main() { initialState: state, ); final behavior = RampResetBehavior(); - final parent = SpaceshipRamp.test(); + final parent = SpaceshipRamp.test( + bloc: bloc, + children: [behavior], + ); await game.pump( parent, gameBloc: gameBloc, - spaceshipRampCubit: bloc, ); - await parent.ensureAdd(behavior); streamController .add(state.copyWith(roundScore: state.roundScore + 100)); diff --git a/test/game/components/android_acres/behaviors/ramp_shot_behavior_test.dart b/test/game/components/android_acres/behaviors/ramp_shot_behavior_test.dart index 3198e8c6..49a88a62 100644 --- a/test/game/components/android_acres/behaviors/ramp_shot_behavior_test.dart +++ b/test/game/components/android_acres/behaviors/ramp_shot_behavior_test.dart @@ -37,19 +37,13 @@ class _TestGame extends Forge2DGame { Future pump( SpaceshipRamp child, { - required SpaceshipRampCubit spaceshipRampCubit, required GameBloc gameBloc, }) async { await ensureAdd( FlameBlocProvider.value( value: gameBloc, children: [ - FlameBlocProvider.value( - value: spaceshipRampCubit, - children: [ - ZCanvasComponent(children: [child]), - ], - ), + ZCanvasComponent(children: [child]), ], ), ); @@ -86,14 +80,15 @@ void main() { initialState: state, ); final behavior = RampShotBehavior(points: shotPoints); - final parent = SpaceshipRamp.test(); + final parent = SpaceshipRamp.test( + bloc: bloc, + children: [behavior], + ); await game.pump( parent, gameBloc: gameBloc, - spaceshipRampCubit: bloc, ); - await parent.ensureAdd(behavior); streamController.add(state.copyWith(hits: state.hits + 1));