mirror of
https://github.com/ppy/osu.git
synced 2025-03-20 07:57:20 +08:00
Merge branch 'master' into async-imports
This commit is contained in:
commit
f6eb970f69
@ -59,7 +59,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
|||||||
if (!importer.ImportAsync(osz_path).Wait(1000))
|
if (!importer.ImportAsync(osz_path).Wait(1000))
|
||||||
Assert.Fail(@"IPC took too long to send");
|
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;
|
return osu;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ensureLoaded(OsuGameBase osu, int timeout = 100)
|
private void ensureLoaded(OsuGameBase osu, int timeout = 10000)
|
||||||
{
|
{
|
||||||
IEnumerable<BeatmapSetInfo> resultSets = null;
|
IEnumerable<BeatmapSetInfo> resultSets = null;
|
||||||
|
|
||||||
Action waitAction = () =>
|
Action waitAction = () =>
|
||||||
{
|
{
|
||||||
while ((resultSets = osu.Dependencies.Get<BeatmapDatabase>()
|
while ((resultSets = osu.Dependencies.Get<BeatmapDatabase>()
|
||||||
.Query<BeatmapSetInfo>().Where(s => s.OnlineBeatmapSetID == 241526)).Count() != 1)
|
.Query<BeatmapSetInfo>().Where(s => s.OnlineBeatmapSetID == 241526)).Count() == 0)
|
||||||
Thread.Sleep(1);
|
Thread.Sleep(50);
|
||||||
};
|
};
|
||||||
|
|
||||||
Assert.IsTrue(waitAction.BeginInvoke(null, null).AsyncWaitHandle.WaitOne(timeout),
|
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...
|
//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<BeatmapInfo> resultBeatmaps = null;
|
IEnumerable<BeatmapInfo> resultBeatmaps = null;
|
||||||
|
|
||||||
@ -102,16 +102,17 @@ namespace osu.Game.Tests.Beatmaps.IO
|
|||||||
{
|
{
|
||||||
while ((resultBeatmaps = osu.Dependencies.Get<BeatmapDatabase>()
|
while ((resultBeatmaps = osu.Dependencies.Get<BeatmapDatabase>()
|
||||||
.Query<BeatmapInfo>().Where(s => s.OnlineBeatmapSetID == 241526 && s.BaseDifficultyID > 0)).Count() != 12)
|
.Query<BeatmapInfo>().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),
|
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...
|
//fetch children and check we can load from the post-storage path...
|
||||||
var set = osu.Dependencies.Get<BeatmapDatabase>().GetChildren(resultSets.First());
|
var set = osu.Dependencies.Get<BeatmapDatabase>().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)
|
foreach (BeatmapInfo b in resultBeatmaps)
|
||||||
Assert.IsTrue(set.Beatmaps.Any(c => c.OnlineBeatmapID == b.OnlineBeatmapID));
|
Assert.IsTrue(set.Beatmaps.Any(c => c.OnlineBeatmapID == b.OnlineBeatmapID));
|
||||||
|
@ -312,6 +312,9 @@ namespace osu.Game.Screens.Play
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
FadeOut(250);
|
||||||
|
Content.ScaleTo(0.7f, 750, EasingTypes.InQuint);
|
||||||
|
|
||||||
dimLevel.ValueChanged -= dimChanged;
|
dimLevel.ValueChanged -= dimChanged;
|
||||||
Background?.FadeTo(1f, 200);
|
Background?.FadeTo(1f, 200);
|
||||||
return base.OnExiting(next);
|
return base.OnExiting(next);
|
||||||
|
@ -80,6 +80,8 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
Schedule(() =>
|
Schedule(() =>
|
||||||
{
|
{
|
||||||
|
if (!IsCurrentScreen) return;
|
||||||
|
|
||||||
if (!Push(player))
|
if (!Push(player))
|
||||||
Exit();
|
Exit();
|
||||||
});
|
});
|
||||||
@ -89,6 +91,12 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
Content.ScaleTo(0.7f, 150, EasingTypes.InQuint);
|
Content.ScaleTo(0.7f, 150, EasingTypes.InQuint);
|
||||||
FadeOut(150);
|
FadeOut(150);
|
||||||
|
|
||||||
|
//OsuScreens are currently never finalised due to the Bindable<Beatmap> bindings.
|
||||||
|
//can be removed once we solve that one.
|
||||||
|
if (player != null && player.LoadState != LoadState.Alive)
|
||||||
|
player.Dispose();
|
||||||
|
|
||||||
return base.OnExiting(next);
|
return base.OnExiting(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user