public IEnumerator TestSetValue() { TimelineFloat timeFloat = new TimelineFloat(); TimedFloat testVal1 = new TimedFloat(1, 1); TimedFloat testVal2 = new TimedFloat(2, 5); TimedFloat testVal3 = new TimedFloat(3, 10); TimedFloat testVal4 = new TimedFloat(1.5f, 5); timeFloat.SetValue(testVal1); Assert.True(timeFloat.Duration == 0.0f, "TimelineProperty with unexpected Duration"); timeFloat.SetValue(testVal2); timeFloat.SetValue(testVal3); Assert.True(timeFloat.HasValue, "TimelineProperty without values"); Assert.True(timeFloat.Value == testVal3.Value, "TimelineProperty with unexpected Value"); Assert.True(timeFloat.TimePoints == 3, "TimelineProperty with unexpected Value"); Assert.False(timeFloat.HasValueBefore(0), "Unexpected HasValueBefore"); Assert.False(timeFloat.HasValueBefore(-5), "Unexpected HasValueBefore"); Assert.True(timeFloat.HasValueBefore(1.5f), "Unexpected HasValueBefore"); Assert.True(timeFloat.HasValueBefore(100), "Unexpected HasValueBefore"); timeFloat.SetValue(testVal4); Assert.True(timeFloat.HasValue, "TimelineProperty without values"); Assert.True(timeFloat.Value == testVal4.Value, "TimelineProperty with unexpected Value"); Assert.True(timeFloat.TimePoints == 2, "TimelineProperty with unexpected Value"); Assert.False(timeFloat.HasValueBefore(0), "Unexpected HasValueBefore"); Assert.False(timeFloat.HasValueBefore(-5), "Unexpected HasValueBefore"); Assert.True(timeFloat.HasValueBefore(1.5f), "Unexpected HasValueBefore"); Assert.True(timeFloat.HasValueBefore(100), "Unexpected HasValueBefore"); yield break; }
public IEnumerator TestInit() { TimelineFloat timeFloat = new TimelineFloat(); Assert.False(timeFloat.HasValue, "New TimelineProperty with values"); Assert.False(timeFloat.HasValueBefore(0), "New TimelineProperty with values"); Assert.False(timeFloat.HasValueBefore(-5), "New TimelineProperty with values"); Assert.False(timeFloat.HasValueBefore(100), "New TimelineProperty with values"); Assert.True(timeFloat.Value == default(float), "New TimelineProperty with unexpected Value"); Assert.True(timeFloat.TimePoints == 0, "New TimelineProperty with unexpected Value"); Assert.True(timeFloat.Duration == 0.0f, "TimelineProperty with unexpected Duration"); yield break; }
public IEnumerator SetValues() { TimelineFloat timeFloat = new TimelineFloat(); TimedFloat[] testVals = { new TimedFloat(1, 5), new TimedFloat(2, 5), new TimedFloat(3.25f, 25) }; TimedFloat[] testVals2 = { new TimedFloat(5, 5), new TimedFloat(6, 10) }; TimedFloat[] testVals3 = { new TimedFloat(5.5f, 5), new TimedFloat(7, 30) }; timeFloat.SetValues(testVals); Assert.True(timeFloat.HasValue, "TimelineProperty without values"); Assert.True(timeFloat.Value == testVals[2].Value, "TimelineProperty with unexpected Value"); Assert.True(timeFloat.TimePoints == 3, "TimelineProperty with unexpected Value"); Assert.False(timeFloat.HasValueBefore(0), "Unexpected HasValueBefore"); Assert.False(timeFloat.HasValueBefore(-5), "Unexpected HasValueBefore"); Assert.True(timeFloat.HasValueBefore(1.5f), "Unexpected HasValueBefore"); Assert.True(timeFloat.HasValueBefore(100), "Unexpected HasValueBefore"); timeFloat.SetValues(testVals2, true); Assert.True(timeFloat.HasValue, "TimelineProperty without values"); Assert.True(timeFloat.Value == testVals2[1].Value, "TimelineProperty with unexpected Value"); Assert.True(timeFloat.TimePoints == 2, "TimelineProperty with unexpected Value"); Assert.False(timeFloat.HasValueBefore(0), "Unexpected HasValueBefore"); Assert.False(timeFloat.HasValueBefore(-5), "Unexpected HasValueBefore"); Assert.False(timeFloat.HasValueBefore(4.7f), "Unexpected HasValueBefore"); Assert.True(timeFloat.HasValueBefore(5.5f), "Unexpected HasValueBefore"); Assert.True(timeFloat.HasValueBefore(100), "Unexpected HasValueBefore"); timeFloat.SetValues(testVals3, false); Assert.True(timeFloat.HasValue, "TimelineProperty without values"); Assert.True(timeFloat.Value == testVals3[1].Value, "TimelineProperty with unexpected Value"); Assert.True(timeFloat.TimePoints == 3, "TimelineProperty with unexpected Value"); Assert.False(timeFloat.HasValueBefore(0), "Unexpected HasValueBefore"); Assert.False(timeFloat.HasValueBefore(-5), "Unexpected HasValueBefore"); Assert.False(timeFloat.HasValueBefore(4.7f), "Unexpected HasValueBefore"); Assert.True(timeFloat.HasValueBefore(5.5f), "Unexpected HasValueBefore"); Assert.True(timeFloat.HasValueBefore(100), "Unexpected HasValueBefore"); yield break; }