1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 17:02:55 +08:00

Fix incorrect pushed changes

This should've been in the original commit, but for some reason got
deleted out.
This commit is contained in:
Salman Ahmed 2021-06-25 13:17:11 +03:00
parent 8387acfe15
commit 84c9ede966

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System; using System;
using System.Collections.Generic;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio.Sample; using osu.Framework.Audio.Sample;
@ -21,11 +22,15 @@ namespace osu.Game.Tests.Rulesets
{ {
private SkinRequester requester; private SkinRequester requester;
[Cached(typeof(ISkin))]
private readonly TestSkinProvider testSkin = new TestSkinProvider();
protected override Ruleset CreateRuleset() => new TestSceneRulesetDependencies.TestRuleset(); protected override Ruleset CreateRuleset() => new TestSceneRulesetDependencies.TestRuleset();
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
{
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
dependencies.CacheAs<ISkinSource>(new TestSkinProvider());
return dependencies;
}
[Test] [Test]
public void TestEarlyAddedSkinRequester() public void TestEarlyAddedSkinRequester()
{ {
@ -68,7 +73,7 @@ namespace osu.Game.Tests.Rulesets
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => skin.GetConfig<TLookup, TValue>(lookup); public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => skin.GetConfig<TLookup, TValue>(lookup);
} }
private class TestSkinProvider : ISkin private class TestSkinProvider : ISkinSource
{ {
public const string TEXTURE_NAME = "some-texture"; public const string TEXTURE_NAME = "some-texture";
@ -79,6 +84,16 @@ namespace osu.Game.Tests.Rulesets
public ISample GetSample(ISampleInfo sampleInfo) => throw new NotImplementedException(); public ISample GetSample(ISampleInfo sampleInfo) => throw new NotImplementedException();
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => throw new NotImplementedException(); public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => throw new NotImplementedException();
public event Action SourceChanged
{
add { }
remove { }
}
public ISkin FindProvider(Func<ISkin, bool> lookupFunction) => lookupFunction(this) ? this : null;
public IEnumerable<ISkin> AllSources => new[] { this };
} }
} }
} }