Fixes Android Bumper tests

pull/505/head
Alvaro Almeida Freire Stivi 1 year ago
parent 19b0751a72
commit cf3b00c7d4
No known key found for this signature in database

@ -29,8 +29,10 @@ void main() {
flameTester.testGameWidget( flameTester.testGameWidget(
'"a" loads correctly', '"a" loads correctly',
setUp: (game, _) async { setUp: (game, _) async {
await game.onLoad();
final androidBumper = AndroidBumper.a(); final androidBumper = AndroidBumper.a();
await game.ensureAdd(androidBumper); await game.ensureAdd(androidBumper);
await game.ready();
}, },
verify: (game, _) async { verify: (game, _) async {
expect(game.descendants().whereType<AndroidBumper>(), isNotEmpty); expect(game.descendants().whereType<AndroidBumper>(), isNotEmpty);
@ -40,8 +42,10 @@ void main() {
flameTester.testGameWidget( flameTester.testGameWidget(
'"b" loads correctly', '"b" loads correctly',
setUp: (game, _) async { setUp: (game, _) async {
await game.onLoad();
final androidBumper = AndroidBumper.b(); final androidBumper = AndroidBumper.b();
await game.ensureAdd(androidBumper); await game.ensureAdd(androidBumper);
await game.ready();
}, },
verify: (game, _) async { verify: (game, _) async {
expect(game.descendants().whereType<AndroidBumper>(), isNotEmpty); expect(game.descendants().whereType<AndroidBumper>(), isNotEmpty);
@ -51,8 +55,10 @@ void main() {
flameTester.testGameWidget( flameTester.testGameWidget(
'"cow" loads correctly', '"cow" loads correctly',
setUp: (game, _) async { setUp: (game, _) async {
await game.onLoad();
final androidBumper = AndroidBumper.cow(); final androidBumper = AndroidBumper.cow();
await game.ensureAdd(androidBumper); await game.ensureAdd(androidBumper);
await game.ready();
}, },
verify: (game, _) async { verify: (game, _) async {
expect(game.descendants().whereType<AndroidBumper>(), isNotEmpty); expect(game.descendants().whereType<AndroidBumper>(), isNotEmpty);
@ -62,6 +68,7 @@ void main() {
flameTester.testGameWidget( flameTester.testGameWidget(
'closes bloc when removed', 'closes bloc when removed',
setUp: (game, _) async { setUp: (game, _) async {
await game.onLoad();
final bloc = _MockAndroidBumperCubit(); final bloc = _MockAndroidBumperCubit();
whenListen( whenListen(
bloc, bloc,
@ -89,8 +96,10 @@ void main() {
flameTester.testGameWidget( flameTester.testGameWidget(
'an AndroidBumperBallContactBehavior', 'an AndroidBumperBallContactBehavior',
setUp: (game, _) async { setUp: (game, _) async {
await game.onLoad();
final androidBumper = AndroidBumper.a(); final androidBumper = AndroidBumper.a();
await game.ensureAdd(androidBumper); await game.ensureAdd(androidBumper);
await game.ready();
}, },
verify: (game, _) async { verify: (game, _) async {
final androidBumper = final androidBumper =
@ -106,8 +115,10 @@ void main() {
flameTester.testGameWidget( flameTester.testGameWidget(
'an AndroidBumperBlinkingBehavior', 'an AndroidBumperBlinkingBehavior',
setUp: (game, _) async { setUp: (game, _) async {
await game.onLoad();
final androidBumper = AndroidBumper.a(); final androidBumper = AndroidBumper.a();
await game.ensureAdd(androidBumper); await game.ensureAdd(androidBumper);
await game.ready();
}, },
verify: (game, _) async { verify: (game, _) async {
final androidBumper = final androidBumper =
@ -126,6 +137,7 @@ void main() {
flameTester.testGameWidget( flameTester.testGameWidget(
'new children', 'new children',
setUp: (game, _) async { setUp: (game, _) async {
await game.onLoad();
final component = Component(); final component = Component();
final androidBumper = AndroidBumper.a( final androidBumper = AndroidBumper.a(
children: [component], children: [component],
@ -143,8 +155,10 @@ void main() {
flameTester.testGameWidget( flameTester.testGameWidget(
'a BumpingBehavior', 'a BumpingBehavior',
setUp: (game, _) async { setUp: (game, _) async {
await game.onLoad();
final androidBumper = AndroidBumper.a(); final androidBumper = AndroidBumper.a();
await game.ensureAdd(androidBumper); await game.ensureAdd(androidBumper);
await game.ready();
}, },
verify: (game, _) async { verify: (game, _) async {
final androidBumper = final androidBumper =
@ -161,11 +175,13 @@ void main() {
flameTester.testGameWidget( flameTester.testGameWidget(
'new children', 'new children',
setUp: (game, _) async { setUp: (game, _) async {
await game.onLoad();
final component = Component(); final component = Component();
final androidBumper = AndroidBumper.b( final androidBumper = AndroidBumper.b(
children: [component], children: [component],
); );
await game.ensureAdd(androidBumper); await game.ensureAdd(androidBumper);
await game.ready();
}, },
verify: (game, _) async { verify: (game, _) async {
final androidBumper = final androidBumper =
@ -177,8 +193,10 @@ void main() {
flameTester.testGameWidget( flameTester.testGameWidget(
'a BumpingBehavior', 'a BumpingBehavior',
setUp: (game, _) async { setUp: (game, _) async {
await game.onLoad();
final androidBumper = AndroidBumper.b(); final androidBumper = AndroidBumper.b();
await game.ensureAdd(androidBumper); await game.ensureAdd(androidBumper);
await game.ready();
}, },
verify: (game, _) async { verify: (game, _) async {
final androidBumper = final androidBumper =
@ -195,11 +213,13 @@ void main() {
flameTester.testGameWidget( flameTester.testGameWidget(
'new children', 'new children',
setUp: (game, _) async { setUp: (game, _) async {
await game.onLoad();
final component = Component(); final component = Component();
final androidBumper = AndroidBumper.cow( final androidBumper = AndroidBumper.cow(
children: [component], children: [component],
); );
await game.ensureAdd(androidBumper); await game.ensureAdd(androidBumper);
await game.ready();
}, },
verify: (game, _) async { verify: (game, _) async {
final androidBumper = final androidBumper =
@ -211,8 +231,10 @@ void main() {
flameTester.testGameWidget( flameTester.testGameWidget(
'a BumpingBehavior', 'a BumpingBehavior',
setUp: (game, _) async { setUp: (game, _) async {
await game.onLoad();
final androidBumper = AndroidBumper.cow(); final androidBumper = AndroidBumper.cow();
await game.ensureAdd(androidBumper); await game.ensureAdd(androidBumper);
await game.ready();
}, },
verify: (game, _) async { verify: (game, _) async {
final androidBumper = final androidBumper =

Loading…
Cancel
Save