|
|
|
@ -1,4 +1,9 @@
|
|
|
|
|
// ignore_for_file: cascade_invocations
|
|
|
|
|
|
|
|
|
|
import 'package:flame/game.dart';
|
|
|
|
|
import 'package:flame_forge2d/flame_forge2d.dart';
|
|
|
|
|
import 'package:flame_test/flame_test.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
|
import 'package:mocktail/mocktail.dart';
|
|
|
|
|
import 'package:pinball_components/pinball_components.dart';
|
|
|
|
@ -34,6 +39,25 @@ void main() {
|
|
|
|
|
hole = MockSpaceshipHole();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
group('Spaceship', () {
|
|
|
|
|
testWidgets('renders correctly', (tester) async {
|
|
|
|
|
final game = TestGame();
|
|
|
|
|
|
|
|
|
|
await tester.runAsync(() async {
|
|
|
|
|
await tester.pumpWidget(GameWidget(game: game));
|
|
|
|
|
await game.ready();
|
|
|
|
|
await game.addFromBlueprint(Spaceship(position: Vector2(30, -30)));
|
|
|
|
|
await game.ready();
|
|
|
|
|
await tester.pump();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
await expectLater(
|
|
|
|
|
find.byWidgetPredicate((w) => w is GameWidget<Forge2DGame>).first,
|
|
|
|
|
matchesGoldenFile('golden/spaceship.png'),
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
group('SpaceshipEntranceBallContactCallback', () {
|
|
|
|
|
test('changes the ball priority on contact', () {
|
|
|
|
|
SpaceshipEntranceBallContactCallback().begin(
|
|
|
|
|