コード例 #1
0
        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);
            });
        }
コード例 #2
0
        public void TestCustomAfterImageColour()
        {
            var skin = new TestSkin
            {
                HyperDashAfterImageColour = Color4.Lime
            };

            checkHyperDashCatcherColour(skin, Catcher.DEFAULT_HYPER_DASH_COLOUR, skin.HyperDashAfterImageColour);
        }
コード例 #3
0
        public void TestCustomFruitColour()
        {
            var skin = new TestSkin
            {
                HyperDashFruitColour = Color4.Cyan
            };

            checkHyperDashFruitColour(skin, skin.HyperDashFruitColour);
        }
コード例 #4
0
        public void TestCustomCatcherColour()
        {
            var skin = new TestSkin
            {
                HyperDashColour = Color4.Goldenrod
            };

            checkHyperDashCatcherColour(skin, skin.HyperDashColour);
        }
コード例 #5
0
        public void TestFruitColourFallback()
        {
            var skin = new TestSkin
            {
                HyperDashColour = Color4.Goldenrod
            };

            checkHyperDashFruitColour(skin, skin.HyperDashColour);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        public void TestCustomFruitColourPriority()
        {
            var skin = new TestSkin
            {
                HyperDashColour      = Color4.Goldenrod,
                HyperDashFruitColour = Color4.Cyan
            };

            checkHyperDashFruitColour(skin, skin.HyperDashFruitColour);
        }
コード例 #9
0
        public void TestCustomAfterImageColourPriority()
        {
            var skin = new TestSkin
            {
                HyperDashColour           = Color4.Goldenrod,
                HyperDashAfterImageColour = Color4.Lime
            };

            checkHyperDashCatcherColour(skin, skin.HyperDashColour, skin.HyperDashAfterImageColour);
        }
コード例 #10
0
        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);
        }
コード例 #11
0
        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));
        }
コード例 #12
0
        public void TestDefaultFruitColour()
        {
            var skin = new TestSkin();

            checkHyperDashFruitColour(skin, Catcher.DEFAULT_HYPER_DASH_COLOUR);
        }