1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-31 21:33:22 +08:00

Use non-zero length for fallback virtual track (allows tests to work as expected)

This commit is contained in:
Dean Herbert 2020-02-09 21:34:56 +09:00
parent c1f52ef594
commit 96574a98ad

View File

@ -39,7 +39,7 @@ namespace osu.Game.Beatmaps
BeatmapSetInfo = beatmapInfo.BeatmapSet; BeatmapSetInfo = beatmapInfo.BeatmapSet;
Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo?.Metadata ?? new BeatmapMetadata(); Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo?.Metadata ?? new BeatmapMetadata();
track = new RecyclableLazy<Track>(() => GetTrack() ?? GetVirtualTrack()); track = new RecyclableLazy<Track>(() => GetTrack() ?? GetVirtualTrack(1000));
background = new RecyclableLazy<Texture>(GetBackground, BackgroundStillValid); background = new RecyclableLazy<Texture>(GetBackground, BackgroundStillValid);
waveform = new RecyclableLazy<Waveform>(GetWaveform); waveform = new RecyclableLazy<Waveform>(GetWaveform);
storyboard = new RecyclableLazy<Storyboard>(GetStoryboard); storyboard = new RecyclableLazy<Storyboard>(GetStoryboard);
@ -48,7 +48,7 @@ namespace osu.Game.Beatmaps
total_count.Value++; total_count.Value++;
} }
protected virtual Track GetVirtualTrack() protected virtual Track GetVirtualTrack(double emptyLength = 0)
{ {
const double excess_length = 1000; const double excess_length = 1000;
@ -59,7 +59,7 @@ namespace osu.Game.Beatmaps
switch (lastObject) switch (lastObject)
{ {
case null: case null:
length = 0; length = emptyLength;
break; break;
case IHasEndTime endTime: case IHasEndTime endTime: