test: fixed tests for ball contact with exit rail

pull/110/head
RuiAlonso 4 years ago
parent 0e49cde657
commit aa7d11984a

@ -217,7 +217,7 @@ class SpaceshipExitRailEndBallContactCallback
@override
void begin(SpaceshipExitRailEnd exitRail, Ball ball, _) {
ball
..sendTo(1) // TODO(ruimiguel): sendTo board priority
..sendTo(exitRail.outsidePriority)
..layer = exitRail.outsideLayer;
}
}

@ -32,28 +32,30 @@ void main() {
});
group('SpaceshipExitHoleBallContactCallback', () {
test('changes the ball priority on contact', () {
setUp(() {
when(() => ball.priority).thenReturn(1);
when(() => exitRailEnd.outsideLayer).thenReturn(Layer.board);
when(() => exitRailEnd.outsidePriority).thenReturn(0);
});
test('changes the ball priority on contact', () {
SpaceshipExitRailEndBallContactCallback().begin(
exitRailEnd,
ball,
MockContact(),
);
verify(() => ball.priority = 1).called(1);
verify(() => ball.sendTo(exitRailEnd.outsidePriority)).called(1);
});
test('reorders the game children', () {
when(() => exitRailEnd.outsideLayer).thenReturn(Layer.board);
test('changes the ball layer on contact', () {
SpaceshipExitRailEndBallContactCallback().begin(
exitRailEnd,
ball,
MockContact(),
);
verify(game.reorderChildren).called(1);
verify(() => ball.layer = exitRailEnd.outsideLayer).called(1);
});
});
});

Loading…
Cancel
Save