Esempio n. 1
0
        /// <summary>
        ///Ein Test für "Ease"
        ///</summary>
        public void EaseTestHelper2 <TValueType>()
        {
            var target  = new SimpleTweenerImpl <TValueType>();
            var obj     = new TweeningTestObject();
            var propOps = new PropertyOps("FloatValue", 100, false).EaseEx(EaseEx.InElastic, new object[] { 0.3F, 0.3F });

            target.Create(obj, propOps);

            var param0   = new PrivateObject(target);
            var accessor = new SimpleTweener_Accessor <TValueType>(param0);

            // assert that only the EaseFunc is set and not EaseEx
            Assert.IsNull(accessor.EaseFunc);
            Assert.IsNotNull(accessor.EaseExFunc);
            Assert.IsNotNull(accessor.EaseExParams);

            var startValue = 100F;
            var deltaValue = 200F;

            Console.WriteLine("ret " + accessor.Ease(0F, startValue, deltaValue).GetType());
            var actual = accessor.Ease(0F, startValue, deltaValue);

            Assert.AreEqual(100, actual);

            actual = accessor.Ease(1F, startValue, deltaValue);
            Assert.AreEqual(300, actual);
        }
Esempio n. 2
0
        /// <summary>
        ///Ein Test für "CalculateTargetValue"
        ///</summary>
        public void CalculateTargetValueTestHelper()
        {
            // test for absolute tween
            var tweener = new SimpleTweenerImpl <int>();
            var param0  = new PrivateObject(tweener);
            var target  = new SimpleTweener_Accessor <int>(param0);

            var obj = new TweeningTestObject();

            tweener.Create(obj, new PropertyOps("SomeValue", 200, false));
            tweener.Value = 100;
            int expected = 200;
            int actual   = target.CalculateTargetValue();

            Assert.AreEqual(expected, actual);

            // test for relative tween
            tweener = new SimpleTweenerImpl <int>();
            param0  = new PrivateObject(tweener);
            target  = new SimpleTweener_Accessor <int>(param0);

            obj = new TweeningTestObject();
            tweener.Create(obj, new PropertyOps("SomeValue", 200, true));
            tweener.Value = 100;
            expected      = 300;
            actual        = target.CalculateTargetValue();
            Assert.AreEqual(expected, actual);
        }
Esempio n. 3
0
        /// <summary>
        ///Ein Test für "CalculateStartValue"
        ///</summary>
        public void CalculateStartValueTestHelper()
        {
            // test without given start value in property ops
            var tweener = new SimpleTweenerImpl <int>();
            var param0  = new PrivateObject(tweener);
            var target  = new SimpleTweener_Accessor <int>(param0);

            tweener.Value = 100;
            tweener.Create(null, new PropertyOps("SomeName", 200, false));
            int expected = 100;
            int actual   = target.CalculateStartValue();

            Assert.AreEqual(expected, actual);

            // test WITH given start value in property ops
            tweener = new SimpleTweenerImpl <int>();
            param0  = new PrivateObject(tweener);
            target  = new SimpleTweener_Accessor <int>(param0);

            tweener.Value = 100;
            tweener.Create(null, new PropertyOps("SomeName", 200, false).Start(200));
            expected = 200;
            actual   = target.CalculateStartValue();
            Assert.AreEqual(expected, actual);
        }
Esempio n. 4
0
        /// <summary>
        ///Ein Test für "CastSafe"
        ///</summary>
        public void CastSafeTestHelper <TValueType>()
        {
            var        param0   = new PrivateObject(new SimpleTweenerImpl <TValueType>());
            var        target   = new SimpleTweener_Accessor <TValueType>(param0);
            object     val      = default(TValueType);
            TValueType expected = default(TValueType);
            TValueType actual;

            actual = target.CastSafe(val);
            Assert.AreEqual(expected, actual);
        }
Esempio n. 5
0
        /// <summary>
        ///Ein Test für "GetTweenedObject"
        ///</summary>
        public void GetTweenedObjectTestHelper <TValueType>()
        {
            var           tweener = new SimpleTweenerImpl <TValueType>();
            PrivateObject param0  = new PrivateObject(tweener);
            SimpleTweener_Accessor <TValueType> target = new SimpleTweener_Accessor <TValueType>(param0);
            var expected = new TweeningTestObject();

            tweener.Create(expected, new PropertyOps("IntValue", 100, false));
            TweeningTestObject actual;

            actual = target.GetTweenedObject <TweeningTestObject>();
            Assert.AreEqual(expected, actual);
        }
Esempio n. 6
0
        /// <summary>
        ///Ein Test für "Setup"
        ///</summary>
        public void SetupTestHelperAbsoluteTweening()
        {
            var obj = new TweeningTestObject();
            SimpleTweenerImpl <int> target = CreateSimpleTweener <int>();

            target.Value = 100;
            // Create Calls Setup() and Init()
            target.Create(obj, new PropertyOps("SomeName", 200, false));
            // after setup start and target value must be set on the tweener

            PrivateObject param0 = new PrivateObject(target);
            SimpleTweener_Accessor <int> accessor = new SimpleTweener_Accessor <int>(param0);

            Assert.AreEqual(100, accessor.StartValue);
            Assert.AreEqual(200, accessor.TargetValue);
        }
Esempio n. 7
0
        /// <summary>
        ///Ein Test für "Create"
        ///</summary>
        public void CreateTestHelper <TValueType>()
        {
            var          target               = CreateSimpleTweener <TValueType>();
            var          obj                  = new TweeningTestObject();
            const string propertyName         = "GenericValue";
            const int    targetValueContained = 100;
            var          targetValue          = new GenericParameterHelper(targetValueContained);
            const bool   isRelative           = true;
            var          propOps              = new PropertyOps(propertyName, targetValue, isRelative);

            target.Create(obj, propOps);

            var param0   = new PrivateObject(target);
            var accessor = new SimpleTweener_Accessor <TValueType>(param0);

            Assert.AreEqual(propertyName, accessor.PropOps.PropertyName);
            Assert.AreEqual(targetValue, accessor.PropOps.TargetValue);
            Assert.AreEqual(targetValueContained, ((GenericParameterHelper)accessor.PropOps.TargetValue).Data);
            Assert.AreEqual(isRelative, accessor.PropOps.IsRelative);
        }