summaryrefslogtreecommitdiffstats
path: root/test/jrummikub
diff options
context:
space:
mode:
Diffstat (limited to 'test/jrummikub')
-rw-r--r--test/jrummikub/control/GameControlTest.java6
-rw-r--r--test/jrummikub/control/RoundControlTest.java2
-rw-r--r--test/jrummikub/control/network/NetworkRoundControlTest.java12
-rw-r--r--test/jrummikub/control/turn/AIControlTest.java6
-rw-r--r--test/jrummikub/control/turn/TurnControlTest.java10
5 files changed, 21 insertions, 15 deletions
diff --git a/test/jrummikub/control/GameControlTest.java b/test/jrummikub/control/GameControlTest.java
index 1a9ba3b..e1af261 100644
--- a/test/jrummikub/control/GameControlTest.java
+++ b/test/jrummikub/control/GameControlTest.java
@@ -48,7 +48,10 @@ public class GameControlTest {
@Test
public void testEndOfRound() {
gameControl.startGame();
- // Manipulate first players hand, to allow player1 to win
+
+ view.startTurnEvent.emit();
+
+ // Manipulate first player's hand, to allow player1 to win
IHand playerHand = gameControl.roundControl.clonedHand;
for (Pair<Stone, Position> entry : playerHand.clone()) {
playerHand.pickUp(entry.getFirst());
@@ -61,7 +64,6 @@ public class GameControlTest {
playerHand.drop(stone3, new Position(0, 0));
// Done setting up first players hand
- view.startTurnEvent.emit();
view.playerPanel.endTurnEvent.emit();
view.startTurnEvent.emit();
view.playerPanel.endTurnEvent.emit();
diff --git a/test/jrummikub/control/RoundControlTest.java b/test/jrummikub/control/RoundControlTest.java
index 4eefe2e..edcb57f 100644
--- a/test/jrummikub/control/RoundControlTest.java
+++ b/test/jrummikub/control/RoundControlTest.java
@@ -899,12 +899,12 @@ public class RoundControlTest {
@Test
public void testRedealDisallowed() {
testRound.startRound();
+ view.startTurnEvent.emit();
Hand hand = new Hand();
hand.drop(new Stone(1, RED), new Position(0, 0));
hand.drop(new Stone(1, BLACK), new Position(0, 0));
hand.drop(new Stone(1, BLUE), new Position(0, 0));
testRound.clonedHand = hand;
- view.startTurnEvent.emit();
assertEquals(TurnMode.INSPECT_ONLY, view.playerPanel.turnMode);
for (int i = 0; i < 4; i++) {
view.playerPanel.endTurnEvent.emit();
diff --git a/test/jrummikub/control/network/NetworkRoundControlTest.java b/test/jrummikub/control/network/NetworkRoundControlTest.java
index 82f4dc7..24360c6 100644
--- a/test/jrummikub/control/network/NetworkRoundControlTest.java
+++ b/test/jrummikub/control/network/NetworkRoundControlTest.java
@@ -103,7 +103,8 @@ public class NetworkRoundControlTest {
connectionControl.turnStartEvent.emit(testRoundState);
assertFalse(connectionControl.turnEnded);
- connectionControl.turnEndEvent.emit(testRoundState.getTable());
+ connectionControl.turnEndEvent.emit(testRoundState.getActivePlayer()
+ .getHand(), testRoundState.getTable(), testRoundState.getTable());
assertSame(testRoundState.getNthPlayer(3), testRoundState.getActivePlayer());
assertFalse(connectionControl.turnStarted);
@@ -111,7 +112,8 @@ public class NetworkRoundControlTest {
connectionControl.turnStartEvent.emit(testRoundState);
assertFalse(connectionControl.turnEnded);
- connectionControl.turnEndEvent.emit(testRoundState.getTable());
+ connectionControl.turnEndEvent.emit(testRoundState.getActivePlayer()
+ .getHand(), testRoundState.getTable(), testRoundState.getTable());
assertSame(testRoundState.getNthPlayer(0), testRoundState.getActivePlayer());
assertFalse(connectionControl.turnStarted);
@@ -144,7 +146,8 @@ public class NetworkRoundControlTest {
connectionControl.turnStartEvent.emit(testRoundState);
assertFalse(connectionControl.turnEnded);
- connectionControl.turnEndEvent.emit(testRoundState.getTable());
+ connectionControl.turnEndEvent.emit(testRoundState.getActivePlayer()
+ .getHand(), testRoundState.getTable(), testRoundState.getTable());
assertSame(testRoundState.getNthPlayer(1), testRoundState.getActivePlayer());
assertFalse(connectionControl.turnStarted);
@@ -152,7 +155,8 @@ public class NetworkRoundControlTest {
connectionControl.turnStartEvent.emit(testRoundState);
assertFalse(connectionControl.turnEnded);
- connectionControl.turnEndEvent.emit(testRoundState.getTable());
+ connectionControl.turnEndEvent.emit(testRoundState.getActivePlayer()
+ .getHand(), testRoundState.getTable(), testRoundState.getTable());
assertSame(testRoundState.getNthPlayer(2), testRoundState.getActivePlayer());
assertFalse(connectionControl.turnStarted);
diff --git a/test/jrummikub/control/turn/AIControlTest.java b/test/jrummikub/control/turn/AIControlTest.java
index a8974ea..f58796e 100644
--- a/test/jrummikub/control/turn/AIControlTest.java
+++ b/test/jrummikub/control/turn/AIControlTest.java
@@ -16,7 +16,7 @@ import jrummikub.model.Stone;
import jrummikub.model.StoneColor;
import jrummikub.model.Table;
import jrummikub.util.IListener;
-import jrummikub.util.IListener1;
+import jrummikub.util.IListener3;
import jrummikub.view.MockView;
import org.junit.Before;
@@ -48,9 +48,9 @@ public class AIControlTest {
turnEnded = false;
redealt = false;
- aiControl.getEndOfTurnEvent().add(new IListener1<ITable>() {
+ aiControl.getEndOfTurnEvent().add(new IListener3<IHand, ITable, ITable>() {
@Override
- public void handle(ITable newTable) {
+ public void handle(IHand oldHand, ITable oldTable, ITable newTable) {
turnEnded = true;
}
diff --git a/test/jrummikub/control/turn/TurnControlTest.java b/test/jrummikub/control/turn/TurnControlTest.java
index 5e3e09c..98b1852 100644
--- a/test/jrummikub/control/turn/TurnControlTest.java
+++ b/test/jrummikub/control/turn/TurnControlTest.java
@@ -25,7 +25,7 @@ import jrummikub.model.StoneSet;
import jrummikub.model.Table;
import jrummikub.util.Event;
import jrummikub.util.IEvent;
-import jrummikub.util.IListener1;
+import jrummikub.util.IListener3;
import jrummikub.util.Pair;
import jrummikub.view.IView.BottomPanelType;
import jrummikub.view.MockView;
@@ -182,9 +182,9 @@ public class TurnControlTest {
eventFired = false;
mockTimer.timerRunning = true;
- testControl.getEndOfTurnEvent().add(new IListener1<ITable>() {
+ testControl.getEndOfTurnEvent().add(new IListener3<IHand, ITable, ITable>() {
@Override
- public void handle(ITable newTable) {
+ public void handle(IHand oldHand, ITable oldTable, ITable newTable) {
eventFired = true;
}
});
@@ -204,9 +204,9 @@ public class TurnControlTest {
eventFired = false;
mockTimer.timerRunning = true;
- testControl.getEndOfTurnEvent().add(new IListener1<ITable>() {
+ testControl.getEndOfTurnEvent().add(new IListener3<IHand, ITable, ITable>() {
@Override
- public void handle(ITable newTable) {
+ public void handle(IHand oldHand, ITable oldTable, ITable newTable) {
eventFired = true;
}
});