diff options
author | Jannis Harder <harder@informatik.uni-luebeck.de> | 2011-05-24 22:16:16 +0200 |
---|---|---|
committer | Jannis Harder <harder@informatik.uni-luebeck.de> | 2011-05-24 22:16:16 +0200 |
commit | 81ca3e174a7d69bd063b80d3512438fd3a89a077 (patch) | |
tree | 40a0c845e920a0d93c86329dbd2b00f8f8b9c925 /test | |
parent | 8c3c66f361934e521ef7d00e9464cfc51875badc (diff) | |
download | JRummikub-81ca3e174a7d69bd063b80d3512438fd3a89a077.tar JRummikub-81ca3e174a7d69bd063b80d3512438fd3a89a077.zip |
Renamed win() and fixed end of round tests
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@267 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'test')
-rw-r--r-- | test/jrummikub/control/RoundControlTest.java | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/test/jrummikub/control/RoundControlTest.java b/test/jrummikub/control/RoundControlTest.java index 2d316d8..e4e8b07 100644 --- a/test/jrummikub/control/RoundControlTest.java +++ b/test/jrummikub/control/RoundControlTest.java @@ -32,6 +32,7 @@ import jrummikub.model.RoundState; import jrummikub.model.Stone; import jrummikub.model.StoneSet; import jrummikub.model.Table; +import jrummikub.util.IListener; import jrummikub.util.Pair; import jrummikub.view.MockView; @@ -50,6 +51,8 @@ public class RoundControlTest { private GameSettings gameSettings; private IRoundState roundState; private RoundControl roundControl; + + private boolean roundEnded; /** * For each test create a round control initialized by a mock model and view @@ -64,6 +67,7 @@ public class RoundControlTest { testTable = new MockTable(); testTable.sets.add(testRoundState.table.sets.get(0)); testRoundState.table.clonedTable = testTable; + roundEnded = false; gameSettings = new GameSettings(); @@ -566,6 +570,14 @@ public class RoundControlTest { /** */ @Test public void testWinning() { + + testRound.getEndOfRoundEvent().add(new IListener() { + @Override + public void handle() { + roundEnded = true; + } + }); + testRound.startRound(); MockTable oldTable = testRoundState.table; testTable.valid = true; @@ -594,9 +606,10 @@ public class RoundControlTest { testRoundState.players.get(0).hand = new Hand(gameSettings); resetTurnStart(); - view.playerPanel.endTurnEvent.emit(); - assertTrue(view.displayWinPanel); + assertFalse(roundEnded); + view.playerPanel.endTurnEvent.emit(); + assertTrue(roundEnded); } /** */ @@ -687,6 +700,13 @@ public class RoundControlTest { /** */ @Test public void heapIsEmpty() { + roundControl.getEndOfRoundEvent().add(new IListener() { + @Override + public void handle() { + roundEnded = true; + } + }); + roundState.getGameHeap().drawStones(106 - 14 * 4 - 1); roundControl.startRound(); @@ -702,6 +722,6 @@ public class RoundControlTest { view.startTurnEvent.emit(); view.playerPanel.endTurnEvent.emit(); } - assertTrue(view.displayWinPanel); + assertTrue(roundEnded); } } |