1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-19 13:45:59 +08:00

Add local source for testing

This commit is contained in:
Salman Ahmed 2021-06-25 12:00:46 +03:00
parent 13ed52a990
commit ff5e590d32

View File

@ -19,11 +19,11 @@ namespace osu.Game.Tests.Rulesets
{
public class TestSceneRulesetSkinProvidingContainer : OsuTestScene
{
[Resolved]
private SkinManager skins { get; set; }
private SkinRequester requester;
[Cached(typeof(ISkin))]
private readonly TestSkinProvider testSkin = new TestSkinProvider();
protected override Ruleset CreateRuleset() => new TestSceneRulesetDependencies.TestRuleset();
[Test]
@ -31,15 +31,13 @@ namespace osu.Game.Tests.Rulesets
{
Texture textureOnLoad = null;
AddStep("set skin", () => skins.CurrentSkinInfo.Value = DefaultLegacySkin.Info);
AddStep("setup provider", () =>
{
var rulesetSkinProvider = new RulesetSkinProvidingContainer(Ruleset.Value.CreateInstance(), Beatmap.Value.Beatmap, Beatmap.Value.Skin);
rulesetSkinProvider.Add(requester = new SkinRequester());
requester.OnLoadAsync += () => textureOnLoad = requester.GetTexture("hitcircle");
requester.OnLoadAsync += () => textureOnLoad = requester.GetTexture(TestSkinProvider.TEXTURE_NAME);
Child = rulesetSkinProvider;
});
@ -69,5 +67,18 @@ namespace osu.Game.Tests.Rulesets
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => skin.GetConfig<TLookup, TValue>(lookup);
}
private class TestSkinProvider : ISkin
{
public const string TEXTURE_NAME = "some-texture";
public Drawable GetDrawableComponent(ISkinComponent component) => throw new NotImplementedException();
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => componentName == TEXTURE_NAME ? Texture.WhitePixel : null;
public ISample GetSample(ISampleInfo sampleInfo) => throw new NotImplementedException();
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => throw new NotImplementedException();
}
}
}