mirror of https://github.com/ppy/osu
Implement `FindProvider` and `AllSources` properly on all test `ISkinSource`s
This commit is contained in:
parent
c1284940e1
commit
31cbb36a64
|
@ -114,9 +114,9 @@ public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wra
|
|||
|
||||
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => null;
|
||||
|
||||
public ISkin FindProvider(Func<ISkin, bool> lookupFunction) => null;
|
||||
public ISkin FindProvider(Func<ISkin, bool> lookupFunction) => lookupFunction(this) ? this : null;
|
||||
|
||||
public IEnumerable<ISkin> AllSources => Enumerable.Empty<ISkin>();
|
||||
public IEnumerable<ISkin> AllSources => new[] { this };
|
||||
|
||||
public event Action SourceChanged
|
||||
{
|
||||
|
|
|
@ -167,9 +167,9 @@ public Drawable GetDrawableComponent(ISkinComponent component)
|
|||
|
||||
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => null;
|
||||
|
||||
public ISkin FindProvider(Func<ISkin, bool> lookupFunction) => null;
|
||||
public ISkin FindProvider(Func<ISkin, bool> lookupFunction) => lookupFunction(this) ? this : null;
|
||||
|
||||
public IEnumerable<ISkin> AllSources => Enumerable.Empty<ISkin>();
|
||||
public IEnumerable<ISkin> AllSources => new[] { this };
|
||||
|
||||
public event Action SourceChanged;
|
||||
|
||||
|
|
|
@ -331,7 +331,7 @@ private class SkinSourceContainer : Container, ISkinSource
|
|||
|
||||
public ISkin FindProvider(Func<ISkin, bool> lookupFunction) => throw new NotImplementedException();
|
||||
|
||||
public IEnumerable<ISkin> AllSources => Enumerable.Empty<ISkin>();
|
||||
public IEnumerable<ISkin> AllSources => throw new NotImplementedException();
|
||||
|
||||
public event Action SourceChanged
|
||||
{
|
||||
|
|
|
@ -147,8 +147,8 @@ private class TestSkinSourceContainer : Container, ISkinSource, ISamplePlaybackD
|
|||
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => source?.GetTexture(componentName, wrapModeS, wrapModeT);
|
||||
public ISample GetSample(ISampleInfo sampleInfo) => source?.GetSample(sampleInfo);
|
||||
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => source?.GetConfig<TLookup, TValue>(lookup);
|
||||
public ISkin FindProvider(Func<ISkin, bool> lookupFunction) => source?.FindProvider(lookupFunction);
|
||||
public IEnumerable<ISkin> AllSources => source.AllSources;
|
||||
public ISkin FindProvider(Func<ISkin, bool> lookupFunction) => lookupFunction(this) ? this : source?.FindProvider(lookupFunction);
|
||||
public IEnumerable<ISkin> AllSources => new[] { this }.Concat(source?.AllSources);
|
||||
|
||||
public void TriggerSourceChanged()
|
||||
{
|
||||
|
|
|
@ -159,8 +159,9 @@ public event Action SourceChanged
|
|||
remove { }
|
||||
}
|
||||
|
||||
public ISkin FindProvider(Func<ISkin, bool> lookupFunction) => null;
|
||||
public IEnumerable<ISkin> AllSources => Enumerable.Empty<ISkin>();
|
||||
public ISkin FindProvider(Func<ISkin, bool> lookupFunction) => lookupFunction(this) ? this : null;
|
||||
|
||||
public IEnumerable<ISkin> AllSources => new[] { this };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue