Files
flame/packages/flame_test/example/test/flame_test_test.dart
Lukas Klingsbo 7c2f400076 feat!: Add CameraComponent to FlameGame (#2740)
This PR adds the `CameraComponent` and a `World` by default to the
FlameGame.
2023-09-18 21:06:37 +02:00

42 lines
946 B
Dart

import 'package:flame_test/flame_test.dart';
import 'package:flame_test_example/game.dart';
import 'package:flutter_test/flutter_test.dart';
final myGame = FlameTester(MyGame.new);
void main() {
group('flameTest', () {
TestWidgetsFlutterBinding.ensureInitialized();
testWithGame<MyGame>(
'can load the game',
MyGame.new,
(game) async {
expect(game.world.children.length, 1);
},
);
myGame.testGameWidget(
'render the game widget',
verify: (game, tester) async {
expect(
find.byGame<MyGame>(),
findsOneWidget,
);
},
);
myGame.testGameWidget(
'render the background correctly',
setUp: (game, _) async {
await game.ready();
},
verify: (game, tester) async {
await expectLater(
find.byGame<MyGame>(),
matchesGoldenFile('goldens/game.png'),
);
},
);
});
}