From 9d62ba6c01e7bee7831b0923034d55a1b58e746f Mon Sep 17 00:00:00 2001 From: alestiago Date: Wed, 4 May 2022 10:41:34 +0100 Subject: [PATCH] test: included loading BumperNoisyBehavior --- .../android_acres/android_acres_test.dart | 15 +++++++++++++++ .../flutter_forest/flutter_forest_test.dart | 17 ++++++++++++++++- test/game/components/sparky_scorch_test.dart | 15 +++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/test/game/components/android_acres/android_acres_test.dart b/test/game/components/android_acres/android_acres_test.dart index 73025551..cc0d92ea 100644 --- a/test/game/components/android_acres/android_acres_test.dart +++ b/test/game/components/android_acres/android_acres_test.dart @@ -2,6 +2,7 @@ import 'package:flame_test/flame_test.dart'; import 'package:flutter_test/flutter_test.dart'; +import 'package:pinball/game/behaviors/bumper_noisy_behavior.dart'; import 'package:pinball/game/components/android_acres/behaviors/behaviors.dart'; import 'package:pinball/game/game.dart'; import 'package:pinball_components/pinball_components.dart'; @@ -99,6 +100,20 @@ void main() { ); }, ); + + flameTester.test( + 'three AndroidBumpers with BumperNoisyBehavior', + (game) async { + await game.ensureAdd(AndroidAcres()); + final bumpers = game.descendants().whereType(); + for (final bumper in bumpers) { + expect( + bumper.firstChild(), + isNotNull, + ); + } + }, + ); }); flameTester.test('adds an AndroidSpaceshipBonusBehavior', (game) async { diff --git a/test/game/components/flutter_forest/flutter_forest_test.dart b/test/game/components/flutter_forest/flutter_forest_test.dart index 5761a9eb..365dcf64 100644 --- a/test/game/components/flutter_forest/flutter_forest_test.dart +++ b/test/game/components/flutter_forest/flutter_forest_test.dart @@ -2,6 +2,7 @@ import 'package:flame_test/flame_test.dart'; import 'package:flutter_test/flutter_test.dart'; +import 'package:pinball/game/behaviors/behaviors.dart'; import 'package:pinball/game/game.dart'; import 'package:pinball_components/pinball_components.dart'; import 'package:pinball_flame/pinball_flame.dart'; @@ -63,7 +64,7 @@ void main() { ); flameTester.test( - 'three DashNestBumper', + 'three DashNestBumper with BumperNoisyBehaviors', (game) async { final flutterForest = FlutterForest(); await game.ensureAdd(ZCanvasComponent(children: [flutterForest])); @@ -73,6 +74,20 @@ void main() { ); }, ); + + flameTester.test( + 'three DashNestBumpers with BumperNoisyBehavior', + (game) async { + await game.ensureAdd(FlutterForest()); + final bumpers = game.descendants().whereType(); + for (final bumper in bumpers) { + expect( + bumper.firstChild(), + isNotNull, + ); + } + }, + ); }); }); } diff --git a/test/game/components/sparky_scorch_test.dart b/test/game/components/sparky_scorch_test.dart index 7d9c8c77..5df250dd 100644 --- a/test/game/components/sparky_scorch_test.dart +++ b/test/game/components/sparky_scorch_test.dart @@ -4,6 +4,7 @@ import 'package:flame_forge2d/flame_forge2d.dart'; import 'package:flame_test/flame_test.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mocktail/mocktail.dart'; +import 'package:pinball/game/behaviors/behaviors.dart'; import 'package:pinball/game/game.dart'; import 'package:pinball_components/pinball_components.dart'; @@ -74,6 +75,20 @@ void main() { ); }, ); + + flameTester.test( + 'three SparkyBumpers with BumperNoisyBehavior', + (game) async { + await game.ensureAdd(SparkyScorch()); + final bumpers = game.descendants().whereType(); + for (final bumper in bumpers) { + expect( + bumper.firstChild(), + isNotNull, + ); + } + }, + ); }); });