|
|
@ -11,15 +11,15 @@ void main() {
|
|
|
|
TestWidgetsFlutterBinding.ensureInitialized();
|
|
|
|
TestWidgetsFlutterBinding.ensureInitialized();
|
|
|
|
final flameTester = FlameTester(TestGame.new);
|
|
|
|
final flameTester = FlameTester(TestGame.new);
|
|
|
|
|
|
|
|
|
|
|
|
group('SignPost', () {
|
|
|
|
group('Signpost', () {
|
|
|
|
flameTester.test(
|
|
|
|
flameTester.test(
|
|
|
|
'loads correctly',
|
|
|
|
'loads correctly',
|
|
|
|
(game) async {
|
|
|
|
(game) async {
|
|
|
|
final signPost = SignPost();
|
|
|
|
final signpost = Signpost();
|
|
|
|
await game.ready();
|
|
|
|
await game.ready();
|
|
|
|
await game.ensureAdd(signPost);
|
|
|
|
await game.ensureAdd(signpost);
|
|
|
|
|
|
|
|
|
|
|
|
expect(game.contains(signPost), isTrue);
|
|
|
|
expect(game.contains(signpost), isTrue);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
@ -27,12 +27,12 @@ void main() {
|
|
|
|
flameTester.testGameWidget(
|
|
|
|
flameTester.testGameWidget(
|
|
|
|
'inactive sprite',
|
|
|
|
'inactive sprite',
|
|
|
|
setUp: (game, tester) async {
|
|
|
|
setUp: (game, tester) async {
|
|
|
|
final signPost = SignPost();
|
|
|
|
final signpost = Signpost();
|
|
|
|
await game.ensureAdd(signPost);
|
|
|
|
await game.ensureAdd(signpost);
|
|
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
expect(
|
|
|
|
signPost.firstChild<SpriteGroupComponent>()!.current,
|
|
|
|
signpost.firstChild<SpriteGroupComponent>()!.current,
|
|
|
|
SignPostSpriteState.inactive,
|
|
|
|
SignpostSpriteState.inactive,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
game.camera.followVector2(Vector2.zero());
|
|
|
|
game.camera.followVector2(Vector2.zero());
|
|
|
@ -40,7 +40,7 @@ void main() {
|
|
|
|
verify: (game, tester) async {
|
|
|
|
verify: (game, tester) async {
|
|
|
|
await expectLater(
|
|
|
|
await expectLater(
|
|
|
|
find.byGame<TestGame>(),
|
|
|
|
find.byGame<TestGame>(),
|
|
|
|
matchesGoldenFile('golden/sign_post/inactive.png'),
|
|
|
|
matchesGoldenFile('golden/signpost/inactive.png'),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -48,13 +48,13 @@ void main() {
|
|
|
|
flameTester.testGameWidget(
|
|
|
|
flameTester.testGameWidget(
|
|
|
|
'active1 sprite',
|
|
|
|
'active1 sprite',
|
|
|
|
setUp: (game, tester) async {
|
|
|
|
setUp: (game, tester) async {
|
|
|
|
final signPost = SignPost();
|
|
|
|
final signpost = Signpost();
|
|
|
|
await game.ensureAdd(signPost);
|
|
|
|
await game.ensureAdd(signpost);
|
|
|
|
signPost.progress();
|
|
|
|
signpost.progress();
|
|
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
expect(
|
|
|
|
signPost.firstChild<SpriteGroupComponent>()!.current,
|
|
|
|
signpost.firstChild<SpriteGroupComponent>()!.current,
|
|
|
|
SignPostSpriteState.active1,
|
|
|
|
SignpostSpriteState.active1,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
game.camera.followVector2(Vector2.zero());
|
|
|
|
game.camera.followVector2(Vector2.zero());
|
|
|
@ -62,7 +62,7 @@ void main() {
|
|
|
|
verify: (game, tester) async {
|
|
|
|
verify: (game, tester) async {
|
|
|
|
await expectLater(
|
|
|
|
await expectLater(
|
|
|
|
find.byGame<TestGame>(),
|
|
|
|
find.byGame<TestGame>(),
|
|
|
|
matchesGoldenFile('golden/sign_post/active1.png'),
|
|
|
|
matchesGoldenFile('golden/signpost/active1.png'),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -70,15 +70,15 @@ void main() {
|
|
|
|
flameTester.testGameWidget(
|
|
|
|
flameTester.testGameWidget(
|
|
|
|
'active2 sprite',
|
|
|
|
'active2 sprite',
|
|
|
|
setUp: (game, tester) async {
|
|
|
|
setUp: (game, tester) async {
|
|
|
|
final signPost = SignPost();
|
|
|
|
final signpost = Signpost();
|
|
|
|
await game.ensureAdd(signPost);
|
|
|
|
await game.ensureAdd(signpost);
|
|
|
|
signPost
|
|
|
|
signpost
|
|
|
|
..progress()
|
|
|
|
..progress()
|
|
|
|
..progress();
|
|
|
|
..progress();
|
|
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
expect(
|
|
|
|
signPost.firstChild<SpriteGroupComponent>()!.current,
|
|
|
|
signpost.firstChild<SpriteGroupComponent>()!.current,
|
|
|
|
SignPostSpriteState.active2,
|
|
|
|
SignpostSpriteState.active2,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
game.camera.followVector2(Vector2.zero());
|
|
|
|
game.camera.followVector2(Vector2.zero());
|
|
|
@ -86,7 +86,7 @@ void main() {
|
|
|
|
verify: (game, tester) async {
|
|
|
|
verify: (game, tester) async {
|
|
|
|
await expectLater(
|
|
|
|
await expectLater(
|
|
|
|
find.byGame<TestGame>(),
|
|
|
|
find.byGame<TestGame>(),
|
|
|
|
matchesGoldenFile('golden/sign_post/active2.png'),
|
|
|
|
matchesGoldenFile('golden/signpost/active2.png'),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -94,16 +94,16 @@ void main() {
|
|
|
|
flameTester.testGameWidget(
|
|
|
|
flameTester.testGameWidget(
|
|
|
|
'active3 sprite',
|
|
|
|
'active3 sprite',
|
|
|
|
setUp: (game, tester) async {
|
|
|
|
setUp: (game, tester) async {
|
|
|
|
final signPost = SignPost();
|
|
|
|
final signpost = Signpost();
|
|
|
|
await game.ensureAdd(signPost);
|
|
|
|
await game.ensureAdd(signpost);
|
|
|
|
signPost
|
|
|
|
signpost
|
|
|
|
..progress()
|
|
|
|
..progress()
|
|
|
|
..progress()
|
|
|
|
..progress()
|
|
|
|
..progress();
|
|
|
|
..progress();
|
|
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
expect(
|
|
|
|
signPost.firstChild<SpriteGroupComponent>()!.current,
|
|
|
|
signpost.firstChild<SpriteGroupComponent>()!.current,
|
|
|
|
SignPostSpriteState.active3,
|
|
|
|
SignpostSpriteState.active3,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
game.camera.followVector2(Vector2.zero());
|
|
|
|
game.camera.followVector2(Vector2.zero());
|
|
|
@ -111,7 +111,7 @@ void main() {
|
|
|
|
verify: (game, tester) async {
|
|
|
|
verify: (game, tester) async {
|
|
|
|
await expectLater(
|
|
|
|
await expectLater(
|
|
|
|
find.byGame<TestGame>(),
|
|
|
|
find.byGame<TestGame>(),
|
|
|
|
matchesGoldenFile('golden/sign_post/active3.png'),
|
|
|
|
matchesGoldenFile('golden/signpost/active3.png'),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -120,21 +120,21 @@ void main() {
|
|
|
|
flameTester.test(
|
|
|
|
flameTester.test(
|
|
|
|
'progress changes correctly between four sprites',
|
|
|
|
'progress changes correctly between four sprites',
|
|
|
|
(game) async {
|
|
|
|
(game) async {
|
|
|
|
final signPost = SignPost();
|
|
|
|
final signpost = Signpost();
|
|
|
|
await game.ready();
|
|
|
|
await game.ready();
|
|
|
|
await game.ensureAdd(signPost);
|
|
|
|
await game.ensureAdd(signpost);
|
|
|
|
|
|
|
|
|
|
|
|
final spriteComponent = signPost.firstChild<SpriteGroupComponent>()!;
|
|
|
|
final spriteComponent = signpost.firstChild<SpriteGroupComponent>()!;
|
|
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < 4; i++) {
|
|
|
|
for (var i = 0; i < 4; i++) {
|
|
|
|
expect(spriteComponent.current, SignPostSpriteState.inactive);
|
|
|
|
expect(spriteComponent.current, SignpostSpriteState.inactive);
|
|
|
|
signPost.progress();
|
|
|
|
signpost.progress();
|
|
|
|
expect(spriteComponent.current, SignPostSpriteState.active1);
|
|
|
|
expect(spriteComponent.current, SignpostSpriteState.active1);
|
|
|
|
signPost.progress();
|
|
|
|
signpost.progress();
|
|
|
|
expect(spriteComponent.current, SignPostSpriteState.active2);
|
|
|
|
expect(spriteComponent.current, SignpostSpriteState.active2);
|
|
|
|
signPost.progress();
|
|
|
|
signpost.progress();
|
|
|
|
expect(spriteComponent.current, SignPostSpriteState.active3);
|
|
|
|
expect(spriteComponent.current, SignpostSpriteState.active3);
|
|
|
|
signPost.progress();
|
|
|
|
signpost.progress();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
);
|