Beispiel #1
0
        public void TestRemoveFramesBefore()
        {
            var actor = new Actor(new Scene(), 1, 0);

            var value = new VInt32(actor, 1);

            value.AddStepFrame(actor.StartTime, 0);
            Assert.Throws <ArgumentException>(() => value.RemoveFramesBefore(1));

            value.AddStepFrame(10, 5);
            value.Interpolate(5);
            value.RemoveFramesBefore(4);
            Assert.AreEqual(0, value.GetValue(4));
            Assert.AreEqual(0, value.GetValue(5));
            Assert.AreEqual(0, value.GetValue(9));
            Assert.AreEqual(5, value.GetValue(10));
            Assert.AreEqual(5, value.GetValue(11));

            value.AddLinearFrame(20, 15);
            value.Interpolate(12);
            value.RemoveFramesBefore(11);
            Assert.AreEqual(7, value.GetValue(11));
            Assert.AreEqual(7, value.GetValue(12));
            Assert.AreEqual(8, value.GetValue(13));
            Assert.AreEqual(14, value.GetValue(19));
            Assert.AreEqual(15, value.GetValue(20));
        }
Beispiel #2
0
        public void TestRemoveFramesAfter()
        {
            var actor = new Actor(new Scene(), 1, 0);

            var value = new VInt32(actor, 1);
            value.AddStepFrame(actor.StartTime, 0);
            Assert.Throws<ArgumentException>(() => value.RemoveFramesAfter(-1));

            value.AddStepFrame(10, 5);
            value.Interpolate(9);
            value.RemoveFramesAfter(10);
            Assert.AreEqual(0, value.GetValue(8), 0);
            Assert.AreEqual(0, value.GetValue(9), 0);
            Assert.AreEqual(0, value.GetValue(10), 0);

            value.AddLinearFrame(19, 10);
            value.Interpolate(17);
            value.RemoveFramesAfter(18);
            Assert.AreEqual(7, value.GetValue(16));
            Assert.AreEqual(8, value.GetValue(17));
            Assert.AreEqual(8, value.GetValue(18));
        }
Beispiel #3
0
        public void TestRemoveFramesAfter()
        {
            var actor = new Actor(new Scene(), 1, 0);

            var value = new VInt32(actor, 1);

            value.AddStepFrame(actor.StartTime, 0);
            Assert.Throws <ArgumentException>(() => value.RemoveFramesAfter(-1));

            value.AddStepFrame(10, 5);
            value.Interpolate(9);
            value.RemoveFramesAfter(10);
            Assert.AreEqual(0, value.GetValue(8), 0);
            Assert.AreEqual(0, value.GetValue(9), 0);
            Assert.AreEqual(0, value.GetValue(10), 0);

            value.AddLinearFrame(19, 10);
            value.Interpolate(17);
            value.RemoveFramesAfter(18);
            Assert.AreEqual(7, value.GetValue(16));
            Assert.AreEqual(8, value.GetValue(17));
            Assert.AreEqual(8, value.GetValue(18));
        }
Beispiel #4
0
        public void TestRemoveFramesBefore()
        {
            var actor = new Actor(new Scene(), 1, 0);

            var value = new VInt32(actor, 1);
            value.AddStepFrame(actor.StartTime, 0);
            Assert.Throws<ArgumentException>(() => value.RemoveFramesBefore(1));

            value.AddStepFrame(10, 5);
            value.Interpolate(5);
            value.RemoveFramesBefore(4);
            Assert.AreEqual(0, value.GetValue(4));
            Assert.AreEqual(0, value.GetValue(5));
            Assert.AreEqual(0, value.GetValue(9));
            Assert.AreEqual(5, value.GetValue(10));
            Assert.AreEqual(5, value.GetValue(11));

            value.AddLinearFrame(20, 15);
            value.Interpolate(12);
            value.RemoveFramesBefore(11);
            Assert.AreEqual(7, value.GetValue(11));
            Assert.AreEqual(7, value.GetValue(12));
            Assert.AreEqual(8, value.GetValue(13));
            Assert.AreEqual(14, value.GetValue(19));
            Assert.AreEqual(15, value.GetValue(20));
        }