Force OsuGameTests to use a unique storage each run

This commit is contained in:
Dean Herbert 2020-09-15 19:01:32 +09:00
parent c179f9eb93
commit f7c9c80566
2 changed files with 5 additions and 1 deletions

View File

@ -34,6 +34,8 @@ namespace osu.Game.Tests.Visual.Navigation
protected TestOsuGame Game;
protected override bool UseFreshStoragePerRun => true;
[BackgroundDependencyLoader]
private void load(GameHost host)
{

View File

@ -118,6 +118,8 @@ namespace osu.Game.Tests.Visual
base.Content.Add(content = new DrawSizePreservingFillContainer());
}
protected virtual bool UseFreshStoragePerRun => false;
public virtual void RecycleLocalStorage()
{
if (localStorage?.IsValueCreated == true)
@ -133,7 +135,7 @@ namespace osu.Game.Tests.Visual
}
localStorage =
new Lazy<Storage>(() => host is HeadlessGameHost ? host.Storage : new NativeStorage(Path.Combine(RuntimeInfo.StartupDirectory, $"{GetType().Name}-{Guid.NewGuid()}")));
new Lazy<Storage>(() => !UseFreshStoragePerRun && host is HeadlessGameHost ? host.Storage : new NativeStorage(Path.Combine(RuntimeInfo.StartupDirectory, $"{GetType().Name}-{Guid.NewGuid()}")));
}
[Resolved]