1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Reduce calls to LoadTrack by implicitly running on test/dummy classes

This commit is contained in:
Dean Herbert 2022-07-28 17:58:13 +09:00
parent 628a30193f
commit a21aee4e9c
7 changed files with 14 additions and 12 deletions

View File

@ -41,8 +41,6 @@ namespace osu.Game.Tests.Gameplay
AddStep("create container", () =>
{
var working = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
working.LoadTrack();
Child = gameplayClockContainer = new MasterGameplayClockContainer(working, 0);
});
@ -58,8 +56,6 @@ namespace osu.Game.Tests.Gameplay
AddStep("create container", () =>
{
var working = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
working.LoadTrack();
Child = gameplayClockContainer = new MasterGameplayClockContainer(working, 0);
});
@ -102,8 +98,6 @@ namespace osu.Game.Tests.Gameplay
AddStep("create container", () =>
{
working = new ClockBackedTestWorkingBeatmap(new OsuRuleset().RulesetInfo, new FramedClock(new ManualClock()), Audio);
working.LoadTrack();
Child = gameplayClockContainer = new MasterGameplayClockContainer(working, 0);
gameplayClockContainer.Reset(startClock: !whileStopped);

View File

@ -69,7 +69,6 @@ namespace osu.Game.Tests.Gameplay
AddStep("create container", () =>
{
var working = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
working.LoadTrack();
Add(gameplayContainer = new MasterGameplayClockContainer(working, 0)
{
@ -96,7 +95,6 @@ namespace osu.Game.Tests.Gameplay
AddStep("create container", () =>
{
var working = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
working.LoadTrack();
const double start_time = 1000;

View File

@ -32,7 +32,6 @@ namespace osu.Game.Tests.Skins
imported?.PerformRead(s =>
{
beatmap = beatmaps.GetWorkingBeatmap(s.Beatmaps[0]);
beatmap.LoadTrack();
});
}
@ -40,6 +39,10 @@ namespace osu.Game.Tests.Skins
public void TestRetrieveOggSample() => AddAssert("sample is non-null", () => beatmap.Skin.GetSample(new SampleInfo("sample")) != null);
[Test]
public void TestRetrieveOggTrack() => AddAssert("track is non-null", () => !(beatmap.Track is TrackVirtual));
public void TestRetrieveOggTrack() => AddAssert("track is non-null", () =>
{
using (var track = beatmap.LoadTrack())
return track is not TrackVirtual;
});
}
}

View File

@ -33,7 +33,6 @@ namespace osu.Game.Tests.Visual.Gameplay
increment = skip_time;
var working = CreateWorkingBeatmap(CreateBeatmap(new OsuRuleset().RulesetInfo));
working.LoadTrack();
Child = gameplayClockContainer = new MasterGameplayClockContainer(working, 0)
{

View File

@ -44,6 +44,10 @@ namespace osu.Game.Beatmaps
}, audio)
{
this.textures = textures;
// We are guaranteed to have a virtual track.
// To ease usability, ensure the track is available from point of construction.
LoadTrack();
}
protected override IBeatmap GetBeatmap() => new Beatmap();

View File

@ -161,7 +161,6 @@ namespace osu.Game.Overlays.FirstRunSetup
private void load(AudioManager audio, TextureStore textures, RulesetStore rulesets)
{
Beatmap.Value = new DummyWorkingBeatmap(audio, textures);
Beatmap.Value.LoadTrack();
Ruleset.Value = rulesets.AvailableRulesets.First();

View File

@ -365,6 +365,11 @@ namespace osu.Game.Tests.Visual
}
else
track = audio?.Tracks.GetVirtual(trackLength);
// We are guaranteed to have a virtual track.
// To ease testability, ensure the track is available from point of construction.
// (Usually this would be done by MusicController for us).
LoadTrack();
}
~ClockBackedTestWorkingBeatmap()