mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +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];
|
int[] shuffledWindowIndices = new int[windowCount];
|
||||||
|
if (windowCount > 0) {
|
||||||
shuffledWindowIndices[0] = getFirstWindowIndex(/* shuffleModeEnabled= */ true);
|
shuffledWindowIndices[0] = getFirstWindowIndex(/* shuffleModeEnabled= */ true);
|
||||||
|
}
|
||||||
for (int i = 1; i < windowCount; i++) {
|
for (int i = 1; i < windowCount; i++) {
|
||||||
shuffledWindowIndices[i] =
|
shuffledWindowIndices[i] =
|
||||||
getNextWindowIndex(
|
getNextWindowIndex(
|
||||||
|
|
|
||||||
|
|
@ -278,6 +278,11 @@ public class TimelineTest {
|
||||||
timeline, restoredTimeline, Player.REPEAT_MODE_ALL, /* shuffleModeEnabled= */ true);
|
timeline, restoredTimeline, Player.REPEAT_MODE_ALL, /* shuffleModeEnabled= */ true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void roundtripViaBundle_ofEmptyTimeline_returnsEmptyTimeline() {
|
||||||
|
TimelineAsserts.assertEmpty(Timeline.CREATOR.fromBundle(Timeline.EMPTY.toBundle()));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void roundtripViaBundle_ofWindow_yieldsEqualInstanceExceptUidAndManifest() {
|
public void roundtripViaBundle_ofWindow_yieldsEqualInstanceExceptUidAndManifest() {
|
||||||
Timeline.Window window = new Timeline.Window();
|
Timeline.Window window = new Timeline.Window();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue