mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
SimulationTestCase: fix Game init with Localizer
This commit is contained in:
@@ -29,22 +29,13 @@ import forge.item.IPaperCard;
|
||||
import forge.model.FModel;
|
||||
import forge.properties.ForgePreferences;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class SimulationTestCase extends TestCase {
|
||||
private static boolean initialized = false;
|
||||
|
||||
protected Game initAndCreateGame() {
|
||||
List<RegisteredPlayer> players = Lists.newArrayList();
|
||||
Deck d1 = new Deck();
|
||||
players.add(new RegisteredPlayer(d1).setPlayer(new LobbyPlayerAi("p2", null)));
|
||||
Set<AIOption> options = new HashSet<>();
|
||||
options.add(AIOption.USE_SIMULATION);
|
||||
players.add(new RegisteredPlayer(d1).setPlayer(new LobbyPlayerAi("p1", options)));
|
||||
GameRules rules = new GameRules(GameType.Constructed);
|
||||
Match match = new Match(rules, players, "Test");
|
||||
Game game = new Game(players, rules, match);
|
||||
game.setAge(GameStage.Play);
|
||||
|
||||
if (!initialized) {
|
||||
GuiBase.setInterface(new GuiDesktop());
|
||||
@@ -57,6 +48,19 @@ public class SimulationTestCase extends TestCase {
|
||||
});
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
// need to be done after FModel.initialize, or the Localizer isn't loaded yet
|
||||
List<RegisteredPlayer> players = Lists.newArrayList();
|
||||
Deck d1 = new Deck();
|
||||
players.add(new RegisteredPlayer(d1).setPlayer(new LobbyPlayerAi("p2", null)));
|
||||
Set<AIOption> options = new HashSet<>();
|
||||
options.add(AIOption.USE_SIMULATION);
|
||||
players.add(new RegisteredPlayer(d1).setPlayer(new LobbyPlayerAi("p1", options)));
|
||||
GameRules rules = new GameRules(GameType.Constructed);
|
||||
Match match = new Match(rules, players, "Test");
|
||||
Game game = new Game(players, rules, match);
|
||||
game.setAge(GameStage.Play);
|
||||
|
||||
return game;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user