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 c2086682..ca2cad18 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 @@ -117,251 +117,6 @@ void main() { ); }); - group('renders correctly', () { - const goldenFilePath = '../golden/spaceship_ramp/'; - final centerForSpaceshipRamp = Vector2(-13, -55); - - flameTester.testGameWidget( - 'inactive sprite', - setUp: (game, tester) async { - await game.images.loadAll(assets); - final bloc = _MockSpaceshipRampCubit(); - final streamController = StreamController(); - whenListen( - bloc, - streamController.stream, - initialState: SpaceshipRampState.initial(), - ); - final ramp = SpaceshipRamp.test(bloc: bloc); - await game.ensureAdd(ramp); - - await tester.pump(); - - final current = ramp.children - .whereType() - .first - .current; - expect( - current, - ArrowLightState.inactive, - ); - - game.camera.followVector2(centerForSpaceshipRamp); - }, - verify: (game, tester) async { - await expectLater( - find.byGame<_TestGame>(), - matchesGoldenFile('${goldenFilePath}inactive.png'), - ); - }, - ); - - flameTester.testGameWidget( - 'active1 sprite', - setUp: (game, tester) async { - await game.images.loadAll(assets); - final bloc = _MockSpaceshipRampCubit(); - final state = SpaceshipRampState.initial(); - final streamController = StreamController(); - whenListen( - bloc, - streamController.stream, - initialState: state, - ); - final ramp = SpaceshipRamp.test(bloc: bloc); - await game.ensureAdd(ramp); - - streamController.add( - state.copyWith(lightState: ArrowLightState.active1), - ); - - await game.ready(); - await tester.pump(); - - final current = ramp.children - .whereType() - .first - .current; - expect( - current, - ArrowLightState.active1, - ); - - game.camera.followVector2(centerForSpaceshipRamp); - }, - verify: (game, tester) async { - await expectLater( - find.byGame<_TestGame>(), - matchesGoldenFile('${goldenFilePath}active1.png'), - ); - }, - ); - - flameTester.testGameWidget( - 'active2 sprite', - setUp: (game, tester) async { - await game.images.loadAll(assets); - final bloc = _MockSpaceshipRampCubit(); - final state = SpaceshipRampState.initial(); - final streamController = StreamController(); - whenListen( - bloc, - streamController.stream, - initialState: state, - ); - final ramp = SpaceshipRamp.test(bloc: bloc); - await game.ensureAdd(ramp); - - streamController.add( - state.copyWith(lightState: ArrowLightState.active2), - ); - - await game.ready(); - await tester.pump(); - - final current = ramp.children - .whereType() - .first - .current; - expect( - current, - ArrowLightState.active2, - ); - - game.camera.followVector2(centerForSpaceshipRamp); - }, - verify: (game, tester) async { - await expectLater( - find.byGame<_TestGame>(), - matchesGoldenFile('${goldenFilePath}active2.png'), - ); - }, - ); - - flameTester.testGameWidget( - 'active3 sprite', - setUp: (game, tester) async { - await game.images.loadAll(assets); - final bloc = _MockSpaceshipRampCubit(); - final state = SpaceshipRampState.initial(); - final streamController = StreamController(); - whenListen( - bloc, - streamController.stream, - initialState: state, - ); - final ramp = SpaceshipRamp.test(bloc: bloc); - await game.ensureAdd(ramp); - - streamController.add( - state.copyWith(lightState: ArrowLightState.active3), - ); - - await game.ready(); - await tester.pump(); - - final current = ramp.children - .whereType() - .first - .current; - expect( - current, - ArrowLightState.active3, - ); - - game.camera.followVector2(centerForSpaceshipRamp); - }, - verify: (game, tester) async { - await expectLater( - find.byGame<_TestGame>(), - matchesGoldenFile('${goldenFilePath}active3.png'), - ); - }, - ); - - flameTester.testGameWidget( - 'active4 sprite', - setUp: (game, tester) async { - await game.images.loadAll(assets); - final bloc = _MockSpaceshipRampCubit(); - final state = SpaceshipRampState.initial(); - final streamController = StreamController(); - whenListen( - bloc, - streamController.stream, - initialState: state, - ); - final ramp = SpaceshipRamp.test(bloc: bloc); - await game.ensureAdd(ramp); - - streamController.add( - state.copyWith(lightState: ArrowLightState.active4), - ); - - await game.ready(); - await tester.pump(); - - final current = ramp.children - .whereType() - .first - .current; - expect( - current, - ArrowLightState.active4, - ); - - game.camera.followVector2(centerForSpaceshipRamp); - }, - verify: (game, tester) async { - await expectLater( - find.byGame<_TestGame>(), - matchesGoldenFile('${goldenFilePath}active4.png'), - ); - }, - ); - - flameTester.testGameWidget( - 'active5 sprite', - setUp: (game, tester) async { - await game.images.loadAll(assets); - final bloc = _MockSpaceshipRampCubit(); - final state = SpaceshipRampState.initial(); - final streamController = StreamController(); - whenListen( - bloc, - streamController.stream, - initialState: state, - ); - final ramp = SpaceshipRamp.test(bloc: bloc); - await game.ensureAdd(ramp); - - streamController.add( - state.copyWith(lightState: ArrowLightState.active5), - ); - - await game.ready(); - await tester.pump(); - - final current = ramp.children - .whereType() - .first - .current; - expect( - current, - ArrowLightState.active5, - ); - - game.camera.followVector2(centerForSpaceshipRamp); - }, - verify: (game, tester) async { - await expectLater( - find.byGame<_TestGame>(), - matchesGoldenFile('${goldenFilePath}active5.png'), - ); - }, - ); - }); - group('adds', () { flameTester.test('new children', (game) async { final bloc = _MockSpaceshipRampCubit();