summaryrefslogtreecommitdiffstats
path: root/test/jrummikub/control
diff options
context:
space:
mode:
authorJannis Harder <harder@informatik.uni-luebeck.de>2011-05-25 17:10:43 +0200
committerJannis Harder <harder@informatik.uni-luebeck.de>2011-05-25 17:10:43 +0200
commita1c0cb89f67386738fc59426fd68737a393e1827 (patch)
tree8f0603073d4ea10919ce74840bb1d7514553bcb2 /test/jrummikub/control
parent157bd4f60635dc27d2c9baebea5589455b05f17b (diff)
downloadJRummikub-a1c0cb89f67386738fc59426fd68737a393e1827.tar
JRummikub-a1c0cb89f67386738fc59426fd68737a393e1827.zip
Added test and implementation for an inspection turn before the first
turn git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@273 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'test/jrummikub/control')
-rw-r--r--test/jrummikub/control/RoundControlTest.java70
1 files changed, 70 insertions, 0 deletions
diff --git a/test/jrummikub/control/RoundControlTest.java b/test/jrummikub/control/RoundControlTest.java
index 273a7af..9663f95 100644
--- a/test/jrummikub/control/RoundControlTest.java
+++ b/test/jrummikub/control/RoundControlTest.java
@@ -131,6 +131,10 @@ public class RoundControlTest {
@Test
public void laidOutValidTooFew() {
roundControl.startRound();
+ for (int i = 0; i < 4; i++) {
+ view.startTurnEvent.emit();
+ view.playerPanel.endTurnEvent.emit();
+ }
view.startTurnEvent.emit();
Stone blueOne = new Stone(1, BLUE);
@@ -161,6 +165,10 @@ public class RoundControlTest {
@Test
public void laidOutValidUnchanged() {
roundControl.startRound();
+ for (int i = 0; i < 4; i++) {
+ view.startTurnEvent.emit();
+ view.playerPanel.endTurnEvent.emit();
+ }
view.startTurnEvent.emit();
IHand hand = roundState.getActivePlayer().getHand();
@@ -178,6 +186,10 @@ public class RoundControlTest {
@Test
public void laidOutInvalidEnough() {
roundControl.startRound();
+ for (int i = 0; i < 4; i++) {
+ view.startTurnEvent.emit();
+ view.playerPanel.endTurnEvent.emit();
+ }
view.startTurnEvent.emit();
Stone blueOne = new Stone(1, BLUE);
@@ -222,6 +234,10 @@ public class RoundControlTest {
@Test
public void laidOutTooFewChangedTable() {
roundControl.startRound();
+ for (int i = 0; i < 4; i++) {
+ view.startTurnEvent.emit();
+ view.playerPanel.endTurnEvent.emit();
+ }
view.startTurnEvent.emit();
// Fake Turn to put stones on the table
Stone blueSeven = new Stone(7, BLUE);
@@ -289,6 +305,10 @@ public class RoundControlTest {
@Test
public void laidOutEnoughChangedTable() {
roundControl.startRound();
+ for (int i = 0; i < 4; i++) {
+ view.startTurnEvent.emit();
+ view.playerPanel.endTurnEvent.emit();
+ }
view.startTurnEvent.emit();
// Fake Turn to put stones on the table
Stone blueSeven = new Stone(7, BLUE);
@@ -359,6 +379,10 @@ public class RoundControlTest {
@Test
public void laidOutJustChangedTable() {
roundControl.startRound();
+ for (int i = 0; i < 4; i++) {
+ view.startTurnEvent.emit();
+ view.playerPanel.endTurnEvent.emit();
+ }
view.startTurnEvent.emit();
// Fake Turn to put stones on the table
Stone blueFour = new Stone(4, BLUE);
@@ -419,6 +443,10 @@ public class RoundControlTest {
@Test
public void laidOutValid() {
roundControl.startRound();
+ for (int i = 0; i < 4; i++) {
+ view.startTurnEvent.emit();
+ view.playerPanel.endTurnEvent.emit();
+ }
view.startTurnEvent.emit();
// Fake Turn to put stones on the table
Stone blueSeven = new Stone(7, BLUE);
@@ -503,6 +531,10 @@ public class RoundControlTest {
public void testTableValidHandChanged() {
testRoundState.players.get(0).setLaidOut(true);
testRound.startRound();
+ for (int i = 0; i < 4; i++) {
+ view.startTurnEvent.emit();
+ view.playerPanel.endTurnEvent.emit();
+ }
MockTable oldTable = testRoundState.table;
testTable.valid = true;
oldTable.clonedTable = testTable;
@@ -525,6 +557,10 @@ public class RoundControlTest {
@Test
public void testTableInvalidHandChanged() {
testRound.startRound();
+ for (int i = 0; i < 4; i++) {
+ view.startTurnEvent.emit();
+ view.playerPanel.endTurnEvent.emit();
+ }
MockTable oldTable = testRoundState.table;
testTable.valid = false;
oldTable.clonedTable = testTable;
@@ -549,6 +585,10 @@ public class RoundControlTest {
public void testTableValidHandUnchanged() {
testRoundState.players.get(0).setLaidOut(true);
testRound.startRound();
+ for (int i = 0; i < 4; i++) {
+ view.startTurnEvent.emit();
+ view.playerPanel.endTurnEvent.emit();
+ }
MockTable oldTable = testRoundState.table;
testTable.valid = true;
oldTable.clonedTable = testTable;
@@ -570,6 +610,10 @@ public class RoundControlTest {
public void testTableInvalidHandUnchanged() {
testRoundState.players.get(1).setLaidOut(true);
testRound.startRound();
+ for (int i = 0; i < 4; i++) {
+ view.startTurnEvent.emit();
+ view.playerPanel.endTurnEvent.emit();
+ }
MockTable oldTable = testRoundState.table;
testTable.valid = false;
oldTable.clonedTable = testTable;
@@ -598,6 +642,10 @@ public class RoundControlTest {
});
testRound.startRound();
+ for (int i = 0; i < 4; i++) {
+ view.startTurnEvent.emit();
+ view.playerPanel.endTurnEvent.emit();
+ }
MockTable oldTable = testRoundState.table;
testTable.valid = true;
oldTable.clonedTable = testTable;
@@ -731,6 +779,10 @@ public class RoundControlTest {
roundState.getGameHeap().drawStones(106 - 14 * 4 - 1);
roundControl.startRound();
+ for (int i = 0; i < 4; i++) {
+ view.startTurnEvent.emit();
+ view.playerPanel.endTurnEvent.emit();
+ }
IPlayer player1 = roundState.getActivePlayer();
@@ -839,4 +891,22 @@ public class RoundControlTest {
assertEquals(-3, (int) roundScore.getPoints().get(2));
assertEquals(-100, (int) roundScore.getPoints().get(3));
}
+
+ /** */
+ @Test
+ public void testInspectOnly() {
+ testRound.startRound();
+ for (int i = 0; i < 4; i++) {
+ view.startTurnEvent.emit();
+ assertTrue(view.tablePanel.clickEvent.listeners.isEmpty());
+ view.playerPanel.endTurnEvent.emit();
+ assertEquals(14, testRoundState.players.get(i).hand.getSize());
+ }
+ for (int i = 0; i < 4; i++) {
+ view.startTurnEvent.emit();
+ assertFalse(view.tablePanel.clickEvent.listeners.isEmpty());
+ view.playerPanel.endTurnEvent.emit();
+ assertFalse(14 == testRoundState.players.get(i).hand.getSize());
+ }
+ }
}