|
|
@ -414,54 +414,9 @@ void main() {
|
|
|
|
|
|
|
|
|
|
|
|
game.onTapDown(tapDownEvent);
|
|
|
|
game.onTapDown(tapDownEvent);
|
|
|
|
|
|
|
|
|
|
|
|
expect(plunger.body.linearVelocity.y, equals(7));
|
|
|
|
game.update(1);
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flameTester.test('tap up releases plunger', (game) async {
|
|
|
|
|
|
|
|
final eventPosition = MockEventPosition();
|
|
|
|
|
|
|
|
when(() => eventPosition.game).thenReturn(Vector2(40, 60));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final raw = MockTapDownDetails();
|
|
|
|
|
|
|
|
when(() => raw.kind).thenReturn(PointerDeviceKind.touch);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final tapDownEvent = MockTapDownInfo();
|
|
|
|
|
|
|
|
when(() => tapDownEvent.eventPosition).thenReturn(eventPosition);
|
|
|
|
|
|
|
|
when(() => tapDownEvent.raw).thenReturn(raw);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final plunger = game.descendants().whereType<Plunger>().first;
|
|
|
|
|
|
|
|
game.onTapDown(tapDownEvent);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
expect(plunger.body.linearVelocity.y, equals(7));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final tapUpEvent = MockTapUpInfo();
|
|
|
|
|
|
|
|
when(() => tapUpEvent.eventPosition).thenReturn(eventPosition);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
game.onTapUp(tapUpEvent);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
expect(plunger.body.linearVelocity.y, equals(0));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flameTester.test('tap cancel releases plunger', (game) async {
|
|
|
|
|
|
|
|
await game.ready();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final eventPosition = MockEventPosition();
|
|
|
|
|
|
|
|
when(() => eventPosition.game).thenReturn(Vector2(40, 60));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final raw = MockTapDownDetails();
|
|
|
|
|
|
|
|
when(() => raw.kind).thenReturn(PointerDeviceKind.touch);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final tapDownEvent = MockTapDownInfo();
|
|
|
|
|
|
|
|
when(() => tapDownEvent.eventPosition).thenReturn(eventPosition);
|
|
|
|
|
|
|
|
when(() => tapDownEvent.raw).thenReturn(raw);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final plunger = game.descendants().whereType<Plunger>().first;
|
|
|
|
|
|
|
|
game.onTapDown(tapDownEvent);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
expect(plunger.body.linearVelocity.y, equals(7));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
game.onTapCancel();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
expect(plunger.body.linearVelocity.y, equals(0));
|
|
|
|
expect(plunger.body.linearVelocity.y, isPositive);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|