use of com.faforever.client.api.dto.PlayerAchievement in project downlords-faf-client by FAForever.
the class AchievementItemControllerTest method testSetPlayerAchievementStandardDoesntUpdateProgress.
@Test
public void testSetPlayerAchievementStandardDoesntUpdateProgress() throws Exception {
instance.setAchievementDefinition(AchievementDefinitionBuilder.create().defaultValues().type(AchievementType.STANDARD).get());
PlayerAchievement playerAchievement = PlayerAchievementBuilder.create().defaultValues().state(com.faforever.client.api.dto.AchievementState.UNLOCKED).currentSteps(50).get();
instance.setPlayerAchievement(playerAchievement);
assertThat(instance.progressBar.getProgress(), is(0.0));
}
use of com.faforever.client.api.dto.PlayerAchievement in project downlords-faf-client by FAForever.
the class AchievementItemControllerTest method testSetPlayerAchievementIdDoesntMatch.
@Test(expected = IllegalStateException.class)
public void testSetPlayerAchievementIdDoesntMatch() throws Exception {
instance.setAchievementDefinition(AchievementDefinitionBuilder.create().defaultValues().get());
PlayerAchievement playerAchievement = PlayerAchievementBuilder.create().defaultValues().achievementId("foobar").get();
instance.setPlayerAchievement(playerAchievement);
}
use of com.faforever.client.api.dto.PlayerAchievement in project downlords-faf-client by FAForever.
the class UserInfoWindowController method updatePlayerAchievements.
private void updatePlayerAchievements(List<? extends PlayerAchievement> playerAchievements) {
PlayerAchievement mostRecentPlayerAchievement = null;
ObservableList<Node> children = unlockedAchievementsContainer.getChildren();
Platform.runLater(children::clear);
for (PlayerAchievement playerAchievement : playerAchievements) {
AchievementItemController achievementItemController = achievementItemById.get(playerAchievement.getAchievement().getId());
achievementItemController.setPlayerAchievement(playerAchievement);
if (isUnlocked(playerAchievement)) {
Platform.runLater(() -> children.add(achievementItemController.getRoot()));
if (mostRecentPlayerAchievement == null || playerAchievement.getUpdateTime().compareTo(mostRecentPlayerAchievement.getUpdateTime()) > 0) {
mostRecentPlayerAchievement = playerAchievement;
}
}
}
if (mostRecentPlayerAchievement == null) {
mostRecentAchievementPane.setVisible(false);
} else {
mostRecentAchievementPane.setVisible(true);
AchievementDefinition mostRecentAchievement = achievementDefinitionById.get(mostRecentPlayerAchievement.getAchievement().getId());
if (mostRecentAchievement == null) {
return;
}
String mostRecentAchievementName = mostRecentAchievement.getName();
String mostRecentAchievementDescription = mostRecentAchievement.getDescription();
Platform.runLater(() -> {
mostRecentAchievementNameLabel.setText(mostRecentAchievementName);
mostRecentAchievementDescriptionLabel.setText(mostRecentAchievementDescription);
mostRecentAchievementImageView.setImage(achievementService.getImage(mostRecentAchievement, UNLOCKED));
});
}
}
use of com.faforever.client.api.dto.PlayerAchievement in project downlords-faf-client by FAForever.
the class AchievementServiceImplTest method testGetPlayerAchievementsForCurrentUser.
@Test
public void testGetPlayerAchievementsForCurrentUser() throws Exception {
instance.playerAchievements.add(new PlayerAchievement());
instance.getPlayerAchievements(PLAYER_ID);
verify(fafService).addOnMessageListener(ArgumentMatchers.any(), ArgumentMatchers.any());
verifyNoMoreInteractions(fafService);
}
use of com.faforever.client.api.dto.PlayerAchievement in project downlords-faf-client by FAForever.
the class AchievementItemControllerTest method testSetPlayerAchievementRevealed.
@Test
public void testSetPlayerAchievementRevealed() throws Exception {
instance.setAchievementDefinition(AchievementDefinitionBuilder.create().defaultValues().get());
PlayerAchievement playerAchievement = PlayerAchievementBuilder.create().defaultValues().state(com.faforever.client.api.dto.AchievementState.REVEALED).get();
instance.setPlayerAchievement(playerAchievement);
assertThat(instance.imageView.getEffect(), is(instanceOf(ColorAdjust.class)));
assertThat(instance.imageView.getOpacity(), is(0.5));
}
Aggregations