Search in sources :

Example 26 with FeedPreferences

use of de.danoeh.antennapod.model.feed.FeedPreferences in project AntennaPod by AntennaPod.

the class PlaybackVolumeUpdaterTest method mockFeedMedia.

private FeedMedia mockFeedMedia() {
    FeedMedia feedMedia = mock(FeedMedia.class);
    FeedItem feedItem = mock(FeedItem.class);
    Feed feed = mock(Feed.class);
    FeedPreferences feedPreferences = mock(FeedPreferences.class);
    when(feedMedia.getItem()).thenReturn(feedItem);
    when(feedItem.getFeed()).thenReturn(feed);
    when(feed.getId()).thenReturn(FEED_ID);
    when(feed.getPreferences()).thenReturn(feedPreferences);
    return feedMedia;
}
Also used : FeedPreferences(de.danoeh.antennapod.model.feed.FeedPreferences) FeedItem(de.danoeh.antennapod.model.feed.FeedItem) FeedMedia(de.danoeh.antennapod.model.feed.FeedMedia) Feed(de.danoeh.antennapod.model.feed.Feed)

Example 27 with FeedPreferences

use of de.danoeh.antennapod.model.feed.FeedPreferences in project AntennaPod by AntennaPod.

the class PlaybackVolumeUpdaterTest method updatesPreferencesForLoadedFeedMediaIfPlayerStatusIsInitializing.

@Test
public void updatesPreferencesForLoadedFeedMediaIfPlayerStatusIsInitializing() {
    PlaybackVolumeUpdater playbackVolumeUpdater = new PlaybackVolumeUpdater();
    when(mediaPlayer.getPlayerStatus()).thenReturn(PlayerStatus.INITIALIZING);
    FeedMedia feedMedia = mockFeedMedia();
    when(mediaPlayer.getPlayable()).thenReturn(feedMedia);
    FeedPreferences feedPreferences = feedMedia.getItem().getFeed().getPreferences();
    playbackVolumeUpdater.updateVolumeIfNecessary(mediaPlayer, FEED_ID, VolumeAdaptionSetting.LIGHT_REDUCTION);
    verify(feedPreferences, times(1)).setVolumeAdaptionSetting(VolumeAdaptionSetting.LIGHT_REDUCTION);
    verify(mediaPlayer, never()).pause(anyBoolean(), anyBoolean());
    verify(mediaPlayer, never()).resume();
}
Also used : FeedPreferences(de.danoeh.antennapod.model.feed.FeedPreferences) FeedMedia(de.danoeh.antennapod.model.feed.FeedMedia) Test(org.junit.Test)

Aggregations

FeedPreferences (de.danoeh.antennapod.model.feed.FeedPreferences)27 FeedMedia (de.danoeh.antennapod.model.feed.FeedMedia)14 Feed (de.danoeh.antennapod.model.feed.Feed)8 Test (org.junit.Test)6 ArrayList (java.util.ArrayList)5 NonNull (androidx.annotation.NonNull)3 Playable (de.danoeh.antennapod.model.playback.Playable)3 Context (android.content.Context)2 Toast (android.widget.Toast)2 AlertDialog (androidx.appcompat.app.AlertDialog)2 PreferenceListDialog (de.danoeh.antennapod.fragment.preferences.dialog.PreferenceListDialog)2 FeedItem (de.danoeh.antennapod.model.feed.FeedItem)2 VolumeAdaptionSetting (de.danoeh.antennapod.model.feed.VolumeAdaptionSetting)2 File (java.io.File)2 IOException (java.io.IOException)2 UiModeManager (android.app.UiModeManager)1 Log (android.util.Log)1 MotionEvent (android.view.MotionEvent)1 View (android.view.View)1 PluralsRes (androidx.annotation.PluralsRes)1