Пример #1
0
        public void PropertyMapMerge()
        {
            tlog.Debug(tag, $"PropertyMapMerge START");

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

            var dummyValue1 = new PropertyValue(5);
            Assert.IsNotNull(dummyValue1, "should not be null.");
            Assert.IsInstanceOf<PropertyValue>(dummyValue1, "should be an instance of PropertyValue class!");
            testingTarget.Add(100, dummyValue1);

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

            var dummyValue2 = new PropertyValue(6);
            Assert.IsNotNull(dummyValue2, "should not be null.");
            Assert.IsInstanceOf<PropertyValue>(dummyValue2, "should be an instance of PropertyValue class!");
            dummy.Add("A", dummyValue2);

            testingTarget.Merge(dummy);
            Assert.AreEqual(2, testingTarget.Count(), "Retrive dummy1.Count() should equal to 2.");

            dummyValue2.Dispose();
            dummy.Dispose();
            dummyValue1.Dispose();
            testingTarget.Dispose();
            tlog.Debug(tag, $"PropertyMapMerge END (OK)");
        }
Пример #2
0
        public void PropertyMapCount()
        {
            tlog.Debug(tag, $"PropertyMapCount START");

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

            var dummy1 = new PropertyValue(4.0f);
            Assert.IsNotNull(dummy1, "should not be null.");
            Assert.IsInstanceOf<PropertyValue>(dummy1, "should be an instance of PropertyValue class!");

            testingTarget.Insert(8, dummy1);
            
            var dummy2 = new PropertyValue(5.0f);
            Assert.IsNotNull(dummy2, "should not be null.");
            Assert.IsInstanceOf<PropertyValue>(dummy2, "should be an instance of PropertyValue class!");

            testingTarget.Insert(18, dummy2);
            Assert.AreEqual(2, testingTarget.Count(), "Retrive testingTarget.Count() should equal to 2.");

            dummy1.Dispose();
            dummy2.Dispose();
            testingTarget.Dispose();
            tlog.Debug(tag, $"PropertyMapCount END (OK)");
        }
Пример #3
0
        public void PropertyMapAddWithKeyValue()
        {
            tlog.Debug(tag, $"PropertyMapAddWithKeyValue 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 KeyValue();

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

            dummy.KeyInt      = 300;
            dummy.SingleValue = 4.0f;
            testingTarget.Add(dummy);

            // keyValue.KeyString != null
            //KeyValue dummy2 = new KeyValue()
            //{
            //    KeyString = "myKey"
            //};
            //testingTarget.Add(dummy2);

            Assert.AreEqual(1, testingTarget.Count(), "Add with string and PropertyValue parameter function does not work");

            dummy.Dispose();
            //dummy2.Dispose();
            testingTarget.Dispose();
            tlog.Debug(tag, $"PropertyMapAddWithKeyValue END (OK)");
        }
Пример #4
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);
        }
Пример #5
0
        public void PropertyMapAddKeyWithInt()
        {
            tlog.Debug(tag, $"PropertyMapAddKeyWithInt START");

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

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

            testingTarget.Add(300, dummy);
            Assert.AreEqual(1, testingTarget.Count(), "Retrive testingTarget.Count() should equal to 1.");

            dummy.Dispose();
            testingTarget.Dispose();
            tlog.Debug(tag, $"PropertyMapAddKeyWithInt END (OK)");
        }
Пример #6
0
        public void VisualMapComposingPropertyMap()
        {
            tlog.Debug(tag, $"VisualMapComposingPropertyMap START");

            flagComposingPropertyMap = false;
            Assert.False(flagComposingPropertyMap, "flagComposingPropertyMap should false initial");

            var testingTarget = new MyVisualMap();

            Assert.IsInstanceOf <VisualMap>(testingTarget, "Should be an instance of VisualMap type.");

            PropertyMap propertyMap = testingTarget.OutputVisualMap;

            Assert.AreEqual(0, propertyMap.Count(), "Retrieved PropertyMap count should be 0");
            Assert.True(flagComposingPropertyMap, "ComposingPropertyMap overrided method not invoked.");

            testingTarget.Dispose();
            tlog.Debug(tag, $"VisualMapComposingPropertyMap END (OK)");
        }
Пример #7
0
        public void PropertyMapClear()
        {
            tlog.Debug(tag, $"PropertyMapClear 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(5);
            Assert.IsNotNull(dummy, "should not be null.");
            Assert.IsInstanceOf<PropertyValue>(dummy, "should be an instance of PropertyValue class!");

            testingTarget.Add(100, dummy);
            testingTarget.Clear();
            Assert.AreEqual(0, testingTarget.Count(), "Retrive testingTarget.Count() should equal to 0.");

            dummy.Dispose();
            testingTarget.Dispose();
            tlog.Debug(tag, $"PropertyMapClear END (OK)");
        }