mirror of
https://github.com/samsonjs/media.git
synced 2026-03-25 09:25:53 +00:00
Fix Timeline.toBundle for empty timeline
PiperOrigin-RevId: 364513299
This commit is contained in:
parent
bb1261da3c
commit
3fbfc0ec0e
2 changed files with 8 additions and 1 deletions
|
|
@ -1291,7 +1291,9 @@ public abstract class Timeline implements Bundleable {
|
|||
}
|
||||
|
||||
int[] shuffledWindowIndices = new int[windowCount];
|
||||
shuffledWindowIndices[0] = getFirstWindowIndex(/* shuffleModeEnabled= */ true);
|
||||
if (windowCount > 0) {
|
||||
shuffledWindowIndices[0] = getFirstWindowIndex(/* shuffleModeEnabled= */ true);
|
||||
}
|
||||
for (int i = 1; i < windowCount; i++) {
|
||||
shuffledWindowIndices[i] =
|
||||
getNextWindowIndex(
|
||||
|
|
|
|||
|
|
@ -278,6 +278,11 @@ public class TimelineTest {
|
|||
timeline, restoredTimeline, Player.REPEAT_MODE_ALL, /* shuffleModeEnabled= */ true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void roundtripViaBundle_ofEmptyTimeline_returnsEmptyTimeline() {
|
||||
TimelineAsserts.assertEmpty(Timeline.CREATOR.fromBundle(Timeline.EMPTY.toBundle()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void roundtripViaBundle_ofWindow_yieldsEqualInstanceExceptUidAndManifest() {
|
||||
Timeline.Window window = new Timeline.Window();
|
||||
|
|
|
|||
Loading…
Reference in a new issue