summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2011-05-31 01:50:56 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2011-05-31 01:50:56 +0200
commitc004a07a4267f3320d23f3d1d2cf483cd56f40b7 (patch)
tree97ea6ce039c22c9cece01bf59a686edb0ba14d1a /test
parentc78e8e64484b887cbdd2f5e903ce25828c93e08a (diff)
downloadJRummikub-c004a07a4267f3320d23f3d1d2cf483cd56f40b7.tar
JRummikub-c004a07a4267f3320d23f3d1d2cf483cd56f40b7.zip
Make highest value and number of stones dealt settable
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@337 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'test')
-rw-r--r--test/jrummikub/control/RoundControlTest.java2
-rw-r--r--test/jrummikub/control/SettingsControlTest.java53
-rw-r--r--test/jrummikub/model/StoneHeapTest.java4
-rw-r--r--test/jrummikub/model/StoneSetTest.java4
4 files changed, 50 insertions, 13 deletions
diff --git a/test/jrummikub/control/RoundControlTest.java b/test/jrummikub/control/RoundControlTest.java
index a71e231..1e960ff 100644
--- a/test/jrummikub/control/RoundControlTest.java
+++ b/test/jrummikub/control/RoundControlTest.java
@@ -80,7 +80,7 @@ public class RoundControlTest {
private void checkCorrectlyDealt() {
GameSettings settings = testRoundState.getGameSettings();
- int totalStones = settings.getHighestCard()
+ int totalStones = settings.getHighestValue()
* settings.getStoneSetNumber()
* settings.getStoneColors().size() + settings.getJokerNumber();
assertEquals(
diff --git a/test/jrummikub/control/SettingsControlTest.java b/test/jrummikub/control/SettingsControlTest.java
index 969b554..534904d 100644
--- a/test/jrummikub/control/SettingsControlTest.java
+++ b/test/jrummikub/control/SettingsControlTest.java
@@ -1,11 +1,15 @@
package jrummikub.control;
+import static jrummikub.model.StoneColor.*;
import static org.junit.Assert.*;
import java.awt.Color;
+import java.util.Arrays;
+import java.util.HashSet;
import jrummikub.control.turn.TurnControlFactory;
import jrummikub.model.GameSettings;
+import jrummikub.model.StoneColor;
import jrummikub.util.IListener1;
import jrummikub.view.ISettingsPanel;
import jrummikub.view.MockView;
@@ -37,8 +41,7 @@ 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());
@@ -159,8 +162,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);
@@ -215,6 +217,41 @@ public class SettingsControlTest {
/** */
@Test
+ public void changeNumberOfStonesDealtTest() {
+ assertEquals(initialSettings.getNumberOfStonesDealt(),
+ view.settingsPanel.numberOfStonesDealt);
+
+ view.settingsPanel.changeNumberOfStonesDealtEvent.emit(15);
+ view.settingsPanel.startGameEvent.emit();
+ assertEquals(15, gameSettings.getNumberOfStonesDealt());
+ }
+
+ /** */
+ @Test
+ public void changeHighestValueTest() {
+ assertEquals(initialSettings.getHighestValue(),
+ view.settingsPanel.highestValue);
+
+ view.settingsPanel.changeHighestValueEvent.emit(10);
+ view.settingsPanel.startGameEvent.emit();
+ assertEquals(10, gameSettings.getHighestValue());
+ }
+
+ /** */
+ @Test
+ public void changeStoneColorsTest() {
+ assertEquals(initialSettings.getStoneColors(),
+ view.settingsPanel.stoneColors);
+
+ view.settingsPanel.changeStoneColorsEvent.emit(new HashSet<StoneColor>(Arrays.asList(
+ BLUE, RED, BLACK)));
+ view.settingsPanel.startGameEvent.emit();
+ assertEquals(new HashSet<StoneColor>(Arrays.asList(BLUE, RED, BLACK)),
+ gameSettings.getStoneColors());
+ }
+
+ /** */
+ @Test
public void typeChangeTest() {
view.settingsPanel.changePlayerTypeEvent.emit(0,
TurnControlFactory.Type.COMPUTER);
@@ -225,10 +262,10 @@ public class SettingsControlTest {
view.settingsPanel.startGameEvent.emit();
assertNotNull(gameSettings);
assertEquals(2, gameSettings.getPlayerList().size());
- assertSame(TurnControlFactory.Type.COMPUTER, gameSettings
- .getPlayerList().get(0).getTurnControlType());
- assertSame(TurnControlFactory.Type.HUMAN, gameSettings.getPlayerList()
- .get(1).getTurnControlType());
+ assertSame(TurnControlFactory.Type.COMPUTER, gameSettings.getPlayerList()
+ .get(0).getTurnControlType());
+ assertSame(TurnControlFactory.Type.HUMAN,
+ gameSettings.getPlayerList().get(1).getTurnControlType());
}
}
diff --git a/test/jrummikub/model/StoneHeapTest.java b/test/jrummikub/model/StoneHeapTest.java
index f0b88d3..48ca488 100644
--- a/test/jrummikub/model/StoneHeapTest.java
+++ b/test/jrummikub/model/StoneHeapTest.java
@@ -54,7 +54,7 @@ public class StoneHeapTest {
}
private int calculateTotalNumberOfStones(GameSettings testSettings) {
- int totalStones = testSettings.getHighestCard()
+ int totalStones = testSettings.getHighestValue()
* testSettings.getStoneSetNumber()
* testSettings.getStoneColors().size()
+ testSettings.getJokerNumber();
@@ -81,7 +81,7 @@ public class StoneHeapTest {
*/
@Theory
public void fullColor(Pair<GameSettings, StoneHeap> data) {
- int stonesOfAColor = data.getFirst().getHighestCard()
+ int stonesOfAColor = data.getFirst().getHighestValue()
* data.getFirst().getStoneSetNumber();
Map<StoneColor, Integer> counters = new HashMap<StoneColor, Integer>();
for (StoneColor c : data.getFirst().getStoneColors()) {
diff --git a/test/jrummikub/model/StoneSetTest.java b/test/jrummikub/model/StoneSetTest.java
index a5c44f0..b9fd961 100644
--- a/test/jrummikub/model/StoneSetTest.java
+++ b/test/jrummikub/model/StoneSetTest.java
@@ -31,8 +31,8 @@ public class StoneSetTest {
moreColorSettings.setStoneColors(EnumSet.allOf(StoneColor.class));
lessColorSettings.setStoneColors(new HashSet<StoneColor>(Arrays.asList(
StoneColor.BLUE, StoneColor.RED, StoneColor.BLACK)));
- higherValueSettings.setHighestCard(17);
- lowerValueSettings.setHighestCard(10);
+ higherValueSettings.setHighestValue(17);
+ lowerValueSettings.setHighestValue(10);
}
private void assertSet(StoneSet.Type expectedType, Integer expectedValue,