1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-22 13:23:03 +08:00

Ensure virtual track time is long enough for test beatmaps

This commit is contained in:
Dean Herbert 2020-10-05 13:17:13 +09:00
parent e41085dbb5
commit a8cbd400d3
2 changed files with 8 additions and 7 deletions

View File

@ -180,9 +180,8 @@ namespace osu.Game.Tests.Beatmaps
private readonly BeatmapInfo skinBeatmapInfo; private readonly BeatmapInfo skinBeatmapInfo;
private readonly IResourceStore<byte[]> resourceStore; private readonly IResourceStore<byte[]> resourceStore;
public TestWorkingBeatmap(BeatmapInfo skinBeatmapInfo, IResourceStore<byte[]> resourceStore, IBeatmap beatmap, Storyboard storyboard, IFrameBasedClock referenceClock, AudioManager audio, public TestWorkingBeatmap(BeatmapInfo skinBeatmapInfo, IResourceStore<byte[]> resourceStore, IBeatmap beatmap, Storyboard storyboard, IFrameBasedClock referenceClock, AudioManager audio)
double length = 60000) : base(beatmap, storyboard, referenceClock, audio)
: base(beatmap, storyboard, referenceClock, audio, length)
{ {
this.skinBeatmapInfo = skinBeatmapInfo; this.skinBeatmapInfo = skinBeatmapInfo;
this.resourceStore = resourceStore; this.resourceStore = resourceStore;

View File

@ -23,6 +23,7 @@ using osu.Game.Online.API;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
using osu.Game.Screens; using osu.Game.Screens;
using osu.Game.Storyboards; using osu.Game.Storyboards;
@ -222,18 +223,19 @@ namespace osu.Game.Tests.Visual
/// <param name="storyboard">The storyboard.</param> /// <param name="storyboard">The storyboard.</param>
/// <param name="referenceClock">An optional clock which should be used instead of a stopwatch for virtual time progression.</param> /// <param name="referenceClock">An optional clock which should be used instead of a stopwatch for virtual time progression.</param>
/// <param name="audio">Audio manager. Required if a reference clock isn't provided.</param> /// <param name="audio">Audio manager. Required if a reference clock isn't provided.</param>
/// <param name="length">The length of the returned virtual track.</param> public ClockBackedTestWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard, IFrameBasedClock referenceClock, AudioManager audio)
public ClockBackedTestWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard, IFrameBasedClock referenceClock, AudioManager audio, double length = 60000)
: base(beatmap, storyboard, audio) : base(beatmap, storyboard, audio)
{ {
double lastObjectTime = beatmap.HitObjects.LastOrDefault()?.GetEndTime() ?? 60000;
if (referenceClock != null) if (referenceClock != null)
{ {
store = new TrackVirtualStore(referenceClock); store = new TrackVirtualStore(referenceClock);
audio.AddItem(store); audio.AddItem(store);
track = store.GetVirtual(length); track = store.GetVirtual(lastObjectTime);
} }
else else
track = audio?.Tracks.GetVirtual(length); track = audio?.Tracks.GetVirtual(lastObjectTime);
} }
~ClockBackedTestWorkingBeatmap() ~ClockBackedTestWorkingBeatmap()