Search in sources :

Example 16 with Player

use of com.faforever.client.player.Player in project downlords-faf-client by FAForever.

the class ChatUserItemControllerTest method testActiveGameSetsStatusToPlaying.

@Test
public void testActiveGameSetsStatusToPlaying() throws Exception {
    Player player = PlayerBuilder.create("junit").defaultValues().get();
    instance.setPlayer(player);
    assertThat(instance.statusLabel.getText(), is(""));
    player.setGame(GameBuilder.create().defaultValues().host("junit").state(GameStatus.PLAYING).get());
    WaitForAsyncUtils.waitForFxEvents();
    assertThat(instance.statusLabel.getText(), is("Playing"));
}
Also used : Player(com.faforever.client.player.Player) Test(org.junit.Test) AbstractPlainJavaFxTest(com.faforever.client.test.AbstractPlainJavaFxTest)

Example 17 with Player

use of com.faforever.client.player.Player in project downlords-faf-client by FAForever.

the class ChatUserItemControllerTest method testNullGameSetsStatusToNothing.

@Test
public void testNullGameSetsStatusToNothing() throws Exception {
    Player player = PlayerBuilder.create("junit").defaultValues().get();
    instance.setPlayer(player);
    player.setGame(GameBuilder.create().defaultValues().host("junit").state(GameStatus.PLAYING).get());
    WaitForAsyncUtils.waitForFxEvents();
    assertThat(instance.statusLabel.getText(), is("Playing"));
    player.setGame(null);
    WaitForAsyncUtils.waitForFxEvents();
    assertThat(instance.statusLabel.getText(), is(""));
}
Also used : Player(com.faforever.client.player.Player) Test(org.junit.Test) AbstractPlainJavaFxTest(com.faforever.client.test.AbstractPlainJavaFxTest)

Example 18 with Player

use of com.faforever.client.player.Player in project downlords-faf-client by FAForever.

the class ChatUserItemControllerTest method testHostedGameSetsStatusToHosting.

@Test
public void testHostedGameSetsStatusToHosting() throws Exception {
    Player player = PlayerBuilder.create("junit").defaultValues().get();
    instance.setPlayer(player);
    assertThat(instance.statusLabel.getText(), is(""));
    player.setGame(GameBuilder.create().defaultValues().host("junit").state(GameStatus.OPEN).get());
    WaitForAsyncUtils.waitForFxEvents();
    assertThat(instance.statusLabel.getText(), is("Hosting"));
}
Also used : Player(com.faforever.client.player.Player) Test(org.junit.Test) AbstractPlainJavaFxTest(com.faforever.client.test.AbstractPlainJavaFxTest)

Example 19 with Player

use of com.faforever.client.player.Player in project downlords-faf-client by FAForever.

the class AbstractChatTabControllerTest method getMessageCssClassChatOnly.

@Test
public void getMessageCssClassChatOnly() throws Exception {
    String playerName = "somePlayer";
    Player player = new Player(playerName);
    player.setSocialStatus(OTHER);
    player.setChatOnly(true);
    assertEquals(instance.getMessageCssClass(playerName), CSS_CLASS_CHAT_ONLY);
}
Also used : Player(com.faforever.client.player.Player) Matchers.emptyString(org.hamcrest.Matchers.emptyString) Test(org.junit.Test) AbstractPlainJavaFxTest(com.faforever.client.test.AbstractPlainJavaFxTest)

Example 20 with Player

use of com.faforever.client.player.Player in project downlords-faf-client by FAForever.

the class ReviewController method setReview.

public void setReview(Optional<Review> optionalReview) {
    JavaFxUtil.assertApplicationThread();
    this.review = optionalReview;
    if (!optionalReview.isPresent()) {
        editReviewPane.setVisible(true);
        displayReviewPane.setVisible(false);
        return;
    }
    Player currentPlayer = playerService.getCurrentPlayer().orElseThrow(() -> new IllegalStateException("No player is available"));
    Review definiteReview = optionalReview.get();
    boolean isReviewOwnedByCurrentUser = currentPlayer.equals(definiteReview.getPlayer());
    int rating = definiteReview.getScore();
    selectionStarsController.setValue(rating);
    displayStarsController.setValue(rating);
    usernameLabel.setText(definiteReview.getPlayer().getUsername());
    reviewTextLabel.setText(definiteReview.getText());
    displayReviewPane.setVisible(true);
    editReviewPane.setVisible(false);
    editButton.setVisible(isReviewOwnedByCurrentUser);
    deleteButton.setVisible(isReviewOwnedByCurrentUser);
}
Also used : Player(com.faforever.client.player.Player)

Aggregations

Player (com.faforever.client.player.Player)51 AbstractPlainJavaFxTest (com.faforever.client.test.AbstractPlainJavaFxTest)17 Test (org.junit.Test)17 Pane (javafx.scene.layout.Pane)8 I18n (com.faforever.client.i18n.I18n)7 PlayerService (com.faforever.client.player.PlayerService)7 UiService (com.faforever.client.theme.UiService)7 ClientProperties (com.faforever.client.config.ClientProperties)6 Controller (com.faforever.client.fx.Controller)6 ArrayList (java.util.ArrayList)6 Platform (javafx.application.Platform)6 Node (javafx.scene.Node)6 Scope (org.springframework.context.annotation.Scope)6 Component (org.springframework.stereotype.Component)6 JavaFxUtil (com.faforever.client.fx.JavaFxUtil)5 NotificationService (com.faforever.client.notification.NotificationService)5 TimeService (com.faforever.client.util.TimeService)5 Collection (java.util.Collection)5 List (java.util.List)5 Map (java.util.Map)5