test: same position

pull/10/head
Allison Ryan 4 years ago
parent ea3b126b62
commit 1651676462

@ -57,7 +57,7 @@ class PlungerAnchorPrismaticJointDef extends PrismaticJointDef {
required Anchor anchor, required Anchor anchor,
}) : assert( }) : assert(
anchor.body.position.y < plunger.body.position.y, anchor.body.position.y < plunger.body.position.y,
"Anchor can't be positioned above the Plunger", 'Anchor must be below the Plunger',
) { ) {
initialize( initialize(
plunger.body, plunger.body,

@ -164,6 +164,23 @@ void main() {
}, },
); );
flameTester.test(
'throws AssertionError '
'when anchor is in same position as plunger',
(game) async {
final anchor = Anchor(position: Vector2.zero());
await game.ensureAddAll([plunger, anchor]);
expect(
() => PlungerAnchorPrismaticJointDef(
plunger: plunger,
anchor: anchor,
),
throwsAssertionError,
);
},
);
group('initializes with', () { group('initializes with', () {
flameTester.test( flameTester.test(
'plunger body as bodyA', 'plunger body as bodyA',

Loading…
Cancel
Save