diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index fe0abd6d87..8de1a0f918 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -59,7 +59,7 @@ namespace osu.Game.Tests.Beatmaps.IO if (!importer.ImportAsync(osz_path).Wait(1000)) Assert.Fail(@"IPC took too long to send"); - ensureLoaded(osu, 10000); + ensureLoaded(osu); } } @@ -77,23 +77,23 @@ namespace osu.Game.Tests.Beatmaps.IO return osu; } - private void ensureLoaded(OsuGameBase osu, int timeout = 100) + private void ensureLoaded(OsuGameBase osu, int timeout = 10000) { IEnumerable resultSets = null; Action waitAction = () => { while ((resultSets = osu.Dependencies.Get() - .Query().Where(s => s.OnlineBeatmapSetID == 241526)).Count() != 1) - Thread.Sleep(1); + .Query().Where(s => s.OnlineBeatmapSetID == 241526)).Count() == 0) + Thread.Sleep(50); }; Assert.IsTrue(waitAction.BeginInvoke(null, null).AsyncWaitHandle.WaitOne(timeout), - @"BeatmapSet did not import to the database"); + $@"BeatmapSet did not import to the database in allocated time."); //ensure we were stored to beatmap database backing... - Assert.IsTrue(resultSets.Count() == 1); + Assert.IsTrue(resultSets.Count() == 1, $@"Incorrect result count found ({resultSets.Count()} but should be 1)."); IEnumerable resultBeatmaps = null; @@ -102,16 +102,17 @@ namespace osu.Game.Tests.Beatmaps.IO { while ((resultBeatmaps = osu.Dependencies.Get() .Query().Where(s => s.OnlineBeatmapSetID == 241526 && s.BaseDifficultyID > 0)).Count() != 12) - Thread.Sleep(1); + Thread.Sleep(50); }; Assert.IsTrue(waitAction.BeginInvoke(null, null).AsyncWaitHandle.WaitOne(timeout), - @"Beatmaps did not import to the database"); + @"Beatmaps did not import to the database in allocated time"); //fetch children and check we can load from the post-storage path... var set = osu.Dependencies.Get().GetChildren(resultSets.First()); - Assert.IsTrue(set.Beatmaps.Count == resultBeatmaps.Count()); + Assert.IsTrue(set.Beatmaps.Count == resultBeatmaps.Count(), + $@"Incorrect database beatmap count post-import ({resultBeatmaps.Count()} but should be {set.Beatmaps.Count})."); foreach (BeatmapInfo b in resultBeatmaps) Assert.IsTrue(set.Beatmaps.Any(c => c.OnlineBeatmapID == b.OnlineBeatmapID)); diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index b106ea60c6..35154b2f45 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -312,6 +312,9 @@ namespace osu.Game.Screens.Play } else { + FadeOut(250); + Content.ScaleTo(0.7f, 750, EasingTypes.InQuint); + dimLevel.ValueChanged -= dimChanged; Background?.FadeTo(1f, 200); return base.OnExiting(next); diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index f14ae65f68..87d6a82404 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -80,6 +80,8 @@ namespace osu.Game.Screens.Play Schedule(() => { + if (!IsCurrentScreen) return; + if (!Push(player)) Exit(); }); @@ -89,6 +91,12 @@ namespace osu.Game.Screens.Play { Content.ScaleTo(0.7f, 150, EasingTypes.InQuint); FadeOut(150); + + //OsuScreens are currently never finalised due to the Bindable bindings. + //can be removed once we solve that one. + if (player != null && player.LoadState != LoadState.Alive) + player.Dispose(); + return base.OnExiting(next); }