test: removed golden tests for spaceship

pull/416/head
RuiAlonso 3 years ago
parent 1d39b93bf3
commit e6803c31d7

@ -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<SpaceshipRampState>();
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<SpaceshipRampArrowSpriteComponent>()
.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<SpaceshipRampState>();
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<SpaceshipRampArrowSpriteComponent>()
.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<SpaceshipRampState>();
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<SpaceshipRampArrowSpriteComponent>()
.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<SpaceshipRampState>();
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<SpaceshipRampArrowSpriteComponent>()
.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<SpaceshipRampState>();
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<SpaceshipRampArrowSpriteComponent>()
.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<SpaceshipRampState>();
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<SpaceshipRampArrowSpriteComponent>()
.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', () { group('adds', () {
flameTester.test('new children', (game) async { flameTester.test('new children', (game) async {
final bloc = _MockSpaceshipRampCubit(); final bloc = _MockSpaceshipRampCubit();

Loading…
Cancel
Save