summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJannis Harder <harder@informatik.uni-luebeck.de>2011-05-29 18:50:49 +0200
committerJannis Harder <harder@informatik.uni-luebeck.de>2011-05-29 18:50:49 +0200
commit9e21e3f23c68a077f95f3cf47bf70cf1e8df3542 (patch)
treef91f1eee57ba33b186a0b5085d6342f6f97ffc4b
parent3f3f6370c92a22af54fc2ad633101b74fdd34c67 (diff)
downloadJRummikub-9e21e3f23c68a077f95f3cf47bf70cf1e8df3542.tar
JRummikub-9e21e3f23c68a077f95f3cf47bf70cf1e8df3542.zip
Test for joker number in settings control
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@301 72836036-5685-4462-b002-a69064685172
-rw-r--r--mock/jrummikub/view/MockSettingsPanel.java2
-rw-r--r--src/jrummikub/model/GameSettings.java20
-rw-r--r--test/jrummikub/control/SettingsControlTest.java10
3 files changed, 31 insertions, 1 deletions
diff --git a/mock/jrummikub/view/MockSettingsPanel.java b/mock/jrummikub/view/MockSettingsPanel.java
index 2e2663a..b361432 100644
--- a/mock/jrummikub/view/MockSettingsPanel.java
+++ b/mock/jrummikub/view/MockSettingsPanel.java
@@ -24,7 +24,7 @@ public class MockSettingsPanel implements ISettingsPanel {
public GameSettings gameSettings = new GameSettings();
public MockEvent1<Integer> changeInitialMeldThresholdEvent = new MockEvent1<Integer>();
- public IEvent1<Integer> changeJokerNumberEvent = new MockEvent1<Integer>();
+ public MockEvent1<Integer> changeJokerNumberEvent = new MockEvent1<Integer>();
public int initialMeldThreshold;
public int jokerNumber;
diff --git a/src/jrummikub/model/GameSettings.java b/src/jrummikub/model/GameSettings.java
index 7d525c6..0feff26 100644
--- a/src/jrummikub/model/GameSettings.java
+++ b/src/jrummikub/model/GameSettings.java
@@ -11,6 +11,7 @@ public class GameSettings {
private int initialMeldThreshold;
private int jokerPoints;
+ private int jokerNumber;
/**
* Creates new GameSettings with default values
@@ -18,6 +19,7 @@ public class GameSettings {
public GameSettings() {
initialMeldThreshold = 30;
jokerPoints = 50;
+ jokerNumber = 2;
}
/**
@@ -66,4 +68,22 @@ public class GameSettings {
public int getJokerPoints() {
return jokerPoints;
}
+
+ /**
+ * Sets the number of jokers in game
+ *
+ * @param value
+ */
+ public void setJokerNumber(int value) {
+ jokerNumber = value;
+ }
+
+ /**
+ * Returns the number of jokers
+ *
+ * @return the number of jokers
+ */
+ public int getJokerNumber() {
+ return jokerNumber;
+ }
}
diff --git a/test/jrummikub/control/SettingsControlTest.java b/test/jrummikub/control/SettingsControlTest.java
index 40a9265..fef6b28 100644
--- a/test/jrummikub/control/SettingsControlTest.java
+++ b/test/jrummikub/control/SettingsControlTest.java
@@ -184,5 +184,15 @@ public class SettingsControlTest {
view.settingsPanel.startGameEvent.emit();
assertEquals(25, gameSettings.getInitialMeldThreshold());
}
+
+ /** */
+ @Test
+ public void jokerNumberTest() {
+ assertEquals(initialSettings.getJokerNumber(), view.settingsPanel.jokerNumber);
+
+ view.settingsPanel.changeJokerNumberEvent.emit(25);
+ view.settingsPanel.startGameEvent.emit();
+ assertEquals(25, gameSettings.getJokerNumber());
+ }
}