Test für SettingsControl, 3 neue Klassen, Mocks für SettingPanel, lauter fixes
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@285 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
df79c78dec
commit
531fe57b17
7 changed files with 432 additions and 58 deletions
87
mock/jrummikub/view/MockSettingsPanel.java
Normal file
87
mock/jrummikub/view/MockSettingsPanel.java
Normal file
|
@ -0,0 +1,87 @@
|
|||
package jrummikub.view;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import jrummikub.model.GameSettings;
|
||||
import jrummikub.util.IEvent;
|
||||
import jrummikub.util.IEvent1;
|
||||
import jrummikub.util.IEvent2;
|
||||
import jrummikub.util.MockEvent;
|
||||
import jrummikub.util.MockEvent1;
|
||||
import jrummikub.util.MockEvent2;
|
||||
|
||||
public class MockSettingsPanel implements ISettingsPanel {
|
||||
|
||||
public MockEvent addPlayerEvent = new MockEvent();
|
||||
public MockEvent1<Integer> removePlayerEvent = new MockEvent1<Integer>();
|
||||
public MockEvent2<Integer, Color> changePlayerColorEvent = new MockEvent2<Integer, Color>();
|
||||
public MockEvent2<Integer, String> changePlayerNameEvent = new MockEvent2<Integer, String>();
|
||||
public MockEvent1<Integer> changeInitialMeldThresholdEvent = new MockEvent1<Integer>();
|
||||
public MockEvent startGameEvent = new MockEvent();
|
||||
public SettingsError error = SettingsError.NO_ERROR;
|
||||
public boolean startButtonEnabled = true;
|
||||
public boolean addPlayerButtonEnabled = true;
|
||||
public boolean removePlayerButtonsEnabled = false;
|
||||
public GameSettings gameSettings = new GameSettings();
|
||||
|
||||
@Override
|
||||
public IEvent getAddPlayerEvent() {
|
||||
return addPlayerEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEvent1<Integer> getRemovePlayerEvent() {
|
||||
return removePlayerEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEvent2<Integer, Color> getChangePlayerColorEvent() {
|
||||
return changePlayerColorEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEvent2<Integer, String> getChangePlayerNameEvent() {
|
||||
return changePlayerNameEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEvent1<Integer> getChangeInitialMeldThresholdEvent() {
|
||||
return changeInitialMeldThresholdEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEvent getStartGameEvent() {
|
||||
return startGameEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setError(SettingsError error) {
|
||||
this.error = error;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableStartGameButton(boolean enable) {
|
||||
startButtonEnabled = enable;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableAddPlayerButton(boolean enable) {
|
||||
addPlayerButtonEnabled = enable;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableRemovePlayerButtons(boolean enable) {
|
||||
removePlayerButtonsEnabled = enable;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGameSettings(GameSettings gameSettings) {
|
||||
this.gameSettings = gameSettings;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -11,6 +11,8 @@ import jrummikub.util.MockEvent;
|
|||
*/
|
||||
public class MockView implements IView {
|
||||
/** */
|
||||
public MockSettingsPanel settingsPanel = new MockSettingsPanel();
|
||||
|
||||
public MockPlayerPanel playerPanel = new MockPlayerPanel();
|
||||
/** */
|
||||
public MockTablePanel tablePanel = new MockTablePanel();
|
||||
|
@ -86,8 +88,7 @@ public class MockView implements IView {
|
|||
|
||||
@Override
|
||||
public ISettingsPanel getSettingsPanel() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
return settingsPanel;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Reference in a new issue