예제 #1
0
        public void PropertyValueGetRotationValue()
        {
            tlog.Debug(tag, $"PropertyValueGetRotationValue START");

            var dummy = new Rotation(new Radian(6.0f), new Vector3(1.0f, 2.0f, 3.0f));

            Assert.IsNotNull(dummy, "Should be not null!");
            Assert.IsInstanceOf <Rotation>(dummy, "Should be an Instance of Rotation class!");

            var testingTarget = new PropertyValue(dummy);

            Assert.IsNotNull(testingTarget, "Should be not null!");
            Assert.IsInstanceOf <PropertyValue>(testingTarget, "Should be an Instance of PropertyValue class!");

            Rotation rotation = new Rotation();
            var      result   = testingTarget.Get(rotation);

            Assert.IsTrue(result);

            Radian  angle = new Radian(20.0f);
            Vector3 axis  = new Vector3(0, 0, 0);

            rotation.GetAxisAngle(axis, angle);
            Assert.AreEqual(0.27f, float.Parse(axis.X.ToString("F2")), "shoule be equal.");
            Assert.AreEqual(0.53f, float.Parse(axis.Y.ToString("F2")), "shoule be equal.");
            Assert.AreEqual(0.80f, float.Parse(axis.Z.ToString("F2")), "shoule be equal.");

            testingTarget.Dispose();
            rotation.Dispose();
            dummy.Dispose();
            tlog.Debug(tag, $"PropertyValueGetRotationValue END (OK)");
        }
예제 #2
0
        public void PropertyValueGetPropertyMapValue()
        {
            tlog.Debug(tag, $"PropertyValueGetPropertyMapValue START");

            var dummy = new PropertyMap();

            Assert.IsNotNull(dummy, "Should be not null!");
            Assert.IsInstanceOf <PropertyMap>(dummy, "Should be an Instance of PropertyMap class!");
            dummy.Add(2, new PropertyValue(400.0f));

            var testingTarget = new PropertyValue(dummy);

            Assert.IsNotNull(testingTarget, "Should be not null!");
            Assert.IsInstanceOf <PropertyValue>(testingTarget, "Should be an Instance of PropertyValue class!");

            PropertyMap propertyMap = new PropertyMap();
            var         result      = testingTarget.Get(propertyMap);

            Assert.IsTrue(result);

            PropertyValue propertyValue = propertyMap[2];
            float         temp          = 0.0f;

            propertyValue.Get(out temp);
            Assert.AreEqual(400.0f, temp, "should be equal.");

            testingTarget.Dispose();
            dummy.Dispose();
            tlog.Debug(tag, $"PropertyValueGetPropertyMapValue END (OK)");
        }
예제 #3
0
        public void PropertyValueGetPropertyArrayValue()
        {
            tlog.Debug(tag, $"PropertyValueGetPropertyArrayValue START");

            PropertyArray propertyArray = new PropertyArray();

            propertyArray.Add(new PropertyValue(3.0f));

            PropertyValue propertyValue = new PropertyValue(propertyArray);

            var testingTarget = new PropertyArray();

            Assert.IsNotNull(testingTarget, "Should be not null!");
            Assert.IsInstanceOf <PropertyArray>(testingTarget, "Should be an Instance of PropertyArray class!");

            var result = propertyValue.Get(testingTarget);

            Assert.IsTrue(result);

            float temp = 0.0f;

            testingTarget[0].Get(out temp);
            Assert.AreEqual(3.0f, temp, "should be equal.");

            testingTarget.Dispose();
            propertyValue.Dispose();
            propertyArray.Dispose();
            tlog.Debug(tag, $"PropertyValueGetPropertyArrayValue END (OK)");
        }
예제 #4
0
        public void PropertyMapInsertKeyWithString()
        {
            tlog.Debug(tag, $"PropertyMapInsertKeyWithString START");

            var testingTarget = new PropertyMap();

            Assert.IsNotNull(testingTarget, "should not be null.");
            Assert.IsInstanceOf <PropertyMap>(testingTarget, "should be an instance of PropertyMap class!");

            var dummy = new PropertyValue(14.0f);

            Assert.IsNotNull(dummy, "should not be null.");
            Assert.IsInstanceOf <PropertyValue>(dummy, "should be an instance of PropertyValue class!");

            testingTarget.Insert("A", dummy);
            PropertyValue value  = testingTarget["A"];
            float         result = 0;

            value.Get(out result);
            Assert.IsTrue(result == 14);

            dummy.Dispose();
            testingTarget.Dispose();
            tlog.Debug(tag, $"PropertyMapInsertKeyWithString END (OK)");
        }
예제 #5
0
        public void PropertyMapFindWithIntAndStringKey()
        {
            tlog.Debug(tag, $"PropertyMapFindWithIntAndStringKey START");

            var testingTarget = new PropertyMap();

            Assert.IsNotNull(testingTarget, "should not be null.");
            Assert.IsInstanceOf <PropertyMap>(testingTarget, "should be an instance of PropertyMap class!");

            var dummy = new PropertyValue("DALI");

            Assert.IsNotNull(dummy, "should not be null.");
            Assert.IsInstanceOf <PropertyValue>(dummy, "should be an instance of PropertyValue class!");

            testingTarget.Add("A", dummy);
            PropertyValue value  = testingTarget.Find(10, "A");
            string        result = "";

            value.Get(out result);
            Assert.AreEqual("DALI", result, "Retrive result should equal to the set value.");

            dummy.Dispose();
            testingTarget.Dispose();
            tlog.Debug(tag, $"PropertyMapFindWithIntAndStringKey END (OK)");
        }
예제 #6
0
        public void StyleManagerGetConstant()
        {
            tlog.Debug(tag, $"StyleManagerGetConstant START");

            var testingTarget = StyleManager.Get();

            Assert.IsNotNull(testingTarget, "The value of Get return should not be null");
            Assert.IsInstanceOf <StyleManager>(testingTarget, "Should be an instance of StyleManager type.");

            using (PropertyValue value = new PropertyValue(100))
            {
                testingTarget.AddConstant("key", value);

                PropertyValue result = new PropertyValue();
                testingTarget.GetConstant("key", result);

                int num1 = 0;
                int num2 = 0;
                value.Get(out num1);
                result.Get(out num2);
                Assert.IsTrue(num1 == num2, "The get value of StyleConstant should be equals to the set");
            }

            testingTarget.Dispose();
            tlog.Debug(tag, $"StyleManagerGetConstant END (OK)");
        }
예제 #7
0
        public void PropertyValueGetPropertyStringValue()
        {
            tlog.Debug(tag, $"PropertyValueGetPropertyStringValue START");

            var testingTarget = new PropertyValue("DALI");

            Assert.IsNotNull(testingTarget, "Should be not null!");
            Assert.IsInstanceOf <PropertyValue>(testingTarget, "Should be an Instance of PropertyValue class!");

            string result = "";

            testingTarget.Get(out result);
            Assert.AreEqual("DALI", result, "should be equal.");

            testingTarget.Dispose();
            tlog.Debug(tag, $"PropertyValueGetPropertyStringValue END (OK)");
        }
예제 #8
0
        public void PropertyValueGetIntegerValue()
        {
            tlog.Debug(tag, $"PropertyValueGetIntegerValue START");

            var testingTarget = new PropertyValue(20);

            Assert.IsNotNull(testingTarget, "Should be not null!");
            Assert.IsInstanceOf <PropertyValue>(testingTarget, "should be an Instance of PropertyValue class.");

            int result = 0;

            testingTarget.Get(out result);
            Assert.IsTrue(20 == result);

            testingTarget.Dispose();
            tlog.Debug(tag, $"PropertyValueGetIntegerValue END (OK)");
        }
예제 #9
0
        public Tuple <int, int> GetMinMaxFrame()
        {
            NUILog.Debug($"< [{GetId()}] GetMinMaxFrame()! total frame={currentStates.totalFrame}");

            PropertyMap map = Image;

            if (map != null)
            {
                PropertyValue val = map.Find(ImageVisualProperty.PlayRange);
                if (val != null)
                {
                    PropertyArray array = new PropertyArray();
                    if (val.Get(array))
                    {
                        uint cnt = array.Count();
                        int  item1 = -1, item2 = -1;
                        for (uint i = 0; i < cnt; i++)
                        {
                            PropertyValue v = array.GetElementAt(i);
                            int           intRet;
                            if (v.Get(out intRet))
                            {
                                NUILog.Debug($"Got play range of string [{i}]: {intRet}");
                                if (i == 0)
                                {
                                    item1 = intRet;
                                }
                                else if (i == 1)
                                {
                                    item2 = intRet;
                                }
                            }
                            else
                            {
                                Tizen.Log.Error("NUI", $"[ERR] fail to get play range from dali! case#1");
                            }
                        }
                        NUILog.Debug($"  [{GetId()}] GetMinMaxFrame(min:{item1}, max:{item2})! >");
                        return(new Tuple <int, int>(item1, item2));
                    }
                }
            }
            Tizen.Log.Error("NUI", $"[ERR] fail to get play range from dali! case#2");
            return(new Tuple <int, int>(-1, -1));
        }
예제 #10
0
        public Vector2 GetPlayRange()
        {
            Vector2     ret = new Vector2(-1.0f, -1.0f);
            PropertyMap map = Image;

            if (map != null)
            {
                PropertyValue val = map.Find(ImageVisualProperty.PlayRange);
                if (val != null)
                {
                    if (val.Get(ret))
                    {
                        return(ret);
                    }
                }
            }
            tizenlog.Error(tag, $"[ERROR] fail to get PlayRange from dali");
            return(ret);
        }
예제 #11
0
        /// <summary>
        /// Get the list of layers' information such as the start frame and the end frame in the Lottie file.
        /// </summary>
        /// <returns>List of Tuple (string of layer name, integer of start frame, integer of end frame)</returns>
        /// <since_tizen> 7 </since_tizen>
        public List <Tuple <string, int, int> > GetContentInfo()
        {
            NUILog.Debug($"<");
            if (currentStates.contentInfo != null)
            {
                return(currentStates.contentInfo);
            }

            PropertyMap imageMap   = base.Image;
            PropertyMap contentMap = new PropertyMap();

            if (imageMap != null)
            {
                PropertyValue val = imageMap.Find(ImageVisualProperty.ContentInfo);
                if (val != null)
                {
                    if (val.Get(contentMap))
                    {
                        currentStates.contentInfo = new List <Tuple <string, int, int> >();
                        for (uint i = 0; i < contentMap.Count(); i++)
                        {
                            string        key = contentMap.GetKeyAt(i).StringKey;
                            PropertyArray arr = new PropertyArray();
                            contentMap.GetValue(i).Get(arr);
                            if (arr != null)
                            {
                                int startFrame, endFrame;
                                arr.GetElementAt(0).Get(out startFrame);
                                arr.GetElementAt(1).Get(out endFrame);

                                NUILog.Debug($"[{i}] layer name={key}, startFrame={startFrame}, endFrame={endFrame}");

                                Tuple <string, int, int> item = new Tuple <string, int, int>(key, startFrame, endFrame);

                                currentStates.contentInfo?.Add(item);
                            }
                        }
                    }
                }
            }
            NUILog.Debug($">");
            return(currentStates.contentInfo);
        }
예제 #12
0
        public void PropertyValueGetVector2Value()
        {
            tlog.Debug(tag, $"PropertyValueGetVector2Value START");

            var testingTarget = new PropertyValue();

            Assert.IsNotNull(testingTarget, "Should be not null!");
            Assert.IsInstanceOf <PropertyValue>(testingTarget, "should be an Instance of PropertyValue class.");

            var dummy = new Vector2(1, 2);

            Assert.IsNotNull(dummy, "Should be not null!");
            Assert.IsInstanceOf <Vector2>(dummy, "should be an Instance of PropertyValue class.");

            testingTarget.Get(dummy);
            Assert.IsTrue(1 == dummy.X);
            Assert.IsTrue(2 == dummy.Y);

            tlog.Debug(tag, $"PropertyValueGetVector2Value END (OK)");
        }
예제 #13
0
        public void StringValuePairConstructorSecond()
        {
            tlog.Debug(tag, $"StringValuePairConstructorSecond START");

            using (StringValuePair pair = new StringValuePair("opacity", new PropertyValue(0.3f)))
            {
                var testingTarget = new StringValuePair(pair);
                Assert.IsNotNull(testingTarget, "Should be not null!");
                Assert.IsInstanceOf <StringValuePair>(testingTarget, "Should be an Instance of TouchPoint!");

                testingTarget.second = new PropertyValue("vertical");
                PropertyValue value  = testingTarget.second;
                string        result = "";
                value.Get(out result);
                Assert.AreEqual("vertical", result, "Should be equal!");

                testingTarget.Dispose();
            }

            tlog.Debug(tag, $"StringValuePairConstructorSecond END (OK)");
        }
예제 #14
0
        public void PropertyValueGetSize2DValue()
        {
            tlog.Debug(tag, $"PropertyValueGetSize2DValue START");

            var testingTarget = new PropertyValue(new Size2D(1, 2));

            Assert.IsNotNull(testingTarget, "Should be not null!");
            Assert.IsInstanceOf <PropertyValue>(testingTarget, "should be an Instance of PropertyValue class.");

            Size2D size   = new Size2D(3, 4);
            var    result = testingTarget.Get(size);

            Assert.IsTrue(result);

            Assert.AreEqual(1, size.Width, "Get function with Size2D parameter does not work, Size2D.Width is not right");
            Assert.AreEqual(2, size.Height, "Get function with Size2D parameter does not work, Size2D.Height is not right");

            size.Dispose();
            testingTarget.Dispose();
            tlog.Debug(tag, $"PropertyValueGetSize2DValue END (OK)");
        }
예제 #15
0
        public void PropertyValueGetPosition2DValue()
        {
            tlog.Debug(tag, $"PropertyValueGetPosition2DValue START");

            var testingTarget = new PropertyValue(new Position2D(1, 2));

            Assert.IsNotNull(testingTarget, "Should be not null!");
            Assert.IsInstanceOf <PropertyValue>(testingTarget, "Should be an Instance of PropertyValue class!");

            Position2D position = new Position2D(4, 5);
            var        result   = testingTarget.Get(position);

            Assert.IsTrue(result);

            Assert.AreEqual(1, position.X, "should be equal.");
            Assert.AreEqual(2, position.Y, "should be equal.");

            position.Dispose();
            testingTarget.Dispose();
            tlog.Debug(tag, $"PropertyValueGetPosition2DValue END (OK)");
        }
예제 #16
0
        public void PropertyValueGetVector3Value()
        {
            tlog.Debug(tag, $"PropertyValueGetVector3Value START");

            PropertyValue testingTarget = new PropertyValue(new Vector3(1, 2, 3));

            Assert.IsNotNull(testingTarget, "Should be not null!");
            Assert.IsInstanceOf <PropertyValue>(testingTarget, "Should be an Instance of PropertyValue class!");

            Vector3 vector = new Vector3(3, 2, 1);
            var     result = testingTarget.Get(vector);

            Assert.IsTrue(result);

            Assert.AreEqual(1, vector.X, "Get function with Vector3 parameter does not work, Vector.X is not right");
            Assert.AreEqual(2, vector.Y, "Get function with Vector3 parameter does not work, Vector.Y is not right");
            Assert.AreEqual(3, vector.Z, "Get function with Vector3 parameter does not work, Vector.Z is not right");

            vector.Dispose();
            testingTarget.Dispose();
            tlog.Debug(tag, $"PropertyValueGetVector3Value END (OK)");
        }
예제 #17
0
        public void PropertyValueGetRectangleValue()
        {
            tlog.Debug(tag, $"PropertyValueGetRectangleValue START");

            var testingTarget = new PropertyValue(new Rectangle(1, 2, 3, 4));

            Assert.IsNotNull(testingTarget, "Should be not null!");
            Assert.IsInstanceOf <PropertyValue>(testingTarget, "should be an Instance of PropertyValue class.");

            Rectangle rectangle = new Rectangle(0, 0, 0, 0);
            var       result    = testingTarget.Get(rectangle);

            Assert.IsTrue(result);

            Assert.AreEqual(1, rectangle.X, "should be equal.");
            Assert.AreEqual(2, rectangle.Y, "should be equal.");
            Assert.AreEqual(3, rectangle.Width, "should be equal.");
            Assert.AreEqual(4, rectangle.Height, "should be equal.");

            rectangle.Dispose();
            testingTarget.Dispose();
            tlog.Debug(tag, $"PropertyValueGetRectangleValue END (OK)");
        }
예제 #18
0
        public void PropertyValueGetColorValue()
        {
            tlog.Debug(tag, $"PropertyValueGetColorValue START");

            Color dummy         = new Color(1.0f, 0.5f, 1.0f, 0.5f);
            var   testingTarget = new PropertyValue(dummy);

            Assert.IsNotNull(testingTarget, "Should be not null!");
            Assert.IsInstanceOf <PropertyValue>(testingTarget, "Should be an Instance of PropertyValue class!");

            Color color = new Color(0, 0, 0, 0);

            testingTarget.Get(color);
            Assert.AreEqual(1.0f, color.R, "Get function with Color parameter does not work, color.R is not right.");
            Assert.AreEqual(0.5f, color.G, "Get function with Color parameter does not work, color.G is not right.");
            Assert.AreEqual(1.0f, color.B, "Get function with Color parameter does not work, color.B is not right.");
            Assert.AreEqual(0.5f, color.A, "Get function with Color parameter does not work, color.A is not right.");

            color.Dispose();
            testingTarget.Dispose();
            dummy.Dispose();
            tlog.Debug(tag, $"PropertyValueGetColorValue END (OK)");
        }
예제 #19
0
        public void PropertyValueGetExtentsValue()
        {
            tlog.Debug(tag, $"PropertyValueGetExtentsValue START");

            var testingTarget = new PropertyValue(new Extents(1, 2, 3, 4));

            Assert.IsNotNull(testingTarget, "Should be not null!");
            Assert.IsInstanceOf <PropertyValue>(testingTarget, "Should be an Instance of PropertyValue class!");

            Extents extents = new Extents(0, 0, 0, 0);
            var     result  = testingTarget.Get(extents);

            Assert.IsTrue(result);

            Assert.AreEqual(1, extents.Start, "should be equal.");
            Assert.AreEqual(2, extents.End, "should be equal.");
            Assert.AreEqual(3, extents.Top, "should be equal.");
            Assert.AreEqual(4, extents.Bottom, "should be equal.");

            extents.Dispose();
            testingTarget.Dispose();
            tlog.Debug(tag, $"PropertyValueGetExtentsValue END (OK)");
        }
예제 #20
0
        public void PropertyValueGetVector4Value()
        {
            tlog.Debug(tag, $"PropertyValueGetVector4Value START");

            var testingTarget = new PropertyValue(new Vector4(10, 20, 30, 40));

            Assert.IsNotNull(testingTarget, "Should be not null!");
            Assert.IsInstanceOf <PropertyValue>(testingTarget, "Should be an Instance of PropertyValue class!");

            Vector4 vector = new Vector4(100, 200, 300, 400);
            var     result = testingTarget.Get(vector);

            Assert.IsTrue(result);

            Assert.AreEqual(10, vector.X, "should be equal.");
            Assert.AreEqual(20, vector.Y, "should be equal.");
            Assert.AreEqual(30, vector.Z, "should be equal.");
            Assert.AreEqual(40, vector.W, "should be equal.");

            vector.Dispose();
            testingTarget.Dispose();
            tlog.Debug(tag, $"PropertyValueGetVector4Value END (OK)");
        }
예제 #21
0
        public void AlphaFunctionBuiltinToPropertyKey()
        {
            tlog.Debug(tag, $"AlphaFunctionBuiltinToPropertyKey START");

            PropertyValue pvAlpha = null;
            string        result  = null;

            pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(AlphaFunction.BuiltinFunctions.Linear));
            pvAlpha.Get(out result);
            Assert.AreEqual("LINEAR", result, "Should be equal!");

            pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(AlphaFunction.BuiltinFunctions.Reverse));
            pvAlpha.Get(out result);
            Assert.AreEqual("REVERSE", result, "Should be equal!");

            pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(AlphaFunction.BuiltinFunctions.EaseInSquare));
            pvAlpha.Get(out result);
            Assert.AreEqual("EASE_IN_SQUARE", result, "Should be equal!");

            pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(AlphaFunction.BuiltinFunctions.EaseOutSquare));
            pvAlpha.Get(out result);
            Assert.AreEqual("EASE_OUT_SQUARE", result, "Should be equal!");

            pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(AlphaFunction.BuiltinFunctions.EaseIn));
            pvAlpha.Get(out result);
            Assert.AreEqual("EASE_IN", result, "Should be equal!");

            pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(AlphaFunction.BuiltinFunctions.EaseOut));
            pvAlpha.Get(out result);
            Assert.AreEqual("EASE_OUT", result, "Should be equal!");

            pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(AlphaFunction.BuiltinFunctions.EaseInOut));
            pvAlpha.Get(out result);
            Assert.AreEqual("EASE_IN_OUT", result, "Should be equal!");

            pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(AlphaFunction.BuiltinFunctions.EaseInSine));
            pvAlpha.Get(out result);
            Assert.AreEqual("EASE_IN_SINE", result, "Should be equal!");

            pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(AlphaFunction.BuiltinFunctions.EaseOutSine));
            pvAlpha.Get(out result);
            Assert.AreEqual("EASE_OUT_SINE", result, "Should be equal!");

            pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(AlphaFunction.BuiltinFunctions.EaseInOutSine));
            pvAlpha.Get(out result);
            Assert.AreEqual("EASE_IN_OUT_SINE", result, "Should be equal!");

            pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(AlphaFunction.BuiltinFunctions.Bounce));
            pvAlpha.Get(out result);
            Assert.AreEqual("BOUNCE", result, "Should be equal!");

            pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(AlphaFunction.BuiltinFunctions.Sin));
            pvAlpha.Get(out result);
            Assert.AreEqual("SIN", result, "Should be equal!");

            pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(AlphaFunction.BuiltinFunctions.EaseOutBack));
            pvAlpha.Get(out result);
            Assert.AreEqual("EASE_OUT_BACK", result, "Should be equal!");

            pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(AlphaFunction.BuiltinFunctions.Default));
            pvAlpha.Get(out result);
            Assert.AreEqual("DEFAULT", result, "Should be equal!");

            result = null;
            pvAlpha.Dispose();
            tlog.Debug(tag, $"AlphaFunctionBuiltinToPropertyKey END (OK)");
        }