summaryrefslogtreecommitdiffstats
path: root/test/jrummikub/control
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2011-06-13 22:29:28 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2011-06-13 22:29:28 +0200
commit570187c95000afd1ac9f6d6e8bb5cab30b984e87 (patch)
treecd6ed34d64da7621545d66c9f1126c723645b58f /test/jrummikub/control
parent741a94953f2d4667de564d8ade37e68a04442fe0 (diff)
downloadJRummikub-570187c95000afd1ac9f6d6e8bb5cab30b984e87.tar
JRummikub-570187c95000afd1ac9f6d6e8bb5cab30b984e87.zip
Implemented most of network settings control
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@425 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'test/jrummikub/control')
-rw-r--r--test/jrummikub/control/SettingsControlTest.java44
-rw-r--r--test/jrummikub/control/turn/TurnControlTest.java20
2 files changed, 45 insertions, 19 deletions
diff --git a/test/jrummikub/control/SettingsControlTest.java b/test/jrummikub/control/SettingsControlTest.java
index a8e9849..cb527d2 100644
--- a/test/jrummikub/control/SettingsControlTest.java
+++ b/test/jrummikub/control/SettingsControlTest.java
@@ -7,7 +7,6 @@ import java.awt.Color;
import java.util.Arrays;
import java.util.HashSet;
-import jrummikub.control.turn.TurnControlFactory;
import jrummikub.model.GameSettings;
import jrummikub.model.PlayerSettings.Type;
import jrummikub.model.StoneColor;
@@ -42,12 +41,15 @@ public class SettingsControlTest {
/** */
@Test
public void initialStateTest() {
- assertSame(ISettingsPanel.SettingsError.NO_ERROR,
- view.settingsPanel.error);
+ assertSame(ISettingsPanel.SettingsError.NO_ERROR, view.settingsPanel.error);
view.settingsPanel.startGameEvent.emit();
assertNotNull(gameSettings);
assertEquals(2, gameSettings.getPlayerList().size());
- assertFalse(view.settingsPanel.removePlayerButtonsEnabled);
+ assertEquals(2, view.settingsPanel.removePlayerButtonsEnabled.size());
+
+ for (Boolean enabled : view.settingsPanel.removePlayerButtonsEnabled) {
+ assertFalse(enabled);
+ }
}
/** */
@@ -57,7 +59,11 @@ public class SettingsControlTest {
view.settingsPanel.startGameEvent.emit();
assertNotNull(gameSettings);
assertEquals(3, gameSettings.getPlayerList().size());
- assertTrue(view.settingsPanel.removePlayerButtonsEnabled);
+ assertEquals(3, view.settingsPanel.removePlayerButtonsEnabled.size());
+
+ for (Boolean enabled : view.settingsPanel.removePlayerButtonsEnabled) {
+ assertTrue(enabled);
+ }
}
/** */
@@ -70,8 +76,12 @@ public class SettingsControlTest {
view.settingsPanel.startGameEvent.emit();
assertNotNull(gameSettings);
assertEquals(16, gameSettings.getPlayerList().size());
- assertTrue(view.settingsPanel.removePlayerButtonsEnabled);
+ assertEquals(16, view.settingsPanel.removePlayerButtonsEnabled.size());
assertFalse(view.settingsPanel.addPlayerButtonEnabled);
+
+ for (Boolean enabled : view.settingsPanel.removePlayerButtonsEnabled) {
+ assertTrue(enabled);
+ }
}
/** */
@@ -85,8 +95,13 @@ public class SettingsControlTest {
view.settingsPanel.startGameEvent.emit();
assertNotNull(gameSettings);
assertEquals(15, gameSettings.getPlayerList().size());
- assertTrue(view.settingsPanel.removePlayerButtonsEnabled);
+ assertEquals(15, view.settingsPanel.removePlayerButtonsEnabled.size());
+
assertTrue(view.settingsPanel.addPlayerButtonEnabled);
+
+ for (Boolean enabled : view.settingsPanel.removePlayerButtonsEnabled) {
+ assertTrue(enabled);
+ }
}
/** */
@@ -97,7 +112,11 @@ public class SettingsControlTest {
view.settingsPanel.startGameEvent.emit();
assertNotNull(gameSettings);
assertEquals(2, gameSettings.getPlayerList().size());
- assertFalse(view.settingsPanel.removePlayerButtonsEnabled);
+ assertEquals(2, view.settingsPanel.removePlayerButtonsEnabled.size());
+
+ for (Boolean enabled : view.settingsPanel.removePlayerButtonsEnabled) {
+ assertFalse(enabled);
+ }
}
/** */
@@ -164,8 +183,7 @@ public class SettingsControlTest {
view.settingsPanel.changePlayerNameEvent.emit(1, name2);
assertTrue(view.settingsPanel.startButtonEnabled);
- assertSame(ISettingsPanel.SettingsError.NO_ERROR,
- view.settingsPanel.error);
+ assertSame(ISettingsPanel.SettingsError.NO_ERROR, view.settingsPanel.error);
view.settingsPanel.startGameEvent.emit();
assertNotNull(gameSettings);
@@ -262,10 +280,8 @@ public class SettingsControlTest {
view.settingsPanel.startGameEvent.emit();
assertNotNull(gameSettings);
assertEquals(2, gameSettings.getPlayerList().size());
- assertSame(Type.COMPUTER, gameSettings.getPlayerList().get(0)
- .getTurnControlType());
- assertSame(Type.HUMAN, gameSettings.getPlayerList().get(1)
- .getTurnControlType());
+ assertSame(Type.COMPUTER, gameSettings.getPlayerList().get(0).getType());
+ assertSame(Type.HUMAN, gameSettings.getPlayerList().get(1).getType());
}
}
diff --git a/test/jrummikub/control/turn/TurnControlTest.java b/test/jrummikub/control/turn/TurnControlTest.java
index bebfff5..e4fc187 100644
--- a/test/jrummikub/control/turn/TurnControlTest.java
+++ b/test/jrummikub/control/turn/TurnControlTest.java
@@ -110,7 +110,9 @@ public class TurnControlTest {
mockPlayer = new MockPlayer(null, null);
mockPlayer.hand = mockHand;
testControl = new HumanTurnControl(mockTimer);
- testControl.setup(new ITurnControl.TurnInfo(mockTable, mockPlayer.getHand(), mockPlayer.getLaidOut(), TurnMode.NORMAL_TURN), new GameSettings(), mockView);
+ testControl.setup(new ITurnControl.TurnInfo(mockTable,
+ mockPlayer.getHand(), mockPlayer.getLaidOut(), TurnMode.NORMAL_TURN),
+ new GameSettings(), mockView);
}
/** */
@@ -134,7 +136,9 @@ public class TurnControlTest {
mockHand.iterable = stones;
testControl = new HumanTurnControl(mockTimer);
- testControl.setup(new ITurnControl.TurnInfo(mockTable, mockPlayer.getHand(), mockPlayer.getLaidOut(), TurnMode.NORMAL_TURN), new GameSettings(), mockView);
+ testControl.setup(new ITurnControl.TurnInfo(mockTable,
+ mockPlayer.getHand(), mockPlayer.getLaidOut(), TurnMode.NORMAL_TURN),
+ new GameSettings(), mockView);
testControl.startTurn();
int i = 0;
@@ -627,7 +631,9 @@ public class TurnControlTest {
public void testAddLeft() {
AccessibleTable table = new AccessibleTable();
HumanTurnControl turnControl = new HumanTurnControl(mockTimer);
- turnControl.setup(new ITurnControl.TurnInfo(table, mockPlayer.getHand(), mockPlayer.getLaidOut(), TurnMode.NORMAL_TURN), new GameSettings(), mockView);
+ turnControl.setup(new ITurnControl.TurnInfo(table, mockPlayer.getHand(),
+ mockPlayer.getLaidOut(), TurnMode.NORMAL_TURN), new GameSettings(),
+ mockView);
turnControl.startTurn();
Stone blueOne = new Stone(1, BLUE);
Stone redOne = new Stone(1, RED);
@@ -744,7 +750,9 @@ public class TurnControlTest {
public void testAddRight() {
AccessibleTable table = new AccessibleTable();
HumanTurnControl turnControl = new HumanTurnControl(mockTimer);
- turnControl.setup(new ITurnControl.TurnInfo(table, mockPlayer.getHand(), mockPlayer.getLaidOut(), TurnMode.NORMAL_TURN), new GameSettings(), mockView);
+ turnControl.setup(new ITurnControl.TurnInfo(table, mockPlayer.getHand(),
+ mockPlayer.getLaidOut(), TurnMode.NORMAL_TURN), new GameSettings(),
+ mockView);
turnControl.startTurn();
Stone blueOne = new Stone(1, BLUE);
Stone redOne = new Stone(1, RED);
@@ -861,7 +869,9 @@ public class TurnControlTest {
public void testAddNewSet() {
AccessibleTable table = new AccessibleTable();
HumanTurnControl turnControl = new HumanTurnControl(mockTimer);
- turnControl.setup(new ITurnControl.TurnInfo(table, mockPlayer.getHand(), mockPlayer.getLaidOut(), TurnMode.NORMAL_TURN), new GameSettings(), mockView);
+ turnControl.setup(new ITurnControl.TurnInfo(table, mockPlayer.getHand(),
+ mockPlayer.getLaidOut(), TurnMode.NORMAL_TURN), new GameSettings(),
+ mockView);
turnControl.startTurn();
Stone blueOne = new Stone(1, BLUE);
Stone redOne = new Stone(1, RED);