コード例 #1
0
        public void GetClipCount_AfterAddOne_ReturnsOne([ValueSource(typeof(ComparativeTestFixture), "Sources")] System.Type type)
        {
            IAnimation animation    = ComparativeTestFixture.Instantiate(type);
            var        clip         = Resources.Load <AnimationClip>("LinearX");
            var        clipInstance = Object.Instantiate <AnimationClip>(clip);

            clipInstance.legacy = animation.usesLegacy;
            animation.AddClip(clipInstance, "test");

            Assert.AreEqual(1, animation.GetClipCount(), "Component should have 1 clip connected after add");
        }
コード例 #2
0
        public void AddClip_TwiceDifferentName_GetClipCount_ReturnsTwo([ValueSource(typeof(ComparativeTestFixture), "Sources")] System.Type type)
        {
            IAnimation animation    = ComparativeTestFixture.Instantiate(type);
            var        clip         = Resources.Load <AnimationClip>("LinearX");
            var        clipInstance = Object.Instantiate <AnimationClip>(clip);

            clipInstance.legacy = animation.usesLegacy;

            animation.AddClip(clipInstance, "test");
            animation.AddClip(clipInstance, "test2");
            Assert.AreEqual(2, animation.GetClipCount(), "Component should have no clips after remove");
        }
コード例 #3
0
        public void RemoveClip_ByName_RemovesClip([ValueSource(typeof(ComparativeTestFixture), "Sources")] System.Type type)
        {
            IAnimation animation    = ComparativeTestFixture.Instantiate(type);
            var        clip         = Resources.Load <AnimationClip>("LinearX");
            var        clipInstance = Object.Instantiate <AnimationClip>(clip);

            clipInstance.legacy = animation.usesLegacy;

            animation.AddClip(clipInstance, "test");
            animation.RemoveClip("test");
            Assert.AreEqual(0, animation.GetClipCount(), "Component should still have 1 connected clip after remove");
        }
コード例 #4
0
        public void AddClip_TwiceWithSameName_GetClipCount_ReturnsOne([ValueSource(typeof(ComparativeTestFixture), "Sources")] System.Type type)
        {
            IAnimation animation    = ComparativeTestFixture.Instantiate(type);
            var        clip         = Resources.Load <AnimationClip>("LinearX");
            var        clipInstance = Object.Instantiate <AnimationClip>(clip);

            clipInstance.legacy = animation.usesLegacy;

            animation.AddClip(clipInstance, "test");
            LogAssert.ignoreFailingMessages = true; //The error message here is irrelevant
            animation.AddClip(clipInstance, "test");
            LogAssert.ignoreFailingMessages = false;

            Assert.AreEqual(1, animation.GetClipCount(), "Component should have no clips after remove");
        }
コード例 #5
0
        public void RemoveClip_AnimationClip_DoesntRemoveUnrelatedClips([ValueSource(typeof(ComparativeTestFixture), "Sources")] System.Type type)
        {
            IAnimation animation    = ComparativeTestFixture.Instantiate(type);
            var        clip         = Resources.Load <AnimationClip>("LinearX");
            var        clip2        = Resources.Load <AnimationClip>("LinearY");
            var        clipInstance = Object.Instantiate <AnimationClip>(clip);

            clipInstance.legacy = animation.usesLegacy;
            var clipInstance2 = Object.Instantiate <AnimationClip>(clip2);

            clipInstance2.legacy = animation.usesLegacy;

            animation.AddClip(clipInstance, clipInstance.name);
            animation.AddClip(clipInstance2, clipInstance2.name);
            animation.RemoveClip(clipInstance);
            Assert.AreEqual(1, animation.GetClipCount(), "Component should still have 1 connected clip after remove");
            Assert.NotNull(animation.GetState(clipInstance2.name));
        }
コード例 #6
0
        public void GetClipCount_BeforeAdd_ReturnsZero([ValueSource(typeof(ComparativeTestFixture), "Sources")] System.Type type)
        {
            IAnimation animation = ComparativeTestFixture.Instantiate(type);

            Assert.AreEqual(0, animation.GetClipCount(), "Component should have no clips connected at this point");
        }