mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 17:43:05 +08:00
Avoid threading conflicts when resetting the database in unit tests
This commit is contained in:
parent
a2407948ed
commit
e777ccc339
@ -13,7 +13,6 @@ using osu.Framework.Platform;
|
||||
using osu.Game.IPC;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets;
|
||||
|
||||
namespace osu.Game.Tests.Beatmaps.IO
|
||||
{
|
||||
@ -98,16 +97,14 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
|
||||
private OsuGameBase loadOsu(GameHost host)
|
||||
{
|
||||
host.Storage.DeleteDatabase(@"client");
|
||||
|
||||
var osu = new OsuGameBase();
|
||||
Task.Run(() => host.Run(osu));
|
||||
|
||||
while (!osu.IsLoaded)
|
||||
Thread.Sleep(1);
|
||||
|
||||
//reset beatmap database (sqlite and storage backing)
|
||||
osu.Dependencies.Get<RulesetStore>().Reset();
|
||||
osu.Dependencies.Get<BeatmapManager>().Reset();
|
||||
|
||||
return osu;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user