summaryrefslogtreecommitdiffstats
path: root/test/jrummikub/control
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2011-05-16 22:01:02 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2011-05-16 22:01:02 +0200
commit604ef91282ad234130b1d46569efd486ab6c5024 (patch)
tree53fab92b75551c8acc8979d77ffa8351f788ae90 /test/jrummikub/control
parent57227570fe6bf9eb5ecf17c32a1db1a7bbed85e3 (diff)
downloadJRummikub-604ef91282ad234130b1d46569efd486ab6c5024.tar
JRummikub-604ef91282ad234130b1d46569efd486ab6c5024.zip
Fix dealing stones for more than 2 rows
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@244 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'test/jrummikub/control')
-rw-r--r--test/jrummikub/control/RoundControlTest.java50
1 files changed, 26 insertions, 24 deletions
diff --git a/test/jrummikub/control/RoundControlTest.java b/test/jrummikub/control/RoundControlTest.java
index 3e610e3..dba3ae9 100644
--- a/test/jrummikub/control/RoundControlTest.java
+++ b/test/jrummikub/control/RoundControlTest.java
@@ -15,6 +15,8 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
+import jrummikub.model.Hand;
+import jrummikub.model.IHand;
import jrummikub.model.MockGameState;
import jrummikub.model.MockTable;
import jrummikub.model.Position;
@@ -52,11 +54,9 @@ public class RoundControlTest {
private void checkCorrectlyDealed() {
assertEquals(106 - testGameState.getPlayerCount() * 14
- - testGameState.table.getSize(), testGameState.getGameHeap()
- .getSize());
+ - testGameState.table.getSize(), testGameState.getGameHeap().getSize());
for (int i = 0; i < testGameState.getPlayerCount(); i++) {
- assertEquals(14, testGameState.getNthNextPlayer(i).getHand()
- .getSize());
+ assertEquals(14, testGameState.getNthNextPlayer(i).getHand().getSize());
}
}
@@ -91,27 +91,28 @@ public class RoundControlTest {
view.getTablePanel().rightPlayerName = null;
view.displayStartTurnPanel = false;
}
-
+
/** */
- @Test
- public void playerCameOutCorrectly(){
+ @Test
+ public void playerCameOutCorrectly() {
MockTable oldTable = new MockTable();
MockTable newTable = new MockTable();
Stone blueTen = new Stone(10, BLUE);
Stone redTen = new Stone(10, RED);
Stone blackTen = new Stone(10, BLACK);
-
+
}
/** */
@Test
- public void testDealStone() {
+ public void testDealStones() {
testRound.deal();
checkCorrectlyDealed();
- for (int i = 0; i < 28 - 14; i++) {
- testRound.dealStone();
+ for (int i = 0; i < 14; i++) {
+ testRound.dealStones(2);
}
- assertEquals(28, testGameState.getActivePlayer().getHand().getSize());
+ assertEquals(2 * 14 + 14, testGameState.getActivePlayer().getHand()
+ .getSize());
}
/** */
@@ -150,7 +151,9 @@ public class RoundControlTest {
view.startTurnEvent.emit();
assertFalse(view.displayStartTurnPanel);
- testGameState.players.get(0).hand.stones.remove(0);
+
+ IHand hand = testGameState.players.get(0).hand;
+ hand.pickUp(hand.iterator().next().getFirst());
resetTurnStart();
view.getPlayerPanel().endTurnEvent.emit();
@@ -170,8 +173,9 @@ public class RoundControlTest {
view.startTurnEvent.emit();
assertFalse(view.displayStartTurnPanel);
- Stone stone = testGameState.players.get(0).hand.stones.remove(0)
- .getFirst();
+ IHand hand = testGameState.players.get(0).hand;
+ Stone stone = hand.iterator().next().getFirst();
+ hand.pickUp(stone);
newTable.drop(new StoneSet(stone), new Position(0, 0));
resetTurnStart();
view.getPlayerPanel().endTurnEvent.emit();
@@ -232,10 +236,11 @@ public class RoundControlTest {
view.startTurnEvent.emit();
assertFalse(view.displayStartTurnPanel);
- Stone stone = testGameState.players.get(0).hand.stones.remove(0)
- .getFirst();
+ IHand hand = testGameState.players.get(0).hand;
+ Stone stone = hand.iterator().next().getFirst();
+ hand.pickUp(stone);
newTable.drop(new StoneSet(stone), new Position(0, 0));
- testGameState.players.get(0).hand.stones.clear();
+ testGameState.players.get(0).hand = new Hand();
resetTurnStart();
view.getPlayerPanel().endTurnEvent.emit();
@@ -253,15 +258,12 @@ public class RoundControlTest {
Stone blueTwo = new Stone(2, BLUE);
Stone blueThree = new Stone(3, BLUE);
Stone blueFour = new Stone(4, BLUE);
- StoneSet oldSet1 = new StoneSet(
- Arrays.asList(blueOne, redOne, blackOne));
+ StoneSet oldSet1 = new StoneSet(Arrays.asList(blueOne, redOne, blackOne));
StoneSet oldSet2 = new StoneSet(blueTwo);
oldTable.drop(oldSet1, new Position(0, 0));
oldTable.drop(oldSet2, new Position(0, 0));
- StoneSet newSet1 = new StoneSet(Arrays.asList(blueOne, blueTwo,
- blueFour));
- StoneSet newSet2 = new StoneSet(Arrays.asList(redOne, blackOne,
- blueThree));
+ StoneSet newSet1 = new StoneSet(Arrays.asList(blueOne, blueTwo, blueFour));
+ StoneSet newSet2 = new StoneSet(Arrays.asList(redOne, blackOne, blueThree));
newTable.drop(newSet1, new Position(0, 0));
newTable.drop(newSet2, new Position(0, 0));