Search in sources :

Example 11 with Preferences

use of com.faforever.client.preferences.Preferences in project downlords-faf-client by FAForever.

the class AudioServiceImplTest method start.

@Override
public void start(Stage stage) throws Exception {
    instance = new AudioServiceImpl(preferencesService, audioClipPlayer, uiService);
    Preferences preferences = new Preferences();
    notificationsPrefs = preferences.getNotification();
    when(preferencesService.getPreferences()).thenReturn(preferences);
    when(uiService.getThemeFileUrl(any())).thenReturn(getThemeFileUrl(UiService.MENTION_SOUND));
    instance.postConstruct();
    super.start(stage);
}
Also used : Preferences(com.faforever.client.preferences.Preferences)

Example 12 with Preferences

use of com.faforever.client.preferences.Preferences in project downlords-faf-client by FAForever.

the class ChatUserItemControllerTest method setUp.

@Before
public void setUp() throws Exception {
    instance = new ChatUserItemController(preferencesService, avatarService, countryFlagService, chatService, i18n, uiService, joinGameHelper, eventBus, clanService, playerService, platformService);
    Preferences preferences = new Preferences();
    when(preferencesService.getPreferences()).thenReturn(preferences);
    when(chatService.getOrCreateChatUser("junit")).thenReturn(new ChatUser("junit", null));
    when(i18n.get(eq("user.status.hosting"), anyString())).thenReturn("Hosting");
    when(i18n.get(eq("user.status.waiting"), anyString())).thenReturn("Waiting");
    when(i18n.get(eq("user.status.playing"), anyString())).thenReturn("Playing");
    when(clanService.getClanByTag(anyString())).thenReturn(CompletableFuture.completedFuture(Optional.of(new Clan())));
    loadFxml("theme/chat/chat_user_item.fxml", param -> instance);
}
Also used : Clan(com.faforever.client.clan.Clan) Preferences(com.faforever.client.preferences.Preferences) Before(org.junit.Before)

Example 13 with Preferences

use of com.faforever.client.preferences.Preferences in project downlords-faf-client by FAForever.

the class ChannelTabControllerTest method setUp.

@Before
public void setUp() throws Exception {
    Vault vault = new Vault();
    vault.setReplayDownloadUrlFormat("test.de");
    when(clientProperties.getVault()).thenReturn(vault);
    instance = new ChannelTabController(clanService, userService, chatService, platformService, preferencesService, playerService, audioService, timeService, i18n, imageUploadService, urlPreviewResolver, notificationService, reportingService, uiService, autoCompletionHelper, eventBus, webViewConfigurer, threadPoolExecutor, taskScheduler, countryFlagService, replayService, clientProperties, externalReplayInfoGenerator);
    when(preferencesService.getPreferences()).thenReturn(new Preferences());
    when(userService.getUsername()).thenReturn(USER_NAME);
    when(uiService.loadFxml("theme/chat/user_filter.fxml")).thenReturn(userFilterController);
    when(uiService.loadFxml("theme/chat/chat_user_item.fxml")).thenReturn(chatUserItemController);
    when(userFilterController.getRoot()).thenReturn(new Pane());
    when(chatUserItemController.getRoot()).thenReturn(new Pane());
    when(uiService.getThemeFileUrl(CHAT_CONTAINER)).thenReturn(getClass().getResource("/theme/chat/chat_container.html"));
    loadFxml("theme/chat/channel_tab.fxml", clazz -> instance);
    TabPane tabPane = new TabPane();
    tabPane.getTabs().add(instance.getRoot());
    WaitForAsyncUtils.waitForAsyncFx(5000, () -> getRoot().getChildren().add(tabPane));
}
Also used : TabPane(javafx.scene.control.TabPane) Vault(com.faforever.client.config.ClientProperties.Vault) Preferences(com.faforever.client.preferences.Preferences) TabPane(javafx.scene.control.TabPane) Pane(javafx.scene.layout.Pane) Before(org.junit.Before)

Example 14 with Preferences

use of com.faforever.client.preferences.Preferences in project downlords-faf-client by FAForever.

the class ChatUserContextMenuControllerTest method setUp.

@Before
public void setUp() throws Exception {
    instance = new ChatUserContextMenuController(userService, chatService, preferencesService, playerService, gameService, replayService, notificationService, i18n, eventBus, joinGameHelper, avatarService, uiService);
    Preferences preferences = mock(Preferences.class);
    ChatPrefs chatPrefs = mock(ChatPrefs.class);
    ObjectProperty<ChatColorMode> chatColorModeObjectProperty = new SimpleObjectProperty<>();
    when(preferencesService.getPreferences()).thenReturn(preferences);
    when(preferences.getChat()).thenReturn(chatPrefs);
    when(chatPrefs.getUserToColor()).thenReturn(mock(ObservableMap.class));
    when(chatPrefs.chatColorModeProperty()).thenReturn(chatColorModeObjectProperty);
    when(avatarService.getAvailableAvatars()).thenReturn(CompletableFuture.completedFuture(Arrays.asList(new AvatarBean(new URL("http://www.example.com/avatar1.png"), "Avatar Number #1"), new AvatarBean(new URL("http://www.example.com/avatar2.png"), "Avatar Number #2"), new AvatarBean(new URL("http://www.example.com/avatar3.png"), "Avatar Number #3"))));
    loadFxml("theme/chat/chat_user_context_menu.fxml", clazz -> instance);
    player = PlayerBuilder.create(TEST_USER_NAME).socialStatus(SELF).avatar(null).game(new Game()).get();
    instance.setPlayer(player);
}
Also used : SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) Game(com.faforever.client.game.Game) ChatPrefs(com.faforever.client.preferences.ChatPrefs) AvatarBean(com.faforever.client.chat.avatar.AvatarBean) ObservableMap(javafx.collections.ObservableMap) Preferences(com.faforever.client.preferences.Preferences) URL(java.net.URL) Before(org.junit.Before)

Example 15 with Preferences

use of com.faforever.client.preferences.Preferences in project downlords-faf-client by FAForever.

the class CreateGameControllerTest method setUp.

@Before
public void setUp() throws Exception {
    instance = new CreateGameController(fafService, mapService, modService, gameService, preferencesService, i18n, notificationService, reportingService);
    mapList = FXCollections.observableArrayList();
    preferences = new Preferences();
    preferences.getForgedAlliance().setPath(Paths.get("."));
    when(preferencesService.getPreferences()).thenReturn(preferences);
    when(mapService.getInstalledMaps()).thenReturn(mapList);
    when(modService.getFeaturedMods()).thenReturn(CompletableFuture.completedFuture(emptyList()));
    when(modService.getInstalledModVersions()).thenReturn(FXCollections.observableList(emptyList()));
    when(mapService.loadPreview(anyString(), any())).thenReturn(new Image("/theme/images/close.png"));
    when(fafService.connectionStateProperty()).thenReturn(new SimpleObjectProperty<>(ConnectionState.CONNECTED));
    loadFxml("theme/play/create_game.fxml", clazz -> instance);
}
Also used : Preferences(com.faforever.client.preferences.Preferences) Image(javafx.scene.image.Image) Before(org.junit.Before)

Aggregations

Preferences (com.faforever.client.preferences.Preferences)21 Before (org.junit.Before)16 Pane (javafx.scene.layout.Pane)6 ClientProperties (com.faforever.client.config.ClientProperties)3 Clan (com.faforever.client.clan.Clan)2 Vault (com.faforever.client.config.ClientProperties.Vault)2 NumberFormat (java.text.NumberFormat)2 TabPane (javafx.scene.control.TabPane)2 NumberStringConverter (javafx.util.converter.NumberStringConverter)2 ChatColorMode (com.faforever.client.chat.ChatColorMode)1 AvatarBean (com.faforever.client.chat.avatar.AvatarBean)1 ClanTooltipController (com.faforever.client.clan.ClanTooltipController)1 Website (com.faforever.client.config.ClientProperties.Website)1 Controller (com.faforever.client.fx.Controller)1 PATH_STRING_CONVERTER (com.faforever.client.fx.JavaFxUtil.PATH_STRING_CONVERTER)1 StringListCell (com.faforever.client.fx.StringListCell)1 Game (com.faforever.client.game.Game)1 I18n (com.faforever.client.i18n.I18n)1 Action (com.faforever.client.notification.Action)1 NotificationService (com.faforever.client.notification.NotificationService)1