mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Expose and use test ruleset config cache in test scenes
This commit is contained in:
@ -95,6 +95,16 @@ namespace osu.Game.Tests.Visual
|
||||
/// </remarks>
|
||||
protected Storage LocalStorage => localStorage.Value;
|
||||
|
||||
/// <summary>
|
||||
/// A cache for ruleset configurations to be used in this test scene.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This <see cref="IRulesetConfigCache"/> instance is provided to the children of this test scene via DI.
|
||||
/// It is only exposed so that test scenes themselves can access the ruleset config cache in a safe manner
|
||||
/// (<see cref="OsuTestScene"/>s cannot use DI themselves, as they will end up accessing the real cached instance from <see cref="OsuGameBase"/>).
|
||||
/// </remarks>
|
||||
protected IRulesetConfigCache RulesetConfigs { get; private set; }
|
||||
|
||||
private Lazy<Storage> localStorage;
|
||||
|
||||
private Storage headlessHostStorage;
|
||||
@ -124,7 +134,7 @@ namespace osu.Game.Tests.Visual
|
||||
// as well as problems due to the implementation details of the "real" implementation (the configs only being available at `LoadComplete()`),
|
||||
// cache a test implementation of the ruleset config cache over the "real" one.
|
||||
var isolatedBaseDependencies = new DependencyContainer(baseDependencies);
|
||||
isolatedBaseDependencies.CacheAs<IRulesetConfigCache>(new TestRulesetConfigCache());
|
||||
isolatedBaseDependencies.CacheAs(RulesetConfigs = new TestRulesetConfigCache());
|
||||
baseDependencies = isolatedBaseDependencies;
|
||||
|
||||
var providedRuleset = CreateRuleset();
|
||||
|
Reference in New Issue
Block a user