// ignore_for_file: cascade_invocations import 'package:flame_forge2d/flame_forge2d.dart'; import 'package:flame_test/flame_test.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pinball/game/game.dart'; import '../../helpers/helpers.dart'; void main() { TestWidgetsFlutterBinding.ensureInitialized(); final flameTester = FlameTester(Forge2DGame.new); group('BottomGroup', () { flameTester.test( 'loads correctly', (game) async { final bottomGroup = BottomGroup(position: Vector2.zero(), spacing: 0); await game.ready(); await game.ensureAdd(bottomGroup); expect(game.contains(bottomGroup), isTrue); }, ); group('children', () { flameTester.test( 'has one left flipper', (game) async { final bottomGroup = BottomGroup(position: Vector2.zero(), spacing: 0); await game.ready(); await game.ensureAdd(bottomGroup); final leftFlippers = bottomGroup.findNestedChildren( condition: (flipper) => flipper.side.isLeft, ); expect(leftFlippers.length, equals(1)); }, ); flameTester.test( 'has one right flipper', (game) async { final bottomGroup = BottomGroup(position: Vector2.zero(), spacing: 0); await game.ready(); await game.ensureAdd(bottomGroup); final leftFlippers = bottomGroup.findNestedChildren( condition: (flipper) => flipper.side.isRight, ); expect(leftFlippers.length, equals(1)); }, ); flameTester.test( 'has two Baseboards', (game) async { final bottomGroup = BottomGroup(position: Vector2.zero(), spacing: 0); await game.ready(); await game.ensureAdd(bottomGroup); final leftFlippers = bottomGroup.findNestedChildren(); expect(leftFlippers.length, equals(2)); }, ); }); }); }