Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Schinc committed Apr 23, 2024
1 parent a965396 commit b75b8aa
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions ChickenAttackerPlayersUITest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package ch.epfl.chacun;

import ch.epfl.chacun.gui.PlayersUI;
import ch.epfl.chacun.tile.Tiles;
import javafx.application.Application;
import javafx.beans.property.SimpleObjectProperty;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;

import java.util.Map;
import java.util.stream.Collectors;

public final class ChickenAttackerPlayersUITest extends Application {
public static void main(String[] args) { launch(args); }

@Override
public void start(Stage primaryStage) {
var playerNames = Map.of(PlayerColor.RED, "Rose",
PlayerColor.BLUE, "Bernard");
var playerColors = playerNames.keySet().stream()
.sorted()
.toList();

var tilesByKind = Tiles.TILES.stream()
.collect(Collectors.groupingBy(Tile::kind));
var tileDecks =
new TileDecks(tilesByKind.get(Tile.Kind.START),
tilesByKind.get(Tile.Kind.NORMAL),
tilesByKind.get(Tile.Kind.MENHIR));

var textMaker = new TextMakerFr(playerNames);

var gameState =
GameState.initial(playerColors,
tileDecks,
textMaker);

var gameStateO = new SimpleObjectProperty<>(gameState);

var playersNode = PlayersUI.create(gameStateO, textMaker);
var rootNode = new BorderPane(playersNode);
primaryStage.setScene(new Scene(rootNode));

primaryStage.setTitle("ChaCuN test");
primaryStage.show();
}
}

0 comments on commit b75b8aa

Please sign in to comment.