public void TestPriorityPreservation() { TestSkinProvidingContainer provider = null; TestSkin mostPrioritisedSource = null; AddStep("setup sources", () => { var sources = new List <TestSkin>(); for (int i = 0; i < 10; i++) { sources.Add(new TestSkin()); } mostPrioritisedSource = sources.First(); Child = provider = new TestSkinProvidingContainer(sources); }); AddAssert("texture provided by expected skin", () => { return(provider.FindProvider(s => s.GetTexture(TestSkin.TEXTURE_NAME) != null) == mostPrioritisedSource); }); AddStep("trigger source change", () => provider.TriggerSourceChanged()); AddAssert("texture still provided by expected skin", () => { return(provider.FindProvider(s => s.GetTexture(TestSkin.TEXTURE_NAME) != null) == mostPrioritisedSource); }); }
public void TestCustomAfterImageColour() { var skin = new TestSkin { HyperDashAfterImageColour = Color4.Lime }; checkHyperDashCatcherColour(skin, Catcher.DEFAULT_HYPER_DASH_COLOUR, skin.HyperDashAfterImageColour); }
public void TestCustomFruitColour() { var skin = new TestSkin { HyperDashFruitColour = Color4.Cyan }; checkHyperDashFruitColour(skin, skin.HyperDashFruitColour); }
public void TestCustomCatcherColour() { var skin = new TestSkin { HyperDashColour = Color4.Goldenrod }; checkHyperDashCatcherColour(skin, skin.HyperDashColour); }
public void TestFruitColourFallback() { var skin = new TestSkin { HyperDashColour = Color4.Goldenrod }; checkHyperDashFruitColour(skin, skin.HyperDashColour); }
public void TestRetrieveSampleInSubFolder() { ISkin skin = null; ISample channel = null; AddStep("create skin", () => skin = new TestSkin("folder/test-sample", this)); AddStep("retrieve sample", () => channel = skin.GetSample(new SampleInfo("folder/test-sample"))); AddAssert("sample is non-null", () => channel != null); }
public void TestRetrieveTopLevelSample() { ISkin skin = null; SampleChannel channel = null; AddStep("create skin", () => skin = new TestSkin("test-sample", Audio)); AddStep("retrieve sample", () => channel = skin.GetSample(new SampleInfo("test-sample"))); AddAssert("sample is non-null", () => channel != null); }
public void TestCustomFruitColourPriority() { var skin = new TestSkin { HyperDashColour = Color4.Goldenrod, HyperDashFruitColour = Color4.Cyan }; checkHyperDashFruitColour(skin, skin.HyperDashFruitColour); }
public void TestCustomAfterImageColourPriority() { var skin = new TestSkin { HyperDashColour = Color4.Goldenrod, HyperDashAfterImageColour = Color4.Lime }; checkHyperDashCatcherColour(skin, skin.HyperDashColour, skin.HyperDashAfterImageColour); }
public void TestAnimationTimeReferenceChange() { ISkin skin = new TestSkin(); AddStep("get animation", () => Add(animation = (TextureAnimation)skin.GetAnimation(animation_name, true, false))); AddAssert("frame count correct", () => animation.FrameCount == frame_count); assertPlaybackPosition(0); AddStep("set start time to 1000", () => animationTimeReference.AnimationStartTime.Value = 1000); assertPlaybackPosition(-1000); AddStep("set current time to 500", () => animationTimeReference.ManualClock.CurrentTime = 500); assertPlaybackPosition(-500); }
public void TestCatcherPlateFlipping(bool flip) { AddStep("setup catcher", () => { var skin = new TestSkin { FlipCatcherPlate = flip }; container.Child = new SkinProvidingContainer(skin) { Child = catcher = new Catcher(new DroppedObjectContainer()) { Anchor = Anchor.Centre } }; }); Fruit fruit = new Fruit(); AddStep("catch fruit", () => catchFruit(fruit, 20)); float position = 0; AddStep("record fruit position", () => position = getCaughtObjectPosition(fruit)); AddStep("face left", () => catcher.VisualDirection = Direction.Left); if (flip) { AddAssert("fruit position changed", () => !Precision.AlmostEquals(getCaughtObjectPosition(fruit), position)); } else { AddAssert("fruit position unchanged", () => Precision.AlmostEquals(getCaughtObjectPosition(fruit), position)); } AddStep("face right", () => catcher.VisualDirection = Direction.Right); AddAssert("fruit position restored", () => Precision.AlmostEquals(getCaughtObjectPosition(fruit), position)); }
public void TestDefaultFruitColour() { var skin = new TestSkin(); checkHyperDashFruitColour(skin, Catcher.DEFAULT_HYPER_DASH_COLOUR); }