|
|
@ -9,6 +9,8 @@ import 'package:flutter_test/flutter_test.dart';
|
|
|
|
import 'package:mocktail/mocktail.dart';
|
|
|
|
import 'package:mocktail/mocktail.dart';
|
|
|
|
import 'package:pinball/game/view/widgets/bonus_animation.dart';
|
|
|
|
import 'package:pinball/game/view/widgets/bonus_animation.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import '../../../helpers/helpers.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class MockImages extends Mock implements Images {}
|
|
|
|
class MockImages extends Mock implements Images {}
|
|
|
|
|
|
|
|
|
|
|
|
class MockImage extends Mock implements ui.Image {}
|
|
|
|
class MockImage extends Mock implements ui.Image {}
|
|
|
@ -20,10 +22,9 @@ void main() {
|
|
|
|
await BonusAnimation.loadAssets();
|
|
|
|
await BonusAnimation.loadAssets();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
group('loads correctly SpriteAnimationWidget for', () {
|
|
|
|
group('loads SpriteAnimationWidget correctly for', () {
|
|
|
|
testWidgets('dashNest', (tester) async {
|
|
|
|
testWidgets('dashNest', (tester) async {
|
|
|
|
await tester.runAsync(() async {
|
|
|
|
await tester.pumpApp(
|
|
|
|
await tester.pumpWidget(
|
|
|
|
|
|
|
|
MaterialApp(
|
|
|
|
MaterialApp(
|
|
|
|
home: Scaffold(
|
|
|
|
home: Scaffold(
|
|
|
|
body: BonusAnimation.dashNest(),
|
|
|
|
body: BonusAnimation.dashNest(),
|
|
|
@ -34,11 +35,9 @@ void main() {
|
|
|
|
|
|
|
|
|
|
|
|
expect(find.byType(SpriteAnimationWidget), findsOneWidget);
|
|
|
|
expect(find.byType(SpriteAnimationWidget), findsOneWidget);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
testWidgets('dino', (tester) async {
|
|
|
|
testWidgets('dino', (tester) async {
|
|
|
|
await tester.runAsync(() async {
|
|
|
|
await tester.pumpApp(
|
|
|
|
await tester.pumpWidget(
|
|
|
|
|
|
|
|
MaterialApp(
|
|
|
|
MaterialApp(
|
|
|
|
home: Scaffold(
|
|
|
|
home: Scaffold(
|
|
|
|
body: BonusAnimation.dino(),
|
|
|
|
body: BonusAnimation.dino(),
|
|
|
@ -49,11 +48,9 @@ void main() {
|
|
|
|
|
|
|
|
|
|
|
|
expect(find.byType(SpriteAnimationWidget), findsOneWidget);
|
|
|
|
expect(find.byType(SpriteAnimationWidget), findsOneWidget);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
testWidgets('sparkyTurboCharge', (tester) async {
|
|
|
|
testWidgets('sparkyTurboCharge', (tester) async {
|
|
|
|
await tester.runAsync(() async {
|
|
|
|
await tester.pumpApp(
|
|
|
|
await tester.pumpWidget(
|
|
|
|
|
|
|
|
MaterialApp(
|
|
|
|
MaterialApp(
|
|
|
|
home: Scaffold(
|
|
|
|
home: Scaffold(
|
|
|
|
body: BonusAnimation.sparkyTurboCharge(),
|
|
|
|
body: BonusAnimation.sparkyTurboCharge(),
|
|
|
@ -65,11 +62,10 @@ void main() {
|
|
|
|
expect(find.byType(SpriteAnimationWidget), findsOneWidget);
|
|
|
|
expect(find.byType(SpriteAnimationWidget), findsOneWidget);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO(arturplaczek): refactor this test when there is
|
|
|
|
// TODO(arturplaczek): refactor this test when there is a new version of the
|
|
|
|
// a new version of the flame with
|
|
|
|
// flame with an onComplete callback in SpriteAnimationWidget
|
|
|
|
// an onComplete callback in SpriteAnimationWidget
|
|
|
|
// https://github.com/flame-engine/flame/issues/1543
|
|
|
|
testWidgets('called onCompleted callback at the end of animation ',
|
|
|
|
testWidgets('called onCompleted callback at the end of animation ',
|
|
|
|
(tester) async {
|
|
|
|
(tester) async {
|
|
|
|
final completer = Completer<void>();
|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