|
|
|
@ -96,37 +96,6 @@ void main() {
|
|
|
|
|
expect(game.descendants(), contains(behavior));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
flameTester.test(
|
|
|
|
|
"pulls while joint hasn't reached limit",
|
|
|
|
|
(game) async {
|
|
|
|
|
final plungerBloc = _MockPlungerCubit();
|
|
|
|
|
whenListen<PlungerState>(
|
|
|
|
|
plungerBloc,
|
|
|
|
|
Stream.value(PlungerState.autoPulling),
|
|
|
|
|
initialState: PlungerState.autoPulling,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const strength = 2.0;
|
|
|
|
|
final behavior = PlungerAutoPullingBehavior(
|
|
|
|
|
strength: strength,
|
|
|
|
|
);
|
|
|
|
|
await game.pump(
|
|
|
|
|
behavior,
|
|
|
|
|
plungerBloc: plungerBloc,
|
|
|
|
|
);
|
|
|
|
|
final plunger = behavior.ancestors().whereType<Plunger>().single;
|
|
|
|
|
final joint = _MockPrismaticJoint();
|
|
|
|
|
when(joint.getJointTranslation).thenReturn(2);
|
|
|
|
|
when(joint.getLowerLimit).thenReturn(0);
|
|
|
|
|
plunger.body.joints.add(joint);
|
|
|
|
|
|
|
|
|
|
game.update(0);
|
|
|
|
|
|
|
|
|
|
expect(plunger.body.linearVelocity.x, equals(0));
|
|
|
|
|
expect(plunger.body.linearVelocity.y, equals(strength));
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
flameTester.test(
|
|
|
|
|
'releases when joint reaches limit',
|
|
|
|
|
(game) async {
|
|
|
|
|