Files
flame/packages/flame_console/test/src/pause_command_test.dart
Erick cf5358cd90 feat: Adding FlameConsole (#3329)
Adding Flame Console package.

---------

Co-authored-by: Lukas Klingsbo <me@lukas.fyi>
2024-10-24 11:10:22 -03:00

39 lines
1.0 KiB
Dart

import 'package:flame/game.dart';
import 'package:flame_console/src/commands/pause_command.dart';
import 'package:flame_test/flame_test.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
group('Pause Command', () {
testWithGame(
'pauses the game',
FlameGame.new,
(game) async {
expect(game.paused, isFalse);
final command = PauseConsoleCommand();
command.execute(game, command.parser.parse([]));
expect(game.paused, isTrue);
},
);
group('when the game is already paused', () {
testWithGame(
'returns error',
FlameGame.new,
(game) async {
game.pauseEngine();
expect(game.paused, isTrue);
final command = PauseConsoleCommand();
final result = command.execute(game, command.parser.parse([]));
expect(game.paused, isTrue);
expect(
result.$1,
'Game is already paused, use the resume command start it again',
);
},
);
});
});
}