test: coverage first resize

fix/handling-game-resizing
alestiago 3 years ago
parent e2a82255b8
commit 11544810c3

@ -34,6 +34,19 @@ void main() {
expect(game.descendants(), contains(behavior)); expect(game.descendants(), contains(behavior));
}); });
flameTester.test('resizes and snaps', (game) async {
final behavior = CameraFocusingBehavior();
await game.ensureAdd(
FlameBlocProvider<GameBloc, GameState>.value(
value: GameBloc(),
children: [behavior],
),
);
behavior.onGameResize(Vector2.all(10));
expect(game.camera.zoom, greaterThan(0));
});
flameTester.test( flameTester.test(
'changes focus when loaded', 'changes focus when loaded',
(game) async { (game) async {
@ -110,7 +123,7 @@ void main() {
flameTester.test( flameTester.test(
'zooms when game is over', 'zooms when game is over',
(game) async { (game) async {
final playing = const GameState.initial().copyWith( final gameOver = const GameState.initial().copyWith(
status: GameStatus.gameOver, status: GameStatus.gameOver,
); );
@ -122,7 +135,7 @@ void main() {
), ),
); );
behavior.onNewState(playing); behavior.onNewState(gameOver);
final previousPosition = game.camera.position.clone(); final previousPosition = game.camera.position.clone();
await game.ready(); await game.ready();

Loading…
Cancel
Save