chore: small changes

pull/319/head
Allison Ryan 3 years ago
parent a09c4dd9d3
commit 56e03bed94

@ -19,21 +19,21 @@ class GameFlowController extends ComponentController<PinballGame>
@override @override
void onNewState(GameState state) { void onNewState(GameState state) {
if (state.isGameOver) { if (state.isGameOver) {
initialsInput(); _initialsInput();
} else { } else {
start(); start();
} }
} }
/// Puts the game in the initials input state. /// Puts the game in the initials input state.
void initialsInput() { void _initialsInput() {
// TODO(erickzanardo): implement score submission and "navigate" to the // TODO(erickzanardo): implement score submission and "navigate" to the
// next page // next page
component.descendants().whereType<Backbox>().first.initialsInput( component.descendants().whereType<Backbox>().first.initialsInput(
score: state?.score ?? 0, score: state?.score ?? 0,
characterIconPath: component.characterTheme.leaderboardIcon.keyName, characterIconPath: component.characterTheme.leaderboardIcon.keyName,
); );
component.firstChild<CameraController>()?.focusOnGameOverBackbox(); component.firstChild<CameraController>()!.focusOnGameOverBackbox();
} }
/// Puts the game in the playing state. /// Puts the game in the playing state.

@ -61,25 +61,22 @@ void main() {
}, },
); );
group('renders correctly', () {
flameTester.testGameWidget( flameTester.testGameWidget(
'empty', 'renders correctly',
setUp: (game, tester) async { setUp: (game, tester) async {
await game.images.loadAll(assets); await game.images.loadAll(assets);
game.camera.zoom = 6; game.camera.zoom = 6;
game.camera.followVector2(Vector2(0, -130)); game.camera.followVector2(Vector2(0, -130));
await game.ensureAdd(Backbox()); await game.ensureAdd(Backbox());
await game.ready();
await tester.pump(); await tester.pump();
}, },
verify: (game, tester) async { verify: (game, tester) async {
await expectLater( await expectLater(
find.byGame<EmptyPinballTestGame>(), find.byGame<EmptyPinballTestGame>(),
matchesGoldenFile('../golden/backbox/empty.png'), matchesGoldenFile('../golden/backbox.png'),
); );
}, },
); );
});
flameTester.test( flameTester.test(
'initialsInput adds InitialsInputDisplay', 'initialsInput adds InitialsInputDisplay',

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

Loading…
Cancel
Save