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 @override
void begin(SpaceshipExitRailEnd exitRail, Ball ball, _) { void begin(SpaceshipExitRailEnd exitRail, Ball ball, _) {
ball ball
..sendTo(1) // TODO(ruimiguel): sendTo board priority ..sendTo(exitRail.outsidePriority)
..layer = exitRail.outsideLayer; ..layer = exitRail.outsideLayer;
} }
} }

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

Loading…
Cancel
Save