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"));
}
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(""));
}
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"));
}
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);
}
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);
}
Aggregations