예제 #1
0
        public IEnumerator Crossfade_LongerThanClip_KeepsClipAlive_UntilCrossfadeDone([ValueSource(typeof(ComparativeTestFixture), "Sources")] System.Type type)
        {
            IAnimation animation = ComparativeTestFixture.Instantiate(type);
            var        clipX     = Resources.Load <AnimationClip>("LinearX");
            var        clipY     = Resources.Load <AnimationClip>("LinearY");
            var        xClip     = Object.Instantiate <AnimationClip>(clipX);
            var        yClip     = Object.Instantiate <AnimationClip>(clipY);

            xClip.legacy = animation.usesLegacy;
            yClip.legacy = animation.usesLegacy;

            animation.AddClip(yClip, "ToPlay");
            animation.AddClip(xClip, "ToCrossfade");
            animation.Play("ToPlay");

            yield return(new WaitForSeconds(0.9f));

            Assert.IsTrue(animation.IsPlaying("ToPlay"));
            Assert.AreNotEqual(0f, animation.gameObject.transform.localPosition.y);
            animation.CrossFade("ToCrossfade", 1.2f);
            yield return(new WaitForSeconds(1.5f));

            Assert.AreNotEqual(0f, animation.gameObject.transform.localPosition.y);
            Assert.IsTrue(animation.IsPlaying("ToCrossfade"));
        }
예제 #2
0
    public IEnumerator PlayQueue_WithLoopedAnimation_Prevents_StateAccess_OfOriginalState_FromWorking_Correctly([ValueSource(typeof(ComparativeTestFixture), "Sources")] System.Type type)
    {
        IAnimation animation          = ComparativeTestFixture.Instantiate(type);
        var        clip               = Resources.Load <AnimationClip>("LinearX");
        var        clipInstance       = Object.Instantiate <AnimationClip>(clip);
        var        loopedClipInstance = Object.Instantiate <AnimationClip>(clip);

        clipInstance.legacy         = animation.usesLegacy;
        loopedClipInstance.legacy   = animation.usesLegacy;
        loopedClipInstance.wrapMode = WrapMode.Loop;

        animation.AddClip(clipInstance, "FirstClip");
        animation.AddClip(loopedClipInstance, "LoopedClip");
        animation.Play("FirstClip");
        animation.PlayQueued("LoopedClip", QueueMode.CompleteOthers);
        yield return(new WaitForSeconds(1.1f));

        Assert.IsTrue(animation.IsPlaying("LoopedClip"), "Clip 'LoopedClip' should be playing");
        IAnimationState state = animation.GetState("LoopedClip");

        Assert.IsFalse(state.enabled, "We should be playing a copy of LoopedClip, not the LoopedClip State");
        yield return(new WaitForSeconds(1.1f));

        state = animation.GetState("LoopedClip");
        Assert.IsFalse(state.enabled, "We should still be playing a copy of LoopedClip, not the LoopedClip State");
    }
예제 #3
0
        public IEnumerator PlayQueued_Only_Plays_QueuedAnimations_Once([ValueSource(typeof(ComparativeTestFixture), "Sources")] System.Type type)
        {
            IAnimation animation     = ComparativeTestFixture.Instantiate(type);
            var        clipX         = Resources.Load <AnimationClip>("LinearX");
            var        clipInstanceX = Object.Instantiate <AnimationClip>(clipX);

            clipInstanceX.legacy = animation.usesLegacy;
            var clipInstanceXOnce = Object.Instantiate <AnimationClip>(clipX);

            clipInstanceXOnce.legacy   = animation.usesLegacy;
            clipInstanceXOnce.wrapMode = WrapMode.Once;

            animation.AddClip(clipInstanceX, "A");
            animation.AddClip(clipInstanceX, "B");
            animation.AddClip(clipInstanceX, "C");

            animation.Play("A");
            animation.PlayQueued("B", QueueMode.CompleteOthers);
            animation.PlayQueued("C", QueueMode.CompleteOthers);
            yield return(new WaitForSeconds(2.8f));

            Assert.IsTrue(animation.IsPlaying("C"));
            yield return(new WaitForSeconds(0.3f));

            Assert.IsFalse(animation.isPlaying);
        }
예제 #4
0
        public IEnumerator Stop_WithName_OtherClip_IsPlaying_DoesntChange([ValueSource(typeof(ComparativeTestFixture), "Sources")] System.Type type)
        {
            IAnimation animation = ComparativeTestFixture.Instantiate(type);

            var clipX         = Resources.Load <AnimationClip>("LinearX");
            var clipY         = Resources.Load <AnimationClip>("LinearY");
            var clipInstanceX = Object.Instantiate <AnimationClip>(clipX);
            var clipInstanceY = Object.Instantiate <AnimationClip>(clipY);

            clipInstanceX.legacy = animation.usesLegacy;
            clipInstanceY.legacy = animation.usesLegacy;

            animation.AddClip(clipInstanceY, "ClipToStop");
            animation.AddClip(clipInstanceX, "OtherClip");
            var stateToStop = animation.GetState("ClipToStop");
            var otherState  = animation.GetState("OtherClip");

            stateToStop.weight  = 1f;
            stateToStop.enabled = true;
            otherState.weight   = 1f;
            otherState.enabled  = true;

            yield return(null);

            animation.Stop("ClipToStop");
            Assert.IsFalse(animation.IsPlaying("ClipToStop"));
            Assert.IsTrue(animation.IsPlaying("OtherClip"));
        }
        public IEnumerator State_Weight_Normalizes([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);
            var        clipInstance2 = Object.Instantiate <AnimationClip>(clip2);

            clipInstance.legacy  = animation.usesLegacy;
            clipInstance2.legacy = animation.usesLegacy;

            animation.AddClip(clipInstance, "State1");
            animation.AddClip(clipInstance2, "State2");
            IAnimationState state1 = animation.GetState("State1");
            IAnimationState state2 = animation.GetState("State2");

            state1.enabled = true;
            state2.enabled = true;
            state1.weight  = 1f;
            state2.weight  = 1f;
            state1.time    = 0.5f; //Seek the clip so that values should be written;
            state2.time    = 0.5f; //Seek the clip so that values should be written;
            yield return(null);

            Assert.AreEqual(0.25f, animation.gameObject.transform.localPosition.x);
            Assert.AreEqual(0.25f, animation.gameObject.transform.localPosition.y);
        }
예제 #6
0
        public IEnumerator Stop_WithoutName_IsPlaying_ReturnsFalse([ValueSource(typeof(ComparativeTestFixture), "Sources")] System.Type type)
        {
            IAnimation animation = ComparativeTestFixture.Instantiate(type);

            var clipX         = Resources.Load <AnimationClip>("LinearX");
            var clipY         = Resources.Load <AnimationClip>("LinearY");
            var clipInstanceX = Object.Instantiate <AnimationClip>(clipX);
            var clipInstanceY = Object.Instantiate <AnimationClip>(clipY);

            clipInstanceX.legacy = animation.usesLegacy;
            clipInstanceY.legacy = animation.usesLegacy;

            animation.AddClip(clipInstanceY, "clip1");
            animation.AddClip(clipInstanceX, "clip2");

            animation.GetState("clip1").enabled = true;
            animation.GetState("clip1").weight  = 0.5f;

            animation.GetState("clip2").enabled = true;
            animation.GetState("clip2").weight  = 0.5f;

            Assert.IsTrue(animation.IsPlaying("clip1"));
            Assert.IsTrue(animation.IsPlaying("clip2"));
            yield return(null);

            animation.Stop();
            Assert.IsFalse(animation.IsPlaying("clip1"));
            Assert.IsFalse(animation.IsPlaying("clip2"));
        }
예제 #7
0
    public IEnumerator StateSpeed_Affects_WhenCrossfadeHappens([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, "PlaySlowly");
        animation.AddClip(clipInstance, "Queued");
        IAnimationState state = animation.GetState("PlaySlowly");

        state.enabled = true;
        state.speed   = 0.1f;
        animation.PlayQueued("Queued", QueueMode.CompleteOthers);

        //Wait for the original length of PlaySlowly
        yield return(new WaitForSeconds(1.1f));

        Assert.IsFalse(animation.IsPlaying("Queued"), "Clip 'Queued' should not be playing yet. Speed is probably applied wrong.");
        state.speed = 1000.0f;
        yield return(null);

        yield return(null);

        Assert.IsTrue(animation.IsPlaying("Queued"), "Clip 'PlaySlowly' should now be done, and clip 'Queued' should have started playing.");
    }
        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");
        }
        public void RemoveClip_ByName_DoesntRemoveOtherClips([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;
            var legacyClip2 = Object.Instantiate <AnimationClip>(clipInstance);

            animation.AddClip(clipInstance, "test");
            animation.AddClip(legacyClip2, "test2");
            animation.RemoveClip("test");
            Assert.AreEqual(1, animation.GetClipCount(), "Component should still have 1 connected clip after remove");
        }
예제 #10
0
        public void Crossfade_DoesntStopOtherClips([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, "ToPlay");
            animation.AddClip(clipInstance, "ToCrossfade");
            animation.CrossFade("ToPlay", 0f);
            animation.CrossFade("ToCrossfade", 0.2f);

            Assert.IsTrue(animation.IsPlaying("ToPlay"));
        }
        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");
        }
예제 #12
0
    public IEnumerator Queue_Looped_Clips_Block_QueuedAnimations([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;
        clipInstance.wrapMode = WrapMode.Loop;

        animation.AddClip(clipInstance, "Play");
        animation.AddClip(clipInstance, "Queued");
        animation.Play("Play");
        animation.PlayQueued("Queued", QueueMode.CompleteOthers);
        yield return(new WaitForSeconds(1.1f));

        Assert.IsFalse(animation.IsPlaying("Queued"));
    }
예제 #13
0
        public void Blend_DoesntChange_OtherState_Weight([ValueSource(typeof(ComparativeTestFixture), "Sources")] System.Type type)
        {
            IAnimation animation     = ComparativeTestFixture.Instantiate(type);
            var        clipX         = Resources.Load <AnimationClip>("LinearX");
            var        clipInstance1 = Object.Instantiate <AnimationClip>(clipX);
            var        clipInstance2 = Object.Instantiate <AnimationClip>(clipX);

            clipInstance1.legacy = animation.usesLegacy;
            clipInstance2.legacy = animation.usesLegacy;

            animation.AddClip(clipInstance1, "ToBlend");
            animation.AddClip(clipInstance2, "ToLeaveAlone");
            animation.Play("ToLeaveAlone");
            animation.Blend("ToBlend", 1f, 0f);

            Assert.AreEqual(1f, animation.GetState("ToLeaveAlone").weight);
        }
예제 #14
0
        public IEnumerator PlayQueue_WithClipPlaying_IsStatePlaying_ReturnsFalse([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, "ToPlay");
            animation.AddClip(clipInstance, "ToPlayQueue");
            animation.Play("ToPlay");
            animation.PlayQueued("ToPlayQueue", QueueMode.CompleteOthers);

            Assert.IsFalse(animation.IsPlaying("ToPlayQueue"));

            yield return(null);
        }
예제 #15
0
        public IEnumerator CrossfadedOut_Clips_AreTimeReset([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, "ToPlay");
            animation.AddClip(clipInstance, "ToCrossfade");
            animation.Play("ToPlay");
            animation.CrossFade("ToCrossfade", 0.1f);

            yield return(new WaitForSeconds(0.2f));

            Assert.AreEqual(0.0f, animation.GetState("ToPlay").normalizedTime);
        }
        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));
        }
예제 #17
0
    public IEnumerator IsPlaying_AfterCrossfadeDone_ReturnsFalse([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;
        clipInstance.wrapMode = WrapMode.Once;

        animation.AddClip(clipInstance, "test");
        animation.AddClip(clipInstance, "test2");
        animation.Play("test");
        yield return(new WaitForSeconds(0.2f));

        animation.CrossFade("test2", 1.5f);
        yield return(new WaitForSeconds(2.0f));

        Assert.AreEqual(false, animation.isPlaying);
    }
예제 #18
0
        public IEnumerator CrossfadeQueue_WithClipPlaying_IsStatePlaying_AfterOriginalClipDone_ReturnsTrue([ValueSource(typeof(ComparativeTestFixture), "Sources")] System.Type type)
        {
            IAnimation animation     = ComparativeTestFixture.Instantiate(type);
            var        clipX         = Resources.Load <AnimationClip>("LinearX");
            var        clipY         = Resources.Load <AnimationClip>("LinearY");
            var        clipInstanceX = Object.Instantiate <AnimationClip>(clipX);
            var        clipInstanceY = Object.Instantiate <AnimationClip>(clipY);

            clipInstanceX.legacy = animation.usesLegacy;
            clipInstanceY.legacy = animation.usesLegacy;

            animation.AddClip(clipInstanceY, "ToPlay");
            animation.AddClip(clipInstanceX, "ToCrossfade");
            animation.Play("ToPlay");
            animation.CrossFadeQueued("ToCrossfade", 0.0f, QueueMode.CompleteOthers);
            yield return(new WaitForSeconds(1.1f));

            Assert.IsTrue(animation.IsPlaying("ToCrossfade"));
        }
예제 #19
0
    public void IsPlaying_BeforePlay_ReturnsFalse([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(false, animation.isPlaying);
    }
예제 #20
0
        public void Rewind_WithName_OtherClip_Time_DoesntChange([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, "ToRewind");
            animation.AddClip(clipInstance, "ToLeaveAlone");
            IAnimationState toRewind = animation.GetState("ToRewind");

            toRewind.time = 0.5f;
            IAnimationState toLeaveAlone = animation.GetState("ToLeaveAlone");

            toLeaveAlone.time = 0.5f;

            animation.Rewind("ToRewind");
            Assert.AreNotEqual(0f, toLeaveAlone.time);
        }
        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");
        }
예제 #22
0
    public IEnumerator NegativeSpeed_Does_Trigger_Crossfade([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, "PlayBackwards");
        animation.AddClip(clipInstance, "Crossfade");
        IAnimationState state = animation.GetState("PlayBackwards");

        state.enabled = true;
        state.time    = 0.5f;
        state.speed   = -1f;
        animation.PlayQueued("Crossfade", QueueMode.CompleteOthers);
        yield return(new WaitForSeconds(0.5f));

        Assert.IsTrue(state.enabled);
        Assert.IsTrue(animation.IsPlaying("Crossfade"));
    }
예제 #23
0
        public void Play_ValidName_IsPlaying_ReturnsTrue([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, "RightName");
            animation.Play("RightName");
            Assert.IsTrue(animation.isPlaying, "The clip RightName should be playing");
        }
예제 #24
0
        public void Rewind_WithoutName_AllStateTimes_AreZero([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, "ToRewind");
            animation.AddClip(clipInstance, "ToRewindToo");
            IAnimationState toRewind = animation.GetState("ToRewind");

            toRewind.time = 0.5f;
            IAnimationState toRewindToo = animation.GetState("ToRewindToo");

            toRewindToo.time = 0.5f;

            animation.Rewind();
            Assert.AreEqual(0f, toRewind.time);
            Assert.AreEqual(0f, toRewindToo.time);
        }
        public void RemoveClip_AnimationClip_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, clipInstance.name);
            animation.RemoveClip(clipInstance);
            Assert.AreEqual(0, animation.GetClipCount(), "Component should have no clips after remove");
        }
예제 #26
0
        public void Blend_AfterBlend_NonInstant_State_IsPlaying([ValueSource(typeof(ComparativeTestFixture), "Sources")] System.Type type)
        {
            IAnimation animation     = ComparativeTestFixture.Instantiate(type);
            var        clipX         = Resources.Load <AnimationClip>("LinearX");
            var        clipInstanceX = Object.Instantiate <AnimationClip>(clipX);

            clipInstanceX.legacy = animation.usesLegacy;

            animation.AddClip(clipInstanceX, "ToBlend");
            animation.Blend("ToBlend", 1, 0.5f);

            Assert.IsTrue(animation.IsPlaying("ToBlend"));
        }
        public void State_Enabled_InitialValue_False([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, "ValidName");
            IAnimationState state = animation.GetState("ValidName");

            Assert.IsFalse(state.enabled);
        }
        public void State_Length_Equals_ClipLength([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, "ValidName");
            IAnimationState state = animation.GetState("ValidName");

            Assert.AreEqual(clipInstance.length, state.length);
        }
        public void AddClip_WithSameName_AsClip_DoenstCreateNewClip([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, clipInstance.name);
            IAnimationState state = animation.GetState(clipInstance.name);

            Assert.AreEqual(clipInstance, state.clip, "Component should have no clips after remove");
        }
        public void WrapMode_Equals_Clip_WrapMode([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, clipInstance.name);
            IAnimationState state = animation.GetState(clipInstance.name);

            Assert.AreEqual(clipInstance.wrapMode, state.wrapMode);
        }