mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2024-12-27 17:23:54 +01:00
android Test to ensure smart as played won't affect an item when it is paused.
This commit is contained in:
parent
cf5f0fbc28
commit
1ab39fee3c
@ -13,6 +13,11 @@ import android.widget.ListView;
|
||||
import com.robotium.solo.Solo;
|
||||
import com.robotium.solo.Timeout;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import de.danoeh.antennapod.R;
|
||||
@ -24,10 +29,6 @@ import de.danoeh.antennapod.core.service.playback.PlayerStatus;
|
||||
import de.danoeh.antennapod.core.storage.DBReader;
|
||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||
import de.danoeh.antennapod.core.storage.PodDBAdapter;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.Matchers.hasItems;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
@ -117,6 +118,11 @@ public class PlaybackTest {
|
||||
context.sendBroadcast(skipIntent);
|
||||
}
|
||||
|
||||
private void pauseEpisode() {
|
||||
Intent pauseIntent = new Intent(PlaybackService.ACTION_PAUSE_PLAY_CURRENT_EPISODE);
|
||||
context.sendBroadcast(pauseIntent);
|
||||
}
|
||||
|
||||
private void startLocalPlayback() {
|
||||
openNavDrawer();
|
||||
// if we try to just click on plain old text then
|
||||
@ -334,4 +340,28 @@ public class PlaybackTest {
|
||||
assertThat(DBReader.getFeedItem(feedItem.getId()).isPlayed(), is(true));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSmartMarkAsPlayed_Pause_WontAffectItem() throws Exception {
|
||||
setSmartMarkAsPlayedPreference(60);
|
||||
|
||||
uiTestUtils.addLocalFeedData(true);
|
||||
|
||||
final int fiIdx = 0;
|
||||
final FeedItem feedItem = DBReader.getQueue().get(fiIdx);
|
||||
|
||||
gotoQueueScreen();
|
||||
playFromQueue(fiIdx);
|
||||
|
||||
// let playback run a bit then pause
|
||||
Thread.sleep(500);
|
||||
pauseEpisode();
|
||||
Thread.sleep(1000); // ensure the pause is processed
|
||||
|
||||
// assert item no longer in queue
|
||||
assertThat("Ensure even with smart mark as play, after pause, the item remains in the queue.",
|
||||
DBReader.getQueue(), hasItems(feedItem));
|
||||
assertThat("Ensure even with smart mark as play, after pause, the item played status remains false.",
|
||||
DBReader.getFeedItem(feedItem.getId()).isPlayed(), is(false));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user