feat: included different shapes test

pull/39/head
alestiago 4 years ago
parent 90df786596
commit 4935bbcea4

@ -1,5 +1,7 @@
// ignore_for_file: cascade_invocations // ignore_for_file: cascade_invocations
import 'dart:math';
import 'package:flame_forge2d/flame_forge2d.dart'; import 'package:flame_forge2d/flame_forge2d.dart';
import 'package:flame_test/flame_test.dart'; import 'package:flame_test/flame_test.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
@ -82,6 +84,31 @@ void main() {
}, },
); );
flameTester.test(
'triangular shapes are different '
'when side is left or right',
(game) async {
final leftSlingShot = SlingShot(
position: Vector2.zero(),
side: BoardSide.left,
);
final rightSlingShot = SlingShot(
position: Vector2.zero(),
side: BoardSide.right,
);
await game.ensureAdd(leftSlingShot);
await game.ensureAdd(rightSlingShot);
final rightShape =
rightSlingShot.body.fixtures[0].shape as PolygonShape;
final leftShape =
leftSlingShot.body.fixtures[0].shape as PolygonShape;
expect(rightShape.vertices, isNot(equals(leftShape.vertices)));
},
);
flameTester.test( flameTester.test(
'has no friction', 'has no friction',
(game) async { (game) async {

Loading…
Cancel
Save