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