summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJannis Harder <harder@informatik.uni-luebeck.de>2011-05-24 01:51:51 +0200
committerJannis Harder <harder@informatik.uni-luebeck.de>2011-05-24 01:51:51 +0200
commitb20961b89dd07be5ac2ff3b7fd1132eca0944ac4 (patch)
tree32340751f5d13980c3a1e9ff2bc0d1259e84980b
parent2446671f7ab832cca5e0412ae0301b901e0b69d5 (diff)
downloadJRummikub-b20961b89dd07be5ac2ff3b7fd1132eca0944ac4.tar
JRummikub-b20961b89dd07be5ac2ff3b7fd1132eca0944ac4.zip
Test for special case round end (heap empty)
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@261 72836036-5685-4462-b002-a69064685172
-rw-r--r--test/jrummikub/control/RoundControlTest.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/jrummikub/control/RoundControlTest.java b/test/jrummikub/control/RoundControlTest.java
index b170581..9e3948c 100644
--- a/test/jrummikub/control/RoundControlTest.java
+++ b/test/jrummikub/control/RoundControlTest.java
@@ -21,6 +21,7 @@ import java.util.Set;
import jrummikub.model.GameSettings;
import jrummikub.model.Hand;
import jrummikub.model.IHand;
+import jrummikub.model.IPlayer;
import jrummikub.model.ITable;
import jrummikub.model.MockRoundState;
import jrummikub.model.MockTable;
@@ -679,4 +680,24 @@ public class RoundControlTest {
assertTrue(vanishedSets.isEmpty());
assertEquals(1, newSets.size());
}
+
+ @Test
+ public void heapIsEmpty() {
+ roundState.getGameHeap().drawStones(106 - 14 * 4 - 1);
+
+ roundControl.startRound();
+
+ IPlayer player1 = roundState.getActivePlayer();
+
+ view.startTurnEvent.emit();
+ view.playerPanel.endTurnEvent.emit(); // player 1 draws a card here
+
+ assertSame(player1, roundState.getActivePlayer());
+
+ for (int i = 0; i < 4; i++) {
+ view.startTurnEvent.emit();
+ view.playerPanel.endTurnEvent.emit();
+ }
+ assertTrue(view.displayWinPanel);
+ }
}