Search in sources :

Example 1 with UnshuffledShuffleOrder

use of com.google.android.exoplayer2.source.ShuffleOrder.UnshuffledShuffleOrder in project ExoPlayer by google.

the class ShuffleOrderTest method unshuffledShuffleOrderIsUnshuffled.

@Test
public void unshuffledShuffleOrderIsUnshuffled() {
    ShuffleOrder shuffleOrder = new UnshuffledShuffleOrder(5);
    assertThat(shuffleOrder.getFirstIndex()).isEqualTo(0);
    assertThat(shuffleOrder.getLastIndex()).isEqualTo(4);
    for (int i = 0; i < 4; i++) {
        assertThat(shuffleOrder.getNextIndex(i)).isEqualTo(i + 1);
    }
}
Also used : DefaultShuffleOrder(com.google.android.exoplayer2.source.ShuffleOrder.DefaultShuffleOrder) UnshuffledShuffleOrder(com.google.android.exoplayer2.source.ShuffleOrder.UnshuffledShuffleOrder) UnshuffledShuffleOrder(com.google.android.exoplayer2.source.ShuffleOrder.UnshuffledShuffleOrder) Test(org.junit.Test)

Example 2 with UnshuffledShuffleOrder

use of com.google.android.exoplayer2.source.ShuffleOrder.UnshuffledShuffleOrder in project ExoPlayer by google.

the class ShuffleOrderTest method unshuffledShuffleOrder.

@Test
public void unshuffledShuffleOrder() {
    assertShuffleOrderCorrectness(new UnshuffledShuffleOrder(0), 0);
    assertShuffleOrderCorrectness(new UnshuffledShuffleOrder(1), 1);
    assertShuffleOrderCorrectness(new UnshuffledShuffleOrder(5), 5);
    for (int initialLength = 0; initialLength < 4; initialLength++) {
        for (int insertionPoint = 0; insertionPoint <= initialLength; insertionPoint += 2) {
            testCloneAndInsert(new UnshuffledShuffleOrder(initialLength), insertionPoint, 0);
            testCloneAndInsert(new UnshuffledShuffleOrder(initialLength), insertionPoint, 1);
            testCloneAndInsert(new UnshuffledShuffleOrder(initialLength), insertionPoint, 5);
        }
    }
    testCloneAndRemove(new UnshuffledShuffleOrder(5), 0, 1);
    testCloneAndRemove(new UnshuffledShuffleOrder(5), 2, 3);
    testCloneAndRemove(new UnshuffledShuffleOrder(5), 4, 5);
    testCloneAndRemove(new UnshuffledShuffleOrder(1), 0, 1);
    testCloneAndRemove(new UnshuffledShuffleOrder(1000), 0, 1000);
    testCloneAndRemove(new UnshuffledShuffleOrder(1000), 0, 999);
    testCloneAndRemove(new UnshuffledShuffleOrder(1000), 0, 500);
    testCloneAndRemove(new UnshuffledShuffleOrder(1000), 100, 600);
    testCloneAndRemove(new UnshuffledShuffleOrder(1000), 500, 1000);
}
Also used : UnshuffledShuffleOrder(com.google.android.exoplayer2.source.ShuffleOrder.UnshuffledShuffleOrder) Test(org.junit.Test)

Aggregations

UnshuffledShuffleOrder (com.google.android.exoplayer2.source.ShuffleOrder.UnshuffledShuffleOrder)2 Test (org.junit.Test)2 DefaultShuffleOrder (com.google.android.exoplayer2.source.ShuffleOrder.DefaultShuffleOrder)1