|
|
@ -17,7 +17,7 @@ void main() {
|
|
|
|
flameTester.test(
|
|
|
|
flameTester.test(
|
|
|
|
'loads correctly',
|
|
|
|
'loads correctly',
|
|
|
|
(game) async {
|
|
|
|
(game) async {
|
|
|
|
final ball = Ball(position: Vector2.zero());
|
|
|
|
final ball = Ball()..initialPosition = Vector2.all(0);
|
|
|
|
await game.ready();
|
|
|
|
await game.ready();
|
|
|
|
await game.ensureAdd(ball);
|
|
|
|
await game.ensureAdd(ball);
|
|
|
|
|
|
|
|
|
|
|
@ -30,22 +30,18 @@ void main() {
|
|
|
|
'positions correctly',
|
|
|
|
'positions correctly',
|
|
|
|
(game) async {
|
|
|
|
(game) async {
|
|
|
|
final position = Vector2.all(10);
|
|
|
|
final position = Vector2.all(10);
|
|
|
|
final ball = Ball(position: position);
|
|
|
|
final ball = Ball()..initialPosition = position;
|
|
|
|
await game.ensureAdd(ball);
|
|
|
|
await game.ensureAdd(ball);
|
|
|
|
game.contains(ball);
|
|
|
|
game.contains(ball);
|
|
|
|
|
|
|
|
|
|
|
|
final expectedPosition = Vector2(
|
|
|
|
expect(ball.body.position, equals(position));
|
|
|
|
position.x,
|
|
|
|
|
|
|
|
position.y + ball.size.y,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(ball.body.position, equals(expectedPosition));
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
flameTester.test(
|
|
|
|
flameTester.test(
|
|
|
|
'is dynamic',
|
|
|
|
'is dynamic',
|
|
|
|
(game) async {
|
|
|
|
(game) async {
|
|
|
|
final ball = Ball(position: Vector2.zero());
|
|
|
|
final ball = Ball()..initialPosition = Vector2.all(0);
|
|
|
|
await game.ensureAdd(ball);
|
|
|
|
await game.ensureAdd(ball);
|
|
|
|
|
|
|
|
|
|
|
|
expect(ball.body.bodyType, equals(BodyType.dynamic));
|
|
|
|
expect(ball.body.bodyType, equals(BodyType.dynamic));
|
|
|
@ -57,7 +53,7 @@ void main() {
|
|
|
|
flameTester.test(
|
|
|
|
flameTester.test(
|
|
|
|
'exists',
|
|
|
|
'exists',
|
|
|
|
(game) async {
|
|
|
|
(game) async {
|
|
|
|
final ball = Ball(position: Vector2.zero());
|
|
|
|
final ball = Ball()..initialPosition = Vector2.all(0);
|
|
|
|
await game.ensureAdd(ball);
|
|
|
|
await game.ensureAdd(ball);
|
|
|
|
|
|
|
|
|
|
|
|
expect(ball.body.fixtures[0], isA<Fixture>());
|
|
|
|
expect(ball.body.fixtures[0], isA<Fixture>());
|
|
|
@ -67,7 +63,7 @@ void main() {
|
|
|
|
flameTester.test(
|
|
|
|
flameTester.test(
|
|
|
|
'is dense',
|
|
|
|
'is dense',
|
|
|
|
(game) async {
|
|
|
|
(game) async {
|
|
|
|
final ball = Ball(position: Vector2.zero());
|
|
|
|
final ball = Ball()..initialPosition = Vector2.all(0);
|
|
|
|
await game.ensureAdd(ball);
|
|
|
|
await game.ensureAdd(ball);
|
|
|
|
|
|
|
|
|
|
|
|
final fixture = ball.body.fixtures[0];
|
|
|
|
final fixture = ball.body.fixtures[0];
|
|
|
@ -78,7 +74,7 @@ void main() {
|
|
|
|
flameTester.test(
|
|
|
|
flameTester.test(
|
|
|
|
'shape is circular',
|
|
|
|
'shape is circular',
|
|
|
|
(game) async {
|
|
|
|
(game) async {
|
|
|
|
final ball = Ball(position: Vector2.zero());
|
|
|
|
final ball = Ball()..initialPosition = Vector2.all(0);
|
|
|
|
await game.ensureAdd(ball);
|
|
|
|
await game.ensureAdd(ball);
|
|
|
|
|
|
|
|
|
|
|
|
final fixture = ball.body.fixtures[0];
|
|
|
|
final fixture = ball.body.fixtures[0];
|
|
|
|