Search in sources :

Example 1 with PreferencesService

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

the class PrivateChatTabControllerTest method setUp.

@Before
public void setUp() throws IOException {
    Vault vault = new Vault();
    vault.setReplayDownloadUrlFormat("test.de");
    when(clientProperties.getVault()).thenReturn(vault);
    PreferencesService preferencesService = new PreferencesService();
    preferencesService.postConstruct();
    preferencesService.getPreferences().getMainWindow().setLastView(NavigationItem.CHAT.name());
    instance = new PrivateChatTabController(clanService, userService, platformService, preferencesService, playerService, timeService, i18n, imageUploadService, urlPreviewResolver, notificationService, reportingService, uiService, autoCompletionHelper, eventBus, audioService, chatService, mapService, webViewConfigurer, countryFlagService, replayService, clientProperties, externalReplayInfoGenerator);
    playerName = "testUser";
    Player player = new Player(playerName);
    when(playerService.getPlayerForUsername(playerName)).thenReturn(player);
    when(userService.getUsername()).thenReturn(playerName);
    when(uiService.getThemeFileUrl(CHAT_CONTAINER)).then(invocation -> getThemeFileUrl(invocation.getArgument(0)));
    TabPane tabPane = new TabPane();
    tabPane.setSkin(new TabPaneSkin(tabPane));
    loadFxml("theme/chat/private_chat_tab.fxml", clazz -> {
        if (clazz == PrivateUserInfoController.class) {
            return privateUserInfoController;
        }
        if (clazz == GameDetailController.class) {
            return gameDetailController;
        }
        if (clazz == WatchButtonController.class) {
            return watchButtonController;
        }
        return instance;
    });
    instance.setReceiver(playerName);
    WaitForAsyncUtils.asyncFx(() -> {
        getRoot().getChildren().setAll(tabPane);
        tabPane.getTabs().add(instance.getRoot());
    });
    WaitForAsyncUtils.waitForFxEvents();
    verify(webViewConfigurer).configureWebView(instance.messagesWebView);
}
Also used : TabPane(javafx.scene.control.TabPane) Player(com.faforever.client.player.Player) Vault(com.faforever.client.config.ClientProperties.Vault) TabPaneSkin(com.sun.javafx.scene.control.skin.TabPaneSkin) PreferencesService(com.faforever.client.preferences.PreferencesService) Before(org.junit.Before)

Example 2 with PreferencesService

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

the class GamePathHandlerTest method setUp.

@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    PreferencesService preferenceService = new PreferencesService();
    instance = new GamePathHandler(notificationService, i18n, eventBus, preferenceService);
}
Also used : PreferencesService(com.faforever.client.preferences.PreferencesService) Before(org.junit.Before)

Example 3 with PreferencesService

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

the class TransientNotificationControllerTest method setUp.

@Before
public void setUp() throws Exception {
    PreferencesService preferencesService = new PreferencesService();
    preferencesService.postConstruct();
    instance = new TransientNotificationController(preferencesService);
    loadFxml("theme/transient_notification.fxml", clazz -> instance);
}
Also used : PreferencesService(com.faforever.client.preferences.PreferencesService) Before(org.junit.Before)

Aggregations

PreferencesService (com.faforever.client.preferences.PreferencesService)3 Before (org.junit.Before)3 Vault (com.faforever.client.config.ClientProperties.Vault)1 Player (com.faforever.client.player.Player)1 TabPaneSkin (com.sun.javafx.scene.control.skin.TabPaneSkin)1 TabPane (javafx.scene.control.TabPane)1