|
|
@ -1,12 +1,10 @@
|
|
|
|
// ignore_for_file: cascade_invocations
|
|
|
|
// ignore_for_file: cascade_invocations
|
|
|
|
|
|
|
|
|
|
|
|
import 'dart:ui';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:flame/components.dart';
|
|
|
|
import 'package:flame/components.dart';
|
|
|
|
import 'package:flame_test/flame_test.dart';
|
|
|
|
import 'package:flame_test/flame_test.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
import 'package:pinball_components/pinball_components.dart';
|
|
|
|
import 'package:pinball_components/pinball_components.dart';
|
|
|
|
|
|
|
|
import 'package:pinball_theme/pinball_theme.dart' as theme;
|
|
|
|
|
|
|
|
|
|
|
|
import '../../../../helpers/helpers.dart';
|
|
|
|
import '../../../../helpers/helpers.dart';
|
|
|
|
|
|
|
|
|
|
|
@ -16,9 +14,8 @@ void main() {
|
|
|
|
group(
|
|
|
|
group(
|
|
|
|
'BallTurboChargingBehavior',
|
|
|
|
'BallTurboChargingBehavior',
|
|
|
|
() {
|
|
|
|
() {
|
|
|
|
final assets = [Assets.images.ball.ball.keyName];
|
|
|
|
final asset = theme.Assets.images.dash.ball.keyName;
|
|
|
|
final flameTester = FlameTester(() => TestGame(assets));
|
|
|
|
final flameTester = FlameTester(() => TestGame([asset]));
|
|
|
|
const baseColor = Color(0xFFFFFFFF);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test('can be instantiated', () {
|
|
|
|
test('can be instantiated', () {
|
|
|
|
expect(
|
|
|
|
expect(
|
|
|
@ -28,7 +25,7 @@ void main() {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
flameTester.test('can be loaded', (game) async {
|
|
|
|
flameTester.test('can be loaded', (game) async {
|
|
|
|
final ball = Ball.test(baseColor: baseColor);
|
|
|
|
final ball = Ball.test();
|
|
|
|
final behavior = BallTurboChargingBehavior(impulse: Vector2.zero());
|
|
|
|
final behavior = BallTurboChargingBehavior(impulse: Vector2.zero());
|
|
|
|
await ball.add(behavior);
|
|
|
|
await ball.add(behavior);
|
|
|
|
await game.ensureAdd(ball);
|
|
|
|
await game.ensureAdd(ball);
|
|
|
@ -41,7 +38,7 @@ void main() {
|
|
|
|
flameTester.test(
|
|
|
|
flameTester.test(
|
|
|
|
'impulses the ball velocity when loaded',
|
|
|
|
'impulses the ball velocity when loaded',
|
|
|
|
(game) async {
|
|
|
|
(game) async {
|
|
|
|
final ball = Ball.test(baseColor: baseColor);
|
|
|
|
final ball = Ball.test();
|
|
|
|
await game.ensureAdd(ball);
|
|
|
|
await game.ensureAdd(ball);
|
|
|
|
final impulse = Vector2.all(1);
|
|
|
|
final impulse = Vector2.all(1);
|
|
|
|
final behavior = BallTurboChargingBehavior(impulse: impulse);
|
|
|
|
final behavior = BallTurboChargingBehavior(impulse: impulse);
|
|
|
@ -59,7 +56,7 @@ void main() {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
flameTester.test('adds sprite', (game) async {
|
|
|
|
flameTester.test('adds sprite', (game) async {
|
|
|
|
final ball = Ball(baseColor: baseColor);
|
|
|
|
final ball = Ball();
|
|
|
|
await game.ensureAdd(ball);
|
|
|
|
await game.ensureAdd(ball);
|
|
|
|
|
|
|
|
|
|
|
|
await ball.ensureAdd(
|
|
|
|
await ball.ensureAdd(
|
|
|
@ -73,7 +70,7 @@ void main() {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
flameTester.test('removes sprite after it finishes', (game) async {
|
|
|
|
flameTester.test('removes sprite after it finishes', (game) async {
|
|
|
|
final ball = Ball(baseColor: baseColor);
|
|
|
|
final ball = Ball();
|
|
|
|
await game.ensureAdd(ball);
|
|
|
|
await game.ensureAdd(ball);
|
|
|
|
|
|
|
|
|
|
|
|
final behavior = BallTurboChargingBehavior(impulse: Vector2.zero());
|
|
|
|
final behavior = BallTurboChargingBehavior(impulse: Vector2.zero());
|
|
|
|