1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 06:33:20 +08:00

Revert some more usage of MusicController back to WorkingBeatmap

This commit is contained in:
Dean Herbert 2020-08-21 15:05:56 +09:00
parent 0b0ff62647
commit d2c2e8bbe8
9 changed files with 17 additions and 12 deletions

View File

@ -343,7 +343,7 @@ namespace osu.Game.Rulesets.Mania.Tests
judgementResults = new List<JudgementResult>();
});
AddUntilStep("Beatmap at 0", () => MusicController.CurrentTrack.CurrentTime == 0);
AddUntilStep("Beatmap at 0", () => Beatmap.Value.Track.CurrentTime == 0);
AddUntilStep("Wait until player is loaded", () => currentPlayer.IsCurrentScreen());
AddUntilStep("Wait for completion", () => currentPlayer.ScoreProcessor.HasCompleted.Value);
}

View File

@ -385,7 +385,7 @@ namespace osu.Game.Rulesets.Osu.Tests
judgementResults = new List<JudgementResult>();
});
AddUntilStep("Beatmap at 0", () => MusicController.CurrentTrack.CurrentTime == 0);
AddUntilStep("Beatmap at 0", () => Beatmap.Value.Track.CurrentTime == 0);
AddUntilStep("Wait until player is loaded", () => currentPlayer.IsCurrentScreen());
AddUntilStep("Wait for completion", () => currentPlayer.ScoreProcessor.HasCompleted.Value);
}

View File

@ -366,7 +366,7 @@ namespace osu.Game.Rulesets.Osu.Tests
judgementResults = new List<JudgementResult>();
});
AddUntilStep("Beatmap at 0", () => MusicController.CurrentTrack.CurrentTime == 0);
AddUntilStep("Beatmap at 0", () => Beatmap.Value.Track.CurrentTime == 0);
AddUntilStep("Wait until player is loaded", () => currentPlayer.IsCurrentScreen());
AddUntilStep("Wait for completion", () => currentPlayer.ScoreProcessor.HasCompleted.Value);
}

View File

@ -175,11 +175,11 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
private void createDrawableRuleset()
{
AddUntilStep("wait for beatmap to be loaded", () => MusicController.CurrentTrack.TrackLoaded);
AddUntilStep("wait for beatmap to be loaded", () => Beatmap.Value.Track.IsLoaded);
AddStep("create drawable ruleset", () =>
{
MusicController.CurrentTrack.Start();
Beatmap.Value.Track.Start();
SetContents(() =>
{

View File

@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
beatmap.ControlPointInfo.Add(0, new TimingControlPoint { BeatLength = 1000 });
MusicController.CurrentTrack.Start();
Beatmap.Value.Track.Start();
});
AddStep("Load playfield", () => SetContents(() => new TaikoPlayfield(new ControlPointInfo())

View File

@ -3,6 +3,7 @@
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Audio.Track;
using osu.Framework.Testing;
using osu.Game.Audio;
using osu.Game.Beatmaps;
@ -18,17 +19,20 @@ namespace osu.Game.Tests.Skins
[Resolved]
private BeatmapManager beatmaps { get; set; }
private WorkingBeatmap beatmap;
[BackgroundDependencyLoader]
private void load()
{
var imported = beatmaps.Import(new ZipArchiveReader(TestResources.OpenResource("Archives/ogg-beatmap.osz"))).Result;
Beatmap.Value = beatmaps.GetWorkingBeatmap(imported.Beatmaps[0]);
beatmap = beatmaps.GetWorkingBeatmap(imported.Beatmaps[0]);
beatmap.LoadTrack();
}
[Test]
public void TestRetrieveOggSample() => AddAssert("sample is non-null", () => Beatmap.Value.Skin.GetSample(new SampleInfo("sample")) != null);
public void TestRetrieveOggSample() => AddAssert("sample is non-null", () => beatmap.Skin.GetSample(new SampleInfo("sample")) != null);
[Test]
public void TestRetrieveOggTrack() => AddAssert("track is non-null", () => !MusicController.CurrentTrack.IsDummyDevice);
public void TestRetrieveOggTrack() => AddAssert("track is non-null", () => !(beatmap.Track is TrackVirtual));
}
}

View File

@ -278,7 +278,7 @@ namespace osu.Game.Beatmaps
/// <summary>
/// Whether this beatmap's track has been loaded via <see cref="LoadTrack"/>.
/// </summary>
public bool TrackLoaded => loadedTrack != null;
public virtual bool TrackLoaded => loadedTrack != null;
/// <summary>
/// Get the loaded audio track instance. <see cref="LoadTrack"/> must have first been called.

View File

@ -27,6 +27,8 @@ namespace osu.Game.Tests.Beatmaps
this.storyboard = storyboard;
}
public override bool TrackLoaded => true;
public override bool BeatmapLoaded => true;
protected override IBeatmap GetBeatmap() => beatmap;

View File

@ -13,8 +13,7 @@ namespace osu.Game.Tests.Visual
base.Update();
// note that this will override any mod rate application
if (MusicController.TrackLoaded)
MusicController.CurrentTrack.Tempo.Value = Clock.Rate;
Beatmap.Value.Track.Tempo.Value = Clock.Rate;
}
}
}