Beispiel #1
0
        public void Animation_IsPaused_AfterPause_Test()
        {
            // ReSharper disable once NotAccessedVariable
            var targetValue = 1.0f;
            var animation   = new FloatTransition(() => 2.0f, a => targetValue = a, 3.0f, new TransitionParameters(2.0f));

            animation.Pause();
            Assert.IsTrue(animation.IsPaused);
        }
Beispiel #2
0
        public void Animation_IsComplete_IfStopped_Test()
        {
            // ReSharper disable once NotAccessedVariable
            var targetValue = 1.0f;
            var animation   = new FloatTransition(() => 2.0f, a => targetValue = a, 3.0f, new TransitionParameters(2.0f));

            animation.Stop();
            Assert.IsTrue(animation.IsComplete);
        }
Beispiel #3
0
        public void Animation_Update_IsCompleteAfterDuration_Test()
        {
            var targetValue = 1.0f;
            var animation   = new FloatTransition(() => 2.0f, a => targetValue = a, 3.0f, new TransitionParameters(2.0f));

            animation.Update(2.0f);
            Assert.IsTrue(animation.IsComplete);

            animation.Update(2.1f);
            Assert.AreEqual(3.0, targetValue);
        }
Beispiel #4
0
        public void Animation_Update_CustomEasingFunction_Test()
        {
            // ReSharper disable once NotAccessedVariable
            var targetValue = 1.0f;
            var animation   = new FloatTransition(() => 2.0f, a => targetValue = a, 3.0f, new TransitionParameters(2.0f))
            {
                EasingFunction = a => 1.2f
            };

            animation.Update(1.0f);
            Assert.AreEqual(3.2f, targetValue);
        }
Beispiel #5
0
        public void Animation_Update_Test()
        {
            var targetValue = 1.0f;
            var animation   = new FloatTransition(() => 2.0f, a => targetValue = a, 3.0f, new TransitionParameters(2.0f));

            animation.Update(0.0f);
            Assert.AreEqual(2.0f, targetValue);

            animation.Update(1.0f);
            Assert.AreEqual(2.5f, targetValue);

            animation.Update(2.0f);
            Assert.AreEqual(3.0f, targetValue);
        }
Beispiel #6
0
        public void Animation_IsPaused_PreventsChange_Test()
        {
            // ReSharper disable once NotAccessedVariable
            var targetValue = 1.0f;
            var animation   = new FloatTransition(() => 2.0f, a => targetValue = a, 3.0f, new TransitionParameters(2.0f));

            animation.Update(1.0f);
            Assert.AreEqual(1.0f, animation.CurrentTime);

            animation.Pause();
            animation.Update(1.0f);
            Assert.AreEqual(1.0f, animation.CurrentTime);
            Assert.IsFalse(animation.IsComplete);
        }