mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 11:37:28 +08:00
Expose Dependencies from base OsuTestCase
This commit is contained in:
parent
f2ac5b8b2d
commit
ebcfe97ccf
@ -98,17 +98,12 @@ namespace osu.Game.Rulesets.Mania.Tests
|
||||
});
|
||||
}
|
||||
|
||||
private DependencyContainer dependencies;
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent)
|
||||
=> dependencies = new DependencyContainer(base.CreateLocalDependencies(parent));
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(RulesetStore rulesets, SettingsStore settings)
|
||||
{
|
||||
maniaRuleset = rulesets.GetRuleset(3);
|
||||
|
||||
dependencies.Cache(new ManiaConfigManager(settings, maniaRuleset, 4));
|
||||
Dependencies.Cache(new ManiaConfigManager(settings, maniaRuleset, 4));
|
||||
}
|
||||
|
||||
private ManiaPlayfield createPlayfield(int cols, bool inverted = false)
|
||||
|
@ -35,10 +35,6 @@ namespace osu.Game.Tests.Visual
|
||||
typeof(MessageFormatter)
|
||||
};
|
||||
|
||||
private DependencyContainer dependencies;
|
||||
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent)
|
||||
=> dependencies = new DependencyContainer(base.CreateLocalDependencies(parent));
|
||||
|
||||
public TestCaseChatLink()
|
||||
{
|
||||
Add(textContainer = new TestChatLineContainer
|
||||
@ -54,7 +50,7 @@ namespace osu.Game.Tests.Visual
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
linkColour = colours.Blue;
|
||||
dependencies.Cache(new ChatOverlay
|
||||
Dependencies.Cache(new ChatOverlay
|
||||
{
|
||||
AvailableChannels =
|
||||
{
|
||||
|
@ -32,11 +32,6 @@ namespace osu.Game.Tests.Visual
|
||||
typeof(NotNullAttribute)
|
||||
};
|
||||
|
||||
private DependencyContainer dependencies;
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent)
|
||||
=> dependencies = new DependencyContainer(base.CreateLocalDependencies(parent));
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
@ -63,8 +58,8 @@ namespace osu.Game.Tests.Visual
|
||||
});
|
||||
|
||||
var clock = new DecoupleableInterpolatingFramedClock { IsCoupled = false };
|
||||
dependencies.CacheAs<IAdjustableClock>(clock);
|
||||
dependencies.CacheAs<IFrameBasedClock>(clock);
|
||||
Dependencies.CacheAs<IAdjustableClock>(clock);
|
||||
Dependencies.CacheAs<IFrameBasedClock>(clock);
|
||||
|
||||
Child = new OsuHitObjectComposer(new OsuRuleset());
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ namespace osu.Game.Tests.Visual
|
||||
|
||||
private RulesetStore rulesets;
|
||||
|
||||
private DependencyContainer dependencies;
|
||||
private WorkingBeatmap defaultBeatmap;
|
||||
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
@ -48,9 +47,6 @@ namespace osu.Game.Tests.Visual
|
||||
typeof(DrawableCarouselBeatmapSet),
|
||||
};
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent)
|
||||
=> dependencies = new DependencyContainer(base.CreateLocalDependencies(parent));
|
||||
|
||||
private class TestSongSelect : PlaySongSelect
|
||||
{
|
||||
public WorkingBeatmap CurrentBeatmap => Beatmap.Value;
|
||||
@ -68,8 +64,8 @@ namespace osu.Game.Tests.Visual
|
||||
// this is by no means clean. should be replacing inside of OsuGameBase somehow.
|
||||
IDatabaseContextFactory factory = new SingletonContextFactory(new OsuDbContext());
|
||||
|
||||
dependencies.Cache(rulesets = new RulesetStore(factory));
|
||||
dependencies.Cache(manager = new BeatmapManager(storage, factory, rulesets, null, null)
|
||||
Dependencies.Cache(rulesets = new RulesetStore(factory));
|
||||
Dependencies.Cache(manager = new BeatmapManager(storage, factory, rulesets, null, null)
|
||||
{
|
||||
DefaultBeatmap = defaultBeatmap = Beatmap.Default
|
||||
});
|
||||
|
@ -15,17 +15,12 @@ namespace osu.Game.Tests.Visual
|
||||
[TestFixture]
|
||||
public class TestCasePlaybackControl : OsuTestCase
|
||||
{
|
||||
private DependencyContainer dependencies;
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent)
|
||||
=> dependencies = new DependencyContainer(base.CreateLocalDependencies(parent));
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
var clock = new DecoupleableInterpolatingFramedClock { IsCoupled = false };
|
||||
dependencies.CacheAs<IAdjustableClock>(clock);
|
||||
dependencies.CacheAs<IFrameBasedClock>(clock);
|
||||
Dependencies.CacheAs<IAdjustableClock>(clock);
|
||||
Dependencies.CacheAs<IFrameBasedClock>(clock);
|
||||
|
||||
var playback = new PlaybackControl
|
||||
{
|
||||
|
@ -14,11 +14,6 @@ namespace osu.Game.Tests.Visual
|
||||
private readonly SettingsOverlay settings;
|
||||
private readonly DialogOverlay dialogOverlay;
|
||||
|
||||
private DependencyContainer dependencies;
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent)
|
||||
=> dependencies = new DependencyContainer(base.CreateLocalDependencies(parent));
|
||||
|
||||
public TestCaseSettings()
|
||||
{
|
||||
settings = new MainSettings
|
||||
@ -34,7 +29,7 @@ namespace osu.Game.Tests.Visual
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
dependencies.Cache(dialogOverlay);
|
||||
Dependencies.Cache(dialogOverlay);
|
||||
|
||||
Add(settings);
|
||||
}
|
||||
|
@ -20,11 +20,6 @@ namespace osu.Game.Tests.Visual
|
||||
protected readonly BindableBeatDivisor BeatDivisor = new BindableBeatDivisor();
|
||||
protected readonly EditorClock Clock;
|
||||
|
||||
private DependencyContainer dependencies;
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent)
|
||||
=> dependencies = new DependencyContainer(base.CreateLocalDependencies(parent));
|
||||
|
||||
protected EditorClockTestCase()
|
||||
{
|
||||
Clock = new EditorClock(new ControlPointInfo(), 5000, BeatDivisor) { IsCoupled = false };
|
||||
@ -33,9 +28,9 @@ namespace osu.Game.Tests.Visual
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
dependencies.Cache(BeatDivisor);
|
||||
dependencies.CacheAs<IFrameBasedClock>(Clock);
|
||||
dependencies.CacheAs<IAdjustableClock>(Clock);
|
||||
Dependencies.Cache(BeatDivisor);
|
||||
Dependencies.CacheAs<IFrameBasedClock>(Clock);
|
||||
Dependencies.CacheAs<IAdjustableClock>(Clock);
|
||||
|
||||
Beatmap.ValueChanged += beatmapChanged;
|
||||
beatmapChanged(Beatmap.Value);
|
||||
|
@ -15,16 +15,16 @@ namespace osu.Game.Tests.Visual
|
||||
private readonly OsuTestBeatmap beatmap = new OsuTestBeatmap(new DummyWorkingBeatmap());
|
||||
protected BindableBeatmap Beatmap => beatmap;
|
||||
|
||||
private DependencyContainer dependencies;
|
||||
protected DependencyContainer Dependencies { get; private set; }
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent)
|
||||
{
|
||||
dependencies = new DependencyContainer(base.CreateLocalDependencies(parent));
|
||||
Dependencies = new DependencyContainer(base.CreateLocalDependencies(parent));
|
||||
|
||||
dependencies.CacheAs<BindableBeatmap>(beatmap);
|
||||
dependencies.CacheAs<IBindableBeatmap>(beatmap);
|
||||
Dependencies.CacheAs<BindableBeatmap>(beatmap);
|
||||
Dependencies.CacheAs<IBindableBeatmap>(beatmap);
|
||||
|
||||
return dependencies;
|
||||
return Dependencies;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
Loading…
Reference in New Issue
Block a user