summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2011-05-28 20:13:35 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2011-05-28 20:13:35 +0200
commit5aa79ea898e16cee1265ba9457c1af11616584cc (patch)
tree1f65d8e1042e4e7599c908a07f4d74fec831d866 /test
parent5029ff206a00695bb955e49d659c20b8313192d4 (diff)
downloadJRummikub-5aa79ea898e16cee1265ba9457c1af11616584cc.tar
JRummikub-5aa79ea898e16cee1265ba9457c1af11616584cc.zip
Implement settings control
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@291 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'test')
-rw-r--r--test/jrummikub/control/SettingsControlTest.java21
1 files changed, 16 insertions, 5 deletions
diff --git a/test/jrummikub/control/SettingsControlTest.java b/test/jrummikub/control/SettingsControlTest.java
index f0e4ae0..8dc286c 100644
--- a/test/jrummikub/control/SettingsControlTest.java
+++ b/test/jrummikub/control/SettingsControlTest.java
@@ -12,11 +12,13 @@ import jrummikub.view.MockView;
import org.junit.Before;
import org.junit.Test;
+/** */
public class SettingsControlTest {
MockView view = new MockView();
SettingsControl settingsControl = new SettingsControl(view);
GameSettings gameSettings = null;
+ /** */
@Before
public void setup() {
settingsControl.getStartGameEvent().add(new IListener1<GameSettings>() {
@@ -24,21 +26,23 @@ public class SettingsControlTest {
@Override
public void handle(GameSettings value) {
gameSettings = value;
-
}
});
+
+ settingsControl.startSettings();
}
+ /** */
@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);
}
+ /** */
@Test
public void addPlayerTest() {
view.settingsPanel.addPlayerEvent.emit();
@@ -48,6 +52,7 @@ public class SettingsControlTest {
assertTrue(view.settingsPanel.removePlayerButtonsEnabled);
}
+ /** */
@Test
public void add14PlayerTest() {
for (int i = 0; i < 14; i++) {
@@ -60,6 +65,7 @@ public class SettingsControlTest {
assertFalse(view.settingsPanel.addPlayerButtonEnabled);
}
+ /** */
@Test
public void add14RemovePlayerTest() {
for (int i = 0; i < 14; i++) {
@@ -73,6 +79,7 @@ public class SettingsControlTest {
assertTrue(view.settingsPanel.addPlayerButtonEnabled);
}
+ /** */
@Test
public void removePlayerTest() {
view.settingsPanel.addPlayerEvent.emit();
@@ -83,6 +90,7 @@ public class SettingsControlTest {
assertFalse(view.settingsPanel.removePlayerButtonsEnabled);
}
+ /** */
@Test
public void takenColorTest() {
Color color1 = Color.RED;
@@ -97,6 +105,7 @@ public class SettingsControlTest {
assertSame(color1, gameSettings.getPlayerList().get(1).getColor());
}
+ /** */
@Test
public void unusedColorTest() {
Color color1 = Color.RED;
@@ -112,6 +121,7 @@ public class SettingsControlTest {
assertSame(color3, gameSettings.getPlayerList().get(1).getColor());
}
+ /** */
@Test
public void takenNameTest() {
String name1 = "Julia";
@@ -126,6 +136,7 @@ public class SettingsControlTest {
assertNull(gameSettings);
}
+ /** */
@Test
public void fixTakenNameTest() {
String name1 = "Julia";
@@ -143,13 +154,13 @@ 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);
}
+ /** */
@Test
public void emptyNameTest() {
String name1 = "";