1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-08 05:52:54 +08:00

Fix incorrect condition and add test

This commit is contained in:
smoogipoo 2020-03-05 17:12:14 +09:00
parent 9307caa3bf
commit 0c1775b522
3 changed files with 23 additions and 5 deletions

View File

@ -97,6 +97,8 @@ namespace osu.Game.Tests.Visual.Navigation
public new SettingsPanel Settings => base.Settings; public new SettingsPanel Settings => base.Settings;
public new MusicController MusicController => base.MusicController;
public new OsuConfigManager LocalConfig => base.LocalConfig; public new OsuConfigManager LocalConfig => base.LocalConfig;
public new Bindable<WorkingBeatmap> Beatmap => base.Beatmap; public new Bindable<WorkingBeatmap> Beatmap => base.Beatmap;

View File

@ -114,6 +114,22 @@ namespace osu.Game.Tests.Visual.Navigation
AddAssert("Options overlay was closed", () => Game.Settings.State.Value == Visibility.Hidden); AddAssert("Options overlay was closed", () => Game.Settings.State.Value == Visibility.Hidden);
} }
[Test]
public void TestWaitForNextTrackInMenu()
{
bool trackCompleted = false;
AddUntilStep("Wait for music controller", () => Game.MusicController.IsLoaded);
AddStep("Seek close to end", () =>
{
Game.MusicController.SeekTo(Game.Beatmap.Value.Track.Length - 1000);
Game.Beatmap.Value.Track.Completed += () => trackCompleted = true;
});
AddUntilStep("Track was completed", () => trackCompleted);
AddUntilStep("Track was restarted", () => Game.Beatmap.Value.Track.IsRunning);
}
private void pushEscape() => private void pushEscape() =>
AddStep("Press escape", () => pressAndRelease(Key.Escape)); AddStep("Press escape", () => pressAndRelease(Key.Escape));

View File

@ -414,8 +414,8 @@ namespace osu.Game
if (Beatmap.Value != b) if (Beatmap.Value != b)
return; return;
if (Beatmap.Value.Track.Looping && !Beatmap.Disabled) if (!Beatmap.Value.Track.Looping && !Beatmap.Disabled)
musicController.NextTrack(); MusicController.NextTrack();
} }
} }
@ -588,7 +588,7 @@ namespace osu.Game
loadComponentSingleFile(new OnScreenDisplay(), Add, true); loadComponentSingleFile(new OnScreenDisplay(), Add, true);
loadComponentSingleFile(musicController = new MusicController(), Add, true); loadComponentSingleFile(MusicController = new MusicController(), Add, true);
loadComponentSingleFile(notifications = new NotificationOverlay loadComponentSingleFile(notifications = new NotificationOverlay
{ {
@ -896,7 +896,7 @@ namespace osu.Game
private ScalingContainer screenContainer; private ScalingContainer screenContainer;
private MusicController musicController; protected MusicController MusicController { get; private set; }
protected override bool OnExiting() protected override bool OnExiting()
{ {
@ -954,7 +954,7 @@ namespace osu.Game
{ {
OverlayActivationMode.Value = newOsuScreen.InitialOverlayActivationMode; OverlayActivationMode.Value = newOsuScreen.InitialOverlayActivationMode;
musicController.AllowRateAdjustments = newOsuScreen.AllowRateAdjustments; MusicController.AllowRateAdjustments = newOsuScreen.AllowRateAdjustments;
if (newOsuScreen.HideOverlaysOnEnter) if (newOsuScreen.HideOverlaysOnEnter)
CloseAllOverlays(); CloseAllOverlays();