public void TestDisposalDoesNotDisposeParentStores() { DrawableWithDependencies drawable = null; TestTextureStore textureStore = null; TestSampleStore sampleStore = null; AddStep("add dependencies", () => { Child = drawable = new DrawableWithDependencies(); textureStore = drawable.ParentTextureStore; sampleStore = drawable.ParentSampleStore; }); AddStep("clear children", Clear); AddUntilStep("wait for disposal", () => drawable.IsDisposed); AddStep("GC", () => { drawable = null; GC.Collect(); GC.WaitForPendingFinalizers(); }); AddAssert("parent texture store not disposed", () => !textureStore.IsDisposed); AddAssert("parent sample store not disposed", () => !sampleStore.IsDisposed); }
public void TestReturnNullOnFallbackFailure() { var textureStore = new TestTextureStore("sliderb", "hit100"); var legacySkin = new TestLegacySkin(textureStore); var texture = legacySkin.GetTexture("Gameplay/osu/followpoint"); Assert.IsNull(texture); }
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); dependencies.CacheAs <TextureStore>(ParentTextureStore = new TestTextureStore()); dependencies.CacheAs <ISampleStore>(ParentSampleStore = new TestSampleStore()); return(new DrawableRulesetDependencies(new OsuRuleset(), dependencies)); }
public void TestFallbackOrder(string[] filesInStore, string requestedComponent, string expectedTexture, float expectedScale) { var textureStore = new TestTextureStore(filesInStore); var legacySkin = new TestLegacySkin(textureStore); var texture = legacySkin.GetTexture(requestedComponent); Assert.IsNotNull(texture); Assert.AreEqual(textureStore.Textures[expectedTexture], texture); Assert.AreEqual(expectedScale, texture.ScaleAdjust); }