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"); }
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_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"); }
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"); }
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)); }
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"); }