|
|
|
@ -25,7 +25,16 @@ void main() {
|
|
|
|
|
verify: (game, tester) async {
|
|
|
|
|
await expectLater(
|
|
|
|
|
find.byGame<TestGame>(),
|
|
|
|
|
matchesGoldenFile('golden/plunger.png'),
|
|
|
|
|
matchesGoldenFile('golden/plunger/start.png'),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
final plunger = game.descendants().whereType<Plunger>().first;
|
|
|
|
|
plunger.pull();
|
|
|
|
|
game.update(1);
|
|
|
|
|
await tester.pump();
|
|
|
|
|
await expectLater(
|
|
|
|
|
find.byGame<TestGame>(),
|
|
|
|
|
matchesGoldenFile('golden/plunger/end.png'),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
@ -110,12 +119,17 @@ void main() {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
group('pull', () {
|
|
|
|
|
late Plunger plunger;
|
|
|
|
|
|
|
|
|
|
setUp(() {
|
|
|
|
|
plunger = Plunger(
|
|
|
|
|
compressionDistance: compressionDistance,
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
flameTester.test(
|
|
|
|
|
'moves downwards when pull is called',
|
|
|
|
|
(game) async {
|
|
|
|
|
final plunger = Plunger(
|
|
|
|
|
compressionDistance: compressionDistance,
|
|
|
|
|
);
|
|
|
|
|
await game.ensureAdd(plunger);
|
|
|
|
|
plunger.pull();
|
|
|
|
|
|
|
|
|
@ -123,6 +137,18 @@ void main() {
|
|
|
|
|
expect(plunger.body.linearVelocity.x, isZero);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
flameTester.test(
|
|
|
|
|
'moves downwards when pull is called '
|
|
|
|
|
'and plunger is below its starting position', (game) async {
|
|
|
|
|
await game.ensureAdd(plunger);
|
|
|
|
|
plunger.pull();
|
|
|
|
|
plunger.release();
|
|
|
|
|
plunger.pull();
|
|
|
|
|
|
|
|
|
|
expect(plunger.body.linearVelocity.y, isPositive);
|
|
|
|
|
expect(plunger.body.linearVelocity.x, isZero);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
group('release', () {
|
|
|
|
|