// ignore_for_file: cascade_invocations import 'package:flame_bloc/flame_bloc.dart'; 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 'package:pinball_components/pinball_components.dart'; class _TestGame extends Forge2DGame { @override Future onLoad() async { images.prefix = ''; await images.loadAll([ Assets.images.multiplier.x2.lit.keyName, Assets.images.multiplier.x2.dimmed.keyName, Assets.images.multiplier.x3.lit.keyName, Assets.images.multiplier.x3.dimmed.keyName, Assets.images.multiplier.x4.lit.keyName, Assets.images.multiplier.x4.dimmed.keyName, Assets.images.multiplier.x5.lit.keyName, Assets.images.multiplier.x5.dimmed.keyName, Assets.images.multiplier.x6.lit.keyName, Assets.images.multiplier.x6.dimmed.keyName, ]); } Future pump(Multipliers child) async { await ensureAdd( FlameBlocProvider.value( value: GameBloc(), children: [child], ), ); } } void main() { TestWidgetsFlutterBinding.ensureInitialized(); final flameTester = FlameTester(_TestGame.new); group('Multipliers', () { flameTester.test( 'loads correctly', (game) async { final component = Multipliers(); await game.pump(component); expect(game.descendants(), contains(component)); }, ); flameTester.test( 'loads five Multiplier', (game) async { final multipliersGroup = Multipliers(); await game.pump(multipliersGroup); expect( multipliersGroup.descendants().whereType().length, equals(5), ); }, ); }); }