Back to Exoplayer

TimelineAsserts (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/testutil/TimelineAsserts.html

latest11.8 KB
Original Source

Package com.google.android.exoplayer2.testutil

Class TimelineAsserts


public final classTimelineAssertsextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")

Assertion methods for Timeline.

Method Summary

All Methods Static Methods Concrete Methods | Modifier and Type | Method | Description | | --- | --- | --- | | static void | assertAdGroupCounts​(Timeline timeline, int... expectedAdGroupCounts) | Asserts that periods' Timeline.Period.getAdGroupCount() are set correctly. | | static void | assertEmpty​(Timeline timeline) | Assert that timeline is empty (i.e. | | static void | assertEqualNextWindowIndices​(Timeline expectedTimeline, Timeline actualTimeline, @com.google.android.exoplayer2.Player.RepeatMode int repeatMode, boolean shuffleModeEnabled) | Asserts that next window indices for each window of the actual timeline are equal to the indices of the expected timeline depending on the repeat mode and the shuffle mode. | | static void | assertEqualPreviousWindowIndices​(Timeline expectedTimeline, Timeline actualTimeline, @com.google.android.exoplayer2.Player.RepeatMode int repeatMode, boolean shuffleModeEnabled) | Asserts that previous window indices for each window of the actual timeline are equal to the indices of the expected timeline depending on the repeat mode and the shuffle mode. | | static void | assertEqualsExceptIdsAndManifest​(Timeline expectedTimeline, Timeline actualTimeline) | Asserts that timelines are equal except Timeline.Window.uid, Timeline.Window.manifest, Timeline.Period.id, and Timeline.Period.uid. | | static void | assertNextWindowIndices​(Timeline timeline, @com.google.android.exoplayer2.Player.RepeatMode int repeatMode, boolean shuffleModeEnabled, int... expectedNextWindowIndices) | Asserts that next window indices for each window depending on the repeat mode and the shuffle mode are equal to the given sequence. | | static void | assertPeriodCounts​(Timeline timeline, int... expectedPeriodCounts) | Asserts that period counts for each window are set correctly. | | static void | assertPeriodDurations​(Timeline timeline, long... durationsUs) | Asserts that the durations of the periods in the Timeline and the durations in the given sequence are equal. | | static void | assertPeriodEqualsExceptIds​(Timeline.Period expectedPeriod, Timeline.Period actualPeriod) | Asserts that periods are equal except Timeline.Period.id and Timeline.Period.uid. | | static void | assertPreviousWindowIndices​(Timeline timeline, @com.google.android.exoplayer2.Player.RepeatMode int repeatMode, boolean shuffleModeEnabled, int... expectedPreviousWindowIndices) | Asserts that previous window indices for each window depending on the repeat mode and the shuffle mode are equal to the given sequence. | | static void | assertWindowEqualsExceptUidAndManifest​(Timeline.Window expectedWindow, Timeline.Window actualWindow) | Asserts that windows are equal except Timeline.Window.uid and Timeline.Window.manifest. | | static void | assertWindowIsDynamic​(Timeline timeline, boolean... windowIsDynamic) | Asserts that window properties Timeline.Window.isDynamic are set correctly. | | static void | assertWindowTags​(Timeline timeline, @NullableType Object... expectedWindowTags) | Asserts that window tags are set correctly. |

- 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Detail

- 

assertEmpty

public static void assertEmpty​([Timeline](../Timeline.html "class in com.google.android.exoplayer2")timeline)

Assert that timeline is empty (i.e. has no windows or periods).

- 

assertWindowTags

public static void assertWindowTags​([Timeline](../Timeline.html "class in com.google.android.exoplayer2")timeline,
                                    @NullableType[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")... expectedWindowTags)

Asserts that window tags are set correctly. Parameters:timeline - The timeline to read actual window tags from.expectedWindowTags - A list of expected window tags. If a tag is unknown or not important null can be passed to skip this window.

- 

assertWindowIsDynamic

public static void assertWindowIsDynamic​([Timeline](../Timeline.html "class in com.google.android.exoplayer2")timeline,
                                         boolean... windowIsDynamic)

Asserts that window properties Timeline.Window.isDynamic are set correctly.

- 

assertPreviousWindowIndices

public static void assertPreviousWindowIndices​([Timeline](../Timeline.html "class in com.google.android.exoplayer2")timeline,[@RepeatMode](../Player.RepeatMode.html "annotation in com.google.android.exoplayer2")@com.google.android.exoplayer2.Player.RepeatMode int repeatMode,
                                               boolean shuffleModeEnabled,
                                               int... expectedPreviousWindowIndices)

Asserts that previous window indices for each window depending on the repeat mode and the shuffle mode are equal to the given sequence.

- 

assertNextWindowIndices

public static void assertNextWindowIndices​([Timeline](../Timeline.html "class in com.google.android.exoplayer2")timeline,[@RepeatMode](../Player.RepeatMode.html "annotation in com.google.android.exoplayer2")@com.google.android.exoplayer2.Player.RepeatMode int repeatMode,
                                           boolean shuffleModeEnabled,
                                           int... expectedNextWindowIndices)

Asserts that next window indices for each window depending on the repeat mode and the shuffle mode are equal to the given sequence.

- 

assertEqualPreviousWindowIndices

public static void assertEqualPreviousWindowIndices​([Timeline](../Timeline.html "class in com.google.android.exoplayer2")expectedTimeline,[Timeline](../Timeline.html "class in com.google.android.exoplayer2")actualTimeline,[@RepeatMode](../Player.RepeatMode.html "annotation in com.google.android.exoplayer2")@com.google.android.exoplayer2.Player.RepeatMode int repeatMode,
                                                    boolean shuffleModeEnabled)

Asserts that previous window indices for each window of the actual timeline are equal to the indices of the expected timeline depending on the repeat mode and the shuffle mode.

- 

assertEqualNextWindowIndices

public static void assertEqualNextWindowIndices​([Timeline](../Timeline.html "class in com.google.android.exoplayer2")expectedTimeline,[Timeline](../Timeline.html "class in com.google.android.exoplayer2")actualTimeline,[@RepeatMode](../Player.RepeatMode.html "annotation in com.google.android.exoplayer2")@com.google.android.exoplayer2.Player.RepeatMode int repeatMode,
                                                boolean shuffleModeEnabled)

Asserts that next window indices for each window of the actual timeline are equal to the indices of the expected timeline depending on the repeat mode and the shuffle mode.

- 

assertPeriodDurations

public static void assertPeriodDurations​([Timeline](../Timeline.html "class in com.google.android.exoplayer2")timeline,
                                         long... durationsUs)

Asserts that the durations of the periods in the Timeline and the durations in the given sequence are equal.

- 

assertPeriodCounts

public static void assertPeriodCounts​([Timeline](../Timeline.html "class in com.google.android.exoplayer2")timeline,
                                      int... expectedPeriodCounts)

Asserts that period counts for each window are set correctly. Also asserts that Timeline.Window.firstPeriodIndex and Timeline.Window.lastPeriodIndex are set correctly, and it asserts the correct behavior of Timeline.getNextWindowIndex(int, int, boolean).

- 

assertAdGroupCounts

public static void assertAdGroupCounts​([Timeline](../Timeline.html "class in com.google.android.exoplayer2")timeline,
                                       int... expectedAdGroupCounts)

Asserts that periods' Timeline.Period.getAdGroupCount() are set correctly.

- 

assertEqualsExceptIdsAndManifest

public static void assertEqualsExceptIdsAndManifest​([Timeline](../Timeline.html "class in com.google.android.exoplayer2")expectedTimeline,[Timeline](../Timeline.html "class in com.google.android.exoplayer2")actualTimeline)

Asserts that timelines are equal except Timeline.Window.uid, Timeline.Window.manifest, Timeline.Period.id, and Timeline.Period.uid.

- 

assertWindowEqualsExceptUidAndManifest

public static void assertWindowEqualsExceptUidAndManifest​([Timeline.Window](../Timeline.Window.html "class in com.google.android.exoplayer2")expectedWindow,[Timeline.Window](../Timeline.Window.html "class in com.google.android.exoplayer2")actualWindow)

Asserts that windows are equal except Timeline.Window.uid and Timeline.Window.manifest.

- 

assertPeriodEqualsExceptIds

public static void assertPeriodEqualsExceptIds​([Timeline.Period](../Timeline.Period.html "class in com.google.android.exoplayer2")expectedPeriod,[Timeline.Period](../Timeline.Period.html "class in com.google.android.exoplayer2")actualPeriod)

Asserts that periods are equal except Timeline.Period.id and Timeline.Period.uid.