summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJannis Harder <harder@informatik.uni-luebeck.de>2011-05-29 15:32:00 +0200
committerJannis Harder <harder@informatik.uni-luebeck.de>2011-05-29 15:32:00 +0200
commit09aa507e3b3d08cc168077c093c6ad264bdc4e8f (patch)
tree0b1e1fd53ad5da4be616b633b78cf6714aa8c648
parent7f89a1ce1067ec4ad31e0496bd679f70939aca10 (diff)
downloadJRummikub-09aa507e3b3d08cc168077c093c6ad264bdc4e8f.tar
JRummikub-09aa507e3b3d08cc168077c093c6ad264bdc4e8f.zip
Test initial meld threshold in settings control
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@295 72836036-5685-4462-b002-a69064685172
-rw-r--r--src/jrummikub/control/ApplicationControl.java2
-rw-r--r--src/jrummikub/control/SettingsControl.java8
-rw-r--r--test/jrummikub/control/SettingsControlTest.java13
3 files changed, 18 insertions, 5 deletions
diff --git a/src/jrummikub/control/ApplicationControl.java b/src/jrummikub/control/ApplicationControl.java
index 8e09853..7a3113f 100644
--- a/src/jrummikub/control/ApplicationControl.java
+++ b/src/jrummikub/control/ApplicationControl.java
@@ -25,7 +25,7 @@ public class ApplicationControl {
* Starts the application by showing the game settings dialog panel
*/
public void startApplication() {
- SettingsControl settingsControl = new SettingsControl(view);
+ SettingsControl settingsControl = new SettingsControl(view, new GameSettings());
settingsControl.getStartGameEvent().add(new IListener1<GameSettings>() {
@Override
diff --git a/src/jrummikub/control/SettingsControl.java b/src/jrummikub/control/SettingsControl.java
index 7def918..b294cae 100644
--- a/src/jrummikub/control/SettingsControl.java
+++ b/src/jrummikub/control/SettingsControl.java
@@ -19,17 +19,19 @@ public class SettingsControl {
private IView view;
private Event1<GameSettings> startGameEvent = new Event1<GameSettings>();
- private GameSettings settings = new GameSettings();
+ private GameSettings settings;
/**
* Create a new settings control
*
* @param view
* the view to use
+ * @param settings
+ * initial game settings
*/
- public SettingsControl(IView view) {
+ public SettingsControl(IView view, GameSettings settings) {
this.view = view;
-
+ this.settings = settings;
addPlayer();
addPlayer();
}
diff --git a/test/jrummikub/control/SettingsControlTest.java b/test/jrummikub/control/SettingsControlTest.java
index 8dc286c..40a9265 100644
--- a/test/jrummikub/control/SettingsControlTest.java
+++ b/test/jrummikub/control/SettingsControlTest.java
@@ -15,7 +15,8 @@ import org.junit.Test;
/** */
public class SettingsControlTest {
MockView view = new MockView();
- SettingsControl settingsControl = new SettingsControl(view);
+ GameSettings initialSettings = new GameSettings();
+ SettingsControl settingsControl = new SettingsControl(view, initialSettings);
GameSettings gameSettings = null;
/** */
@@ -173,5 +174,15 @@ public class SettingsControlTest {
view.settingsPanel.startGameEvent.emit();
assertNull(gameSettings);
}
+
+ /** */
+ @Test
+ public void initialMeldThresholdTest() {
+ assertEquals(initialSettings.getInitialMeldThreshold(), view.settingsPanel.initialMeldThreshold);
+
+ view.settingsPanel.changeInitialMeldThresholdEvent.emit(25);
+ view.settingsPanel.startGameEvent.emit();
+ assertEquals(25, gameSettings.getInitialMeldThreshold());
+ }
}