Ensure CurrentTrack is never null

This commit is contained in:
smoogipoo
2020-08-07 19:43:16 +09:00
parent bf21fdd6da
commit 61b632516e
10 changed files with 8 additions and 22 deletions

View File

@ -95,10 +95,7 @@ namespace osu.Game.Tests.Visual.Editing
base.Update();
if (musicController.TrackLoaded)
{
Debug.Assert(musicController.CurrentTrack != null);
marker.X = (float)(editorClock.CurrentTime / musicController.CurrentTrack.Length);
}
}
}

View File

@ -136,8 +136,8 @@ namespace osu.Game.Tests.Visual.Navigation
AddUntilStep("Wait for music controller", () => Game.MusicController.IsLoaded);
AddStep("Seek close to end", () =>
{
Game.MusicController.SeekTo(MusicController.CurrentTrack.AsNonNull().Length - 1000);
MusicController.CurrentTrack.AsNonNull().Completed += () => trackCompleted = true;
Game.MusicController.SeekTo(MusicController.CurrentTrack.Length - 1000);
MusicController.CurrentTrack.Completed += () => trackCompleted = true;
});
AddUntilStep("Track was completed", () => trackCompleted);

View File

@ -169,7 +169,7 @@ namespace osu.Game.Tests.Visual.UserInterface
if (timingPoints.Count == 0) return 0;
if (timingPoints[^1] == current)
return (int)Math.Ceiling((musicController.CurrentTrack.AsNonNull().Length - current.Time) / current.BeatLength);
return (int)Math.Ceiling((musicController.CurrentTrack.Length - current.Time) / current.BeatLength);
return (int)Math.Ceiling((getNextTimingPoint(current).Time - current.Time) / current.BeatLength);
}