summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2011-05-31 18:25:47 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2011-05-31 18:25:47 +0200
commitbc04d21afb9534e3f0aed53045ecc3a30a37bf81 (patch)
tree838c53802638fa06b9ddb9d73a34535abf597da5
parent03b3bf23401c480602162c0e3f45626e5d9f2e0e (diff)
downloadJRummikub-bc04d21afb9534e3f0aed53045ecc3a30a37bf81.tar
JRummikub-bc04d21afb9534e3f0aed53045ecc3a30a37bf81.zip
View: Refactor bottom panel display
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@354 72836036-5685-4462-b002-a69064685172
-rw-r--r--mock/jrummikub/view/MockView.java27
-rw-r--r--src/jrummikub/control/ApplicationControl.java5
-rw-r--r--src/jrummikub/control/GameControl.java3
-rw-r--r--src/jrummikub/control/RoundControl.java14
-rw-r--r--src/jrummikub/control/turn/HumanTurnControl.java3
-rw-r--r--src/jrummikub/view/IView.java55
-rw-r--r--src/jrummikub/view/impl/View.java45
-rw-r--r--test/jrummikub/control/GameControlTest.java14
-rw-r--r--test/jrummikub/control/RoundControlTest.java124
-rw-r--r--test/jrummikub/control/turn/TurnControlTest.java14
10 files changed, 120 insertions, 184 deletions
diff --git a/mock/jrummikub/view/MockView.java b/mock/jrummikub/view/MockView.java
index ccc446f..09f3254 100644
--- a/mock/jrummikub/view/MockView.java
+++ b/mock/jrummikub/view/MockView.java
@@ -28,9 +28,7 @@ public class MockView implements IView {
/** */
public String currentPlayerName;
/** */
- public boolean displayStartTurnPanel = false;
- /** */
- public boolean displayWinPanel = false;
+ public BottomPanelType bottomPanelType;
/** */
public MockEvent startTurnEvent = new MockEvent();
@@ -68,21 +66,11 @@ public class MockView implements IView {
}
@Override
- public void enableStartTurnPanel(boolean enable) {
- displayStartTurnPanel = enable;
- }
-
- @Override
public IEvent getStartTurnEvent() {
return startTurnEvent;
}
@Override
- public void enableWinPanel(boolean enable) {
- displayWinPanel = enable;
- }
-
- @Override
public IEvent getEndProgramEvent() {
return quitEvent;
}
@@ -121,7 +109,7 @@ public class MockView implements IView {
}
@Override
- public void setHasLaidOut(boolean hasLaidOut) {
+ public void setCurrentPlayerHasLaidOut(boolean hasLaidOut) {
// TODO Auto-generated method stub
}
@@ -132,15 +120,8 @@ public class MockView implements IView {
}
@Override
- public void showInterface(boolean enable) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void enableThinkPanel(boolean b) {
- // TODO Auto-generated method stub
-
+ public void setBottomPanel(BottomPanelType type) {
+ bottomPanelType = type;
}
}
diff --git a/src/jrummikub/control/ApplicationControl.java b/src/jrummikub/control/ApplicationControl.java
index bcaf437..cf9a8ca 100644
--- a/src/jrummikub/control/ApplicationControl.java
+++ b/src/jrummikub/control/ApplicationControl.java
@@ -4,6 +4,7 @@ import jrummikub.model.GameSettings;
import jrummikub.util.IListener;
import jrummikub.util.IListener1;
import jrummikub.view.IView;
+import jrummikub.view.IView.BottomPanelType;
/**
* The application control controls the settings for a new games and create the
@@ -27,8 +28,7 @@ public class ApplicationControl {
*/
public void startApplication() {
view.showScorePanel(false);
- view.enableWinPanel(false);
- view.showInterface(false);
+ view.setBottomPanel(BottomPanelType.START_GAME_PANEL);
SettingsControl settingsControl = new SettingsControl(view,
new GameSettings());
settingsControl.getStartGameEvent().add(new IListener1<GameSettings>() {
@@ -42,7 +42,6 @@ public class ApplicationControl {
startApplication();
}
});
- view.showInterface(true);
gameControl.startGame();
}
diff --git a/src/jrummikub/control/GameControl.java b/src/jrummikub/control/GameControl.java
index 9eb9fa6..247e67a 100644
--- a/src/jrummikub/control/GameControl.java
+++ b/src/jrummikub/control/GameControl.java
@@ -14,6 +14,7 @@ import jrummikub.util.IEvent;
import jrummikub.util.IListener;
import jrummikub.util.IListener1;
import jrummikub.view.IView;
+import jrummikub.view.IView.BottomPanelType;
/**
* Controls a Game, at some point including all Rounds, starts new Rounds
@@ -128,7 +129,7 @@ public class GameControl {
gameState.getScores().add(roundScore);
roundControl = null;
- view.enableWinPanel(true);
+ view.setBottomPanel(BottomPanelType.WIN_PANEL);
view.getScorePanel().setPlayers(gameSettings.getPlayerList());
view.getScorePanel().setScores(gameState.getScores());
diff --git a/src/jrummikub/control/RoundControl.java b/src/jrummikub/control/RoundControl.java
index 40894eb..86f8e05 100644
--- a/src/jrummikub/control/RoundControl.java
+++ b/src/jrummikub/control/RoundControl.java
@@ -1,5 +1,7 @@
package jrummikub.control;
+import static jrummikub.control.turn.TurnControlFactory.Type.*;
+
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@@ -7,7 +9,6 @@ import java.util.Set;
import jrummikub.control.turn.ITurnControl;
import jrummikub.control.turn.TurnControlFactory;
-import static jrummikub.control.turn.TurnControlFactory.Type.*;
import jrummikub.model.Hand;
import jrummikub.model.IHand;
import jrummikub.model.IPlayer;
@@ -25,6 +26,7 @@ import jrummikub.util.IEvent1;
import jrummikub.util.IListener;
import jrummikub.util.Pair;
import jrummikub.view.IView;
+import jrummikub.view.IView.BottomPanelType;
/**
* Controller that manages a single round of rummikub
@@ -82,18 +84,15 @@ public class RoundControl {
.getTurnControlType() == HUMAN;
clonedTable = (ITable) roundState.getTable().clone();
- if (isHuman) {
- view.enableStartTurnPanel(true);
- } else {
- view.enableThinkPanel(true);
- }
+ view.setBottomPanel(isHuman ? BottomPanelType.START_TURN_PANEL
+ : BottomPanelType.COMPUTER_HAND_PANEL);
view.getTablePanel().setStoneSets(clonedTable.clone());
view.setCurrentPlayerName(roundState.getActivePlayer().getPlayerSettings()
.getName());
view.setCurrentPlayerColor(roundState.getActivePlayer().getPlayerSettings()
.getColor());
- view.setHasLaidOut(roundState.getActivePlayer().getLaidOut());
+ view.setCurrentPlayerHasLaidOut(roundState.getActivePlayer().getLaidOut());
if (!isHuman)
startTurn();
@@ -156,7 +155,6 @@ public class RoundControl {
}
private void endOfTurn() {
- view.enableThinkPanel(false);
turnControl = null;
if (roundState.getTurnNumber() >= 1) {
checkTurn();
diff --git a/src/jrummikub/control/turn/HumanTurnControl.java b/src/jrummikub/control/turn/HumanTurnControl.java
index c49d7ce..d7f7721 100644
--- a/src/jrummikub/control/turn/HumanTurnControl.java
+++ b/src/jrummikub/control/turn/HumanTurnControl.java
@@ -18,6 +18,7 @@ import jrummikub.util.IListener;
import jrummikub.util.IListener1;
import jrummikub.util.IListener2;
import jrummikub.util.Pair;
+import jrummikub.view.IView.BottomPanelType;
/**
* Controller for a single turn made by a human player
@@ -87,7 +88,7 @@ public class HumanTurnControl extends AbstractTurnControl {
view.getHandPanel().setStones(hand.clone());
view.getHandPanel().resetCurrentRow();
- view.enableStartTurnPanel(false);
+ view.setBottomPanel(BottomPanelType.HUMAN_HAND_PANEL);
timer.startTimer();
}
diff --git a/src/jrummikub/view/IView.java b/src/jrummikub/view/IView.java
index acfd4ac..41dbdf1 100644
--- a/src/jrummikub/view/IView.java
+++ b/src/jrummikub/view/IView.java
@@ -47,7 +47,7 @@ public interface IView {
* Sets the current player's name
*
* @param playerName
- * the player name
+ * the player name
*/
public void setCurrentPlayerName(String playerName);
@@ -55,19 +55,11 @@ public interface IView {
* Sets the stones that are to be painted selected
*
* @param stones
- * the stones to be painted selected
+ * the stones to be painted selected
*/
public void setSelectedStones(Collection<Stone> stones);
/**
- * Enables or disables the player's StartTurnPanel
- *
- * @param enable
- * enable/disable
- */
- public void enableStartTurnPanel(boolean enable);
-
- /**
* The start turn event is emitted when the player wants to start his turn
*
* @return the event
@@ -75,14 +67,6 @@ public interface IView {
public IEvent getStartTurnEvent();
/**
- * Enables or disables the panel shown when a player has won
- *
- * @param enable
- * enable/disable
- */
- public void enableWinPanel(boolean enable);
-
- /**
* The quit event is emitted when the player wants to quit the game
*
* @return the event
@@ -100,7 +84,7 @@ public interface IView {
* Shows or hides the game settings panel
*
* @param show
- * specifies if the panel shall be shown or hidden
+ * specifies if the panel shall be shown or hidden
*/
public void showSettingsPanel(boolean show);
@@ -108,7 +92,7 @@ public interface IView {
* Shows or hides the score panel
*
* @param show
- * specifies if the panel shall be shown or hidden
+ * specifies if the panel shall be shown or hidden
*/
public void showScorePanel(boolean show);
@@ -117,40 +101,29 @@ public interface IView {
* along with the name
*
* @param color
- * the current player's color
+ * the current player's color
*/
public void setCurrentPlayerColor(Color color);
/**
- * Is used for the PlayerPanel to display if a player has laid out along
- * with the name
+ * Is used for the PlayerPanel to display if a player has laid out along with
+ * the name
*
* @param hasLaidOut
- * specifies if the current player has laid out or not
+ * specifies if the current player has laid out or not
*/
- public void setHasLaidOut(boolean hasLaidOut);
+ public void setCurrentPlayerHasLaidOut(boolean hasLaidOut);
/**
* Is emitted if the player wants to end the game and start a new one
*
* @return newGameEvent
*/
- IEvent getNewGameEvent();
+ public IEvent getNewGameEvent();
- /**
- * Enables or disables most parts of the interface
- *
- * @param enable
- * specifies if the interface is to be enabled or disabled
- */
- void showInterface(boolean enable);
+ public void setBottomPanel(BottomPanelType type);
- /**
- * Enables or disables the panel shown while the computer player is making a
- * move
- *
- * @param b
- * specifies if the interface is enabled or disabled
- */
- public void enableThinkPanel(boolean b);
+ public enum BottomPanelType {
+ START_GAME_PANEL, START_TURN_PANEL, HUMAN_HAND_PANEL, COMPUTER_HAND_PANEL, WIN_PANEL
+ }
}
diff --git a/src/jrummikub/view/impl/View.java b/src/jrummikub/view/impl/View.java
index 75b2fc6..45f825a 100644
--- a/src/jrummikub/view/impl/View.java
+++ b/src/jrummikub/view/impl/View.java
@@ -160,19 +160,15 @@ public class View extends JFrame implements IView {
playerPanel.getHandPanel().setSelectedStones(stones);
}
- @Override
- public void enableStartTurnPanel(boolean enable) {
- playerPanel.setVisible(!enable);
- startTurnPanel.setVisible(enable);
- winPanel.setVisible(false);
- }
-
- @Override
- public void enableWinPanel(boolean enable) {
- playerPanel.setVisible(!enable);
- startTurnPanel.setVisible(false);
- winPanel.setVisible(enable);
- }
+ /*
+ * @Override public void enableStartTurnPanel(boolean enable) {
+ * playerPanel.setVisible(!enable); startTurnPanel.setVisible(enable);
+ * winPanel.setVisible(false); }
+ *
+ * @Override public void enableWinPanel(boolean enable) {
+ * playerPanel.setVisible(!enable); startTurnPanel.setVisible(false);
+ * winPanel.setVisible(enable); }
+ */
@Override
public void showSettingsPanel(boolean show) {
@@ -196,7 +192,7 @@ public class View extends JFrame implements IView {
}
@Override
- public void setHasLaidOut(boolean hasLaidOut) {
+ public void setCurrentPlayerHasLaidOut(boolean hasLaidOut) {
playerPanel.setHasLaidOut(hasLaidOut);
}
@@ -260,19 +256,18 @@ public class View extends JFrame implements IView {
}
@Override
- public void showInterface(boolean enable) {
- if (enable) {
- playerPanel.showButtons(true);
- } else {
- List<Pair<StoneSet, Position>> emptyTable = Collections.emptyList();
- table.setStoneSets(emptyTable);
+ public void setBottomPanel(BottomPanelType type) {
+ startTurnPanel.setVisible(type == BottomPanelType.START_TURN_PANEL);
+ winPanel.setVisible(type == BottomPanelType.WIN_PANEL);
+ playerPanel.setVisible(type != BottomPanelType.START_TURN_PANEL
+ && type != BottomPanelType.WIN_PANEL);
+
+ if (type == BottomPanelType.START_GAME_PANEL) {
+ table.setStoneSets(Collections.<Pair<StoneSet, Position>> emptyList());
playerPanel.getHandPanel().setStones(createDecorationStones());
- playerPanel.showButtons(false);
}
- }
- @Override
- public void enableThinkPanel(boolean enable) {
- playerPanel.enableButtons(!enable);
+ playerPanel.showButtons(type != BottomPanelType.START_GAME_PANEL);
+ playerPanel.enableButtons(type != BottomPanelType.COMPUTER_HAND_PANEL);
}
}
diff --git a/test/jrummikub/control/GameControlTest.java b/test/jrummikub/control/GameControlTest.java
index 706928c..db60b05 100644
--- a/test/jrummikub/control/GameControlTest.java
+++ b/test/jrummikub/control/GameControlTest.java
@@ -1,8 +1,7 @@
package jrummikub.control;
-import static jrummikub.model.StoneColor.RED;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
+import static jrummikub.model.StoneColor.*;
+import static org.junit.Assert.*;
import java.awt.Color;
@@ -12,6 +11,7 @@ import jrummikub.model.PlayerSettings;
import jrummikub.model.Position;
import jrummikub.model.Stone;
import jrummikub.util.Pair;
+import jrummikub.view.IView.BottomPanelType;
import jrummikub.view.MockView;
import org.junit.Before;
@@ -41,7 +41,7 @@ public class GameControlTest {
@Test
public void testStartFirstRound() {
gameControl.startGame();
- assertTrue(view.displayStartTurnPanel);
+ assertSame(BottomPanelType.START_TURN_PANEL, view.bottomPanelType);
}
/** */
@@ -75,10 +75,10 @@ public class GameControlTest {
view.tablePanel.clickEvent.emit(new Position(0, 0));
view.playerPanel.endTurnEvent.emit();
- assertTrue(view.displayWinPanel);
+ assertSame(BottomPanelType.WIN_PANEL, view.bottomPanelType);
view.newRoundEvent.emit();
- assertTrue(view.displayStartTurnPanel);
+ assertSame(BottomPanelType.START_TURN_PANEL, view.bottomPanelType);
}
/** */
@@ -91,7 +91,7 @@ public class GameControlTest {
view.playerPanel.endTurnEvent.emit();
view.startTurnEvent.emit();
view.playerPanel.redealEvent.emit();
- assertTrue(view.displayStartTurnPanel);
+ assertSame(BottomPanelType.START_TURN_PANEL, view.bottomPanelType);
view.startTurnEvent.emit();
assertSame(firstPlayer, gameControl.roundControl.roundState
.getActivePlayer().getPlayerSettings());
diff --git a/test/jrummikub/control/RoundControlTest.java b/test/jrummikub/control/RoundControlTest.java
index d73018c..49db913 100644
--- a/test/jrummikub/control/RoundControlTest.java
+++ b/test/jrummikub/control/RoundControlTest.java
@@ -28,6 +28,7 @@ import jrummikub.model.Table;
import jrummikub.util.IListener;
import jrummikub.util.IListener1;
import jrummikub.util.Pair;
+import jrummikub.view.IView.BottomPanelType;
import jrummikub.view.MockView;
import org.junit.Before;
@@ -70,24 +71,21 @@ public class RoundControlTest {
gameSettings.getPlayerList().add(new PlayerSettings("Ida", Color.RED));
gameSettings.getPlayerList().add(
new PlayerSettings("Matthias", Color.YELLOW));
- gameSettings.getPlayerList().add(
- new PlayerSettings("Jannis", Color.GREEN));
- gameSettings.getPlayerList().add(
- new PlayerSettings("Bennet", Color.BLACK));
+ gameSettings.getPlayerList().add(new PlayerSettings("Jannis", Color.GREEN));
+ gameSettings.getPlayerList().add(new PlayerSettings("Bennet", Color.BLACK));
roundState = new RoundState(gameSettings);
roundControl = new RoundControl(roundState, view);
}
private void checkCorrectlyDealt() {
GameSettings settings = testRoundState.getGameSettings();
- int totalStones = settings.getHighestValue()
- * settings.getStoneSetNumber()
+ int totalStones = settings.getHighestValue() * settings.getStoneSetNumber()
* settings.getStoneColors().size() + settings.getJokerNumber();
assertEquals(
totalStones - testRoundState.getPlayerCount()
* settings.getNumberOfStonesDealt()
- - testRoundState.table.getSize(), testRoundState
- .getGameHeap().getSize());
+ - testRoundState.table.getSize(), testRoundState.getGameHeap()
+ .getSize());
for (int i = 0; i < testRoundState.getPlayerCount(); i++) {
assertEquals(settings.getNumberOfStonesDealt(), testRoundState
.getNthNextPlayer(i).getHand().getSize());
@@ -97,9 +95,9 @@ public class RoundControlTest {
private void checkTurnStartSetUp() {
assertNotNull(view.currentPlayerName);
// TODO Check player list in view
- assertTrue(view.displayStartTurnPanel);
+
+ assertSame(BottomPanelType.START_TURN_PANEL, view.bottomPanelType);
assertFalse(view.startTurnEvent.listeners.isEmpty());
- assertFalse(view.displayWinPanel);
checkTableDisplay();
}
@@ -119,7 +117,7 @@ public class RoundControlTest {
private void resetTurnStart() {
view.currentPlayerName = null;
// TODO reset player list
- view.displayStartTurnPanel = false;
+ view.bottomPanelType = null;
}
/**
@@ -162,8 +160,8 @@ public class RoundControlTest {
view.tablePanel.clickEvent.emit(new Position(0, 0));
view.playerPanel.endTurnEvent.emit();
- assertFalse(roundState
- .getNthNextPlayer(roundState.getPlayerCount() - 1).getLaidOut());
+ assertFalse(roundState.getNthNextPlayer(roundState.getPlayerCount() - 1)
+ .getLaidOut());
assertEquals(0, roundState.getTable().getSize());
assertEquals(14 + 6, hand.getSize());
}
@@ -183,8 +181,8 @@ public class RoundControlTest {
assertFalse(roundState.getActivePlayer().getLaidOut());
view.playerPanel.endTurnEvent.emit();
- assertFalse(roundState
- .getNthNextPlayer(roundState.getPlayerCount() - 1).getLaidOut());
+ assertFalse(roundState.getNthNextPlayer(roundState.getPlayerCount() - 1)
+ .getLaidOut());
assertEquals(0, roundState.getTable().getSize());
assertEquals(14 + 1, hand.getSize());
}
@@ -231,8 +229,8 @@ public class RoundControlTest {
view.tablePanel.clickEvent.emit(new Position(0, 0));
view.playerPanel.endTurnEvent.emit();
- assertFalse(roundState
- .getNthNextPlayer(roundState.getPlayerCount() - 1).getLaidOut());
+ assertFalse(roundState.getNthNextPlayer(roundState.getPlayerCount() - 1)
+ .getLaidOut());
assertEquals(0, roundState.getTable().getSize());
assertEquals(14 + 9, hand.getSize());
}
@@ -302,8 +300,8 @@ public class RoundControlTest {
view.tablePanel.clickEvent.emit(new Position(0, 0));
view.playerPanel.endTurnEvent.emit();
- assertFalse(roundState
- .getNthNextPlayer(roundState.getPlayerCount() - 1).getLaidOut());
+ assertFalse(roundState.getNthNextPlayer(roundState.getPlayerCount() - 1)
+ .getLaidOut());
assertEquals(2, roundState.getTable().getSize());
assertEquals(14 + 6, hand.getSize());
}
@@ -376,8 +374,8 @@ public class RoundControlTest {
view.tablePanel.clickEvent.emit(new Position(0, 0));
view.playerPanel.endTurnEvent.emit();
- assertFalse(roundState
- .getNthNextPlayer(roundState.getPlayerCount() - 1).getLaidOut());
+ assertFalse(roundState.getNthNextPlayer(roundState.getPlayerCount() - 1)
+ .getLaidOut());
assertEquals(2, roundState.getTable().getSize());
assertEquals(14 + 7, hand.getSize());
}
@@ -440,8 +438,8 @@ public class RoundControlTest {
view.tablePanel.clickEvent.emit(new Position(0, 0));
view.playerPanel.endTurnEvent.emit();
- assertFalse(roundState
- .getNthNextPlayer(roundState.getPlayerCount() - 1).getLaidOut());
+ assertFalse(roundState.getNthNextPlayer(roundState.getPlayerCount() - 1)
+ .getLaidOut());
assertEquals(2, roundState.getTable().getSize());
assertEquals(14 + 3, hand.getSize());
}
@@ -547,7 +545,7 @@ public class RoundControlTest {
oldTable.clonedTable = testTable;
view.startTurnEvent.emit();
- assertFalse(view.displayStartTurnPanel);
+ assertSame(BottomPanelType.HUMAN_HAND_PANEL, view.bottomPanelType);
IHand hand = testRoundState.players.get(0).hand;
hand.pickUp(hand.iterator().next().getFirst());
@@ -573,7 +571,7 @@ public class RoundControlTest {
oldTable.clonedTable = testTable;
view.startTurnEvent.emit();
- assertFalse(view.displayStartTurnPanel);
+ assertSame(BottomPanelType.HUMAN_HAND_PANEL, view.bottomPanelType);
IHand hand = testRoundState.players.get(0).hand;
Stone stone = hand.iterator().next().getFirst();
hand.pickUp(stone);
@@ -601,7 +599,7 @@ public class RoundControlTest {
oldTable.clonedTable = testTable;
view.startTurnEvent.emit();
- assertFalse(view.displayStartTurnPanel);
+ assertSame(BottomPanelType.HUMAN_HAND_PANEL, view.bottomPanelType);
resetTurnStart();
view.getPlayerPanel().endTurnEvent.emit();
@@ -626,7 +624,7 @@ public class RoundControlTest {
oldTable.clonedTable = testTable;
view.startTurnEvent.emit();
- assertFalse(view.displayStartTurnPanel);
+ assertSame(BottomPanelType.HUMAN_HAND_PANEL, view.bottomPanelType);
resetTurnStart();
view.getPlayerPanel().endTurnEvent.emit();
@@ -658,7 +656,7 @@ public class RoundControlTest {
oldTable.clonedTable = testTable;
view.startTurnEvent.emit();
- assertFalse(view.displayStartTurnPanel);
+ assertSame(BottomPanelType.HUMAN_HAND_PANEL, view.bottomPanelType);
IHand hand = testRoundState.players.get(0).hand;
Stone blueEight = new Stone(8, BLUE);
@@ -699,15 +697,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));
@@ -732,15 +727,14 @@ 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, orangeOne));
- StoneSet oldSet2 = new StoneSet(Arrays.asList(blueTwo, blueThree,
- blueFour));
+ StoneSet oldSet1 = new StoneSet(Arrays.asList(blueOne, redOne, blackOne,
+ orangeOne));
+ StoneSet oldSet2 = new StoneSet(Arrays.asList(blueTwo, blueThree, blueFour));
oldTable.drop(oldSet1, new Position(0, 0));
oldTable.drop(oldSet2, new Position(0, 0));
ITable newTable = (Table) oldTable.clone();
- List<StoneSet> newSets = RoundControl.tableSetDifference(oldTable,
- newTable);
+ List<StoneSet> newSets = RoundControl
+ .tableSetDifference(oldTable, newTable);
List<StoneSet> vanishedSets = RoundControl.tableSetDifference(newTable,
oldTable);
@@ -748,8 +742,8 @@ public class RoundControlTest {
assertTrue(vanishedSets.isEmpty());
newTable.pickUp(oldSet2);
- newTable.drop(oldSet2.join(new StoneSet(new Stone(5, BLUE))),
- new Position(0, 0));
+ newTable.drop(oldSet2.join(new StoneSet(new Stone(5, BLUE))), new Position(
+ 0, 0));
newSets = RoundControl.tableSetDifference(oldTable, newTable);
vanishedSets = RoundControl.tableSetDifference(newTable, oldTable);
@@ -761,8 +755,7 @@ public class RoundControlTest {
Stone redTwo = new Stone(2, RED);
Stone redThree = new Stone(3, RED);
Stone redFour = new Stone(4, RED);
- StoneSet oldSet3 = new StoneSet(
- Arrays.asList(redTwo, redThree, redFour));
+ StoneSet oldSet3 = new StoneSet(Arrays.asList(redTwo, redThree, redFour));
ITable newTable2 = (Table) oldTable.clone();
newTable2.drop(oldSet3, new Position(0, 0));
newSets = RoundControl.tableSetDifference(oldTable, newTable2);
@@ -824,20 +817,19 @@ public class RoundControlTest {
}
testRoundState.players.get(0).laidOut = true;
- testRoundState.players.get(0).hand.drop(new Stone(1, RED),
- new Position(0, 0));
- testRoundState.players.get(0).hand.drop(new Stone(2, RED),
- new Position(0, 0));
- testRoundState.players.get(1).laidOut = true;
- testRoundState.players.get(1).hand.drop(new Stone(RED), new Position(0,
+ testRoundState.players.get(0).hand.drop(new Stone(1, RED), new Position(0,
0));
+ testRoundState.players.get(0).hand.drop(new Stone(2, RED), new Position(0,
+ 0));
+ testRoundState.players.get(1).laidOut = true;
+ testRoundState.players.get(1).hand.drop(new Stone(RED), new Position(0, 0));
testRoundState.players.get(2).laidOut = false;
- testRoundState.players.get(2).hand.drop(new Stone(9, RED),
- new Position(0, 0));
- testRoundState.players.get(2).hand.drop(new Stone(10, RED),
- new Position(0, 0));
- testRoundState.players.get(2).hand.drop(new Stone(11, RED),
- new Position(0, 0));
+ testRoundState.players.get(2).hand.drop(new Stone(9, RED), new Position(0,
+ 0));
+ testRoundState.players.get(2).hand.drop(new Stone(10, RED), new Position(0,
+ 0));
+ testRoundState.players.get(2).hand.drop(new Stone(11, RED), new Position(0,
+ 0));
testRoundState.players.get(3).laidOut = true;
testRound.endOfRound();
@@ -871,19 +863,19 @@ public class RoundControlTest {
}
testRoundState.players.get(0).laidOut = true;
- testRoundState.players.get(0).hand.drop(new Stone(1, RED),
- new Position(0, 0));
- testRoundState.players.get(0).hand.drop(new Stone(2, RED),
- new Position(0, 0));
+ testRoundState.players.get(0).hand.drop(new Stone(1, RED), new Position(0,
+ 0));
+ testRoundState.players.get(0).hand.drop(new Stone(2, RED), new Position(0,
+ 0));
testRoundState.players.get(1).laidOut = true;
- testRoundState.players.get(1).hand.drop(new Stone(3, RED),
- new Position(0, 0));
+ testRoundState.players.get(1).hand.drop(new Stone(3, RED), new Position(0,
+ 0));
testRoundState.players.get(2).laidOut = true;
- testRoundState.players.get(2).hand.drop(new Stone(3, BLUE),
- new Position(0, 0));
+ testRoundState.players.get(2).hand.drop(new Stone(3, BLUE), new Position(0,
+ 0));
testRoundState.players.get(3).laidOut = false;
- testRoundState.players.get(3).hand.drop(new Stone(13, RED),
- new Position(0, 0));
+ testRoundState.players.get(3).hand.drop(new Stone(13, RED), new Position(0,
+ 0));
testRound.endOfRound();
assertTrue(roundEnded);
diff --git a/test/jrummikub/control/turn/TurnControlTest.java b/test/jrummikub/control/turn/TurnControlTest.java
index 89d22bf..a59197f 100644
--- a/test/jrummikub/control/turn/TurnControlTest.java
+++ b/test/jrummikub/control/turn/TurnControlTest.java
@@ -1,12 +1,7 @@
package jrummikub.control.turn;
-import static jrummikub.model.StoneColor.BLACK;
-import static jrummikub.model.StoneColor.BLUE;
-import static jrummikub.model.StoneColor.RED;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
+import static jrummikub.model.StoneColor.*;
+import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.Arrays;
@@ -32,6 +27,7 @@ import jrummikub.util.Event;
import jrummikub.util.IEvent;
import jrummikub.util.IListener;
import jrummikub.util.Pair;
+import jrummikub.view.IView.BottomPanelType;
import jrummikub.view.MockView;
import org.junit.Before;
@@ -130,7 +126,7 @@ public class TurnControlTest {
@SuppressWarnings("unchecked")
@Test
public void showInitialHand() {
- mockView.displayStartTurnPanel = true;
+ mockView.bottomPanelType = BottomPanelType.START_TURN_PANEL;
List<Pair<Stone, Position>> stones = Arrays.asList(
new Pair<Stone, Position>(new Stone(RED), new Position(0, 0)),
@@ -150,7 +146,7 @@ public class TurnControlTest {
}
assertEquals(stones.size(), i);
- assertFalse(mockView.displayStartTurnPanel);
+ assertSame(BottomPanelType.HUMAN_HAND_PANEL, mockView.bottomPanelType);
}
/** */