Ejemplo n.º 1
0
        public void RecyclerViewItemOnKey()
        {
            tlog.Debug(tag, $"RecyclerViewItem START");

            var testingTarget = new RecyclerViewItem("Tizen.NUI.Components.RecyclerViewItem");

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

            var key = new Key()
            {
                State          = Key.StateType.Up,
                KeyPressedName = "Return"
            };

            Assert.IsFalse(testingTarget.OnKey(key), "should not be processed.");

            key = new Key()
            {
                State          = Key.StateType.Down,
                KeyPressedName = "Return"
            };
            Assert.IsFalse(testingTarget.OnKey(key), "should not be processed.");

            testingTarget.Dispose();
            tlog.Debug(tag, $"RecyclerViewItem END (OK)");
        }
Ejemplo n.º 2
0
        public void RecyclerViewItemTemplate()
        {
            tlog.Debug(tag, $"RecyclerViewItem START");

            var testingTarget = new RecyclerViewItem("Tizen.NUI.Components.RecyclerViewItem");

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

            testingTarget.Template = new DataTemplate(() =>
            {
                var rand = new Random();
                DefaultLinearItem item = new DefaultLinearItem();
                //Set Width Specification as MatchParent to fit the Item width with parent View.
                item.WidthSpecification = LayoutParamPolicies.MatchParent;

                //Decorate Label
                item.Label.SetBinding(TextLabel.TextProperty, "ViewLabel");
                item.Label.HorizontalAlignment = HorizontalAlignment.Begin;

                //Decorate SubLabel
                if ((rand.Next() % 2) == 0)
                {
                    item.SubLabel.SetBinding(TextLabel.TextProperty, "Name");
                    item.SubLabel.HorizontalAlignment = HorizontalAlignment.Begin;
                }

                return(item);
            });
            Assert.IsNotNull(testingTarget.Template, "should not be null.");

            testingTarget.Dispose();
            tlog.Debug(tag, $"RecyclerViewItem END (OK)");
        }
Ejemplo n.º 3
0
        public void GridLayouterNotifyItemInserted()
        {
            tlog.Debug(tag, $"GridLayouterNotifyItemInserted");

            var view = new CollectionView(new List <string>()
            {
                "123", "456"
            })
            {
                Header    = new RecyclerViewItem(),
                Footer    = new RecyclerViewItem(),
                IsGrouped = true,
            };

            Assert.IsNotNull(view, "Should not be null");

            view.GroupFooterTemplate = new DataTemplate(typeof(RecyclerViewItem));
            view.GroupHeaderTemplate = new DataTemplate(typeof(RecyclerViewItem));
            view.ItemTemplate        = new DataTemplate(typeof(RecyclerViewItem));

            var gridLayouter = new GridLayouter();

            Assert.IsNotNull(gridLayouter, "Should not be null");

            gridLayouter.Initialize(view);
            gridLayouter.RequestLayout(100.0f);

            var source = new CustomGroupItemSource(view)
            {
                Position = 1,
            };

            gridLayouter.NotifyItemInserted(source, 0);

            source.Position = 4;
            gridLayouter.NotifyItemInserted(source, 0);

            gridLayouter.NotifyItemInserted(source, 1);

            var emptySource = new CustomEmptySource();

            gridLayouter.NotifyItemInserted(emptySource, 1);

            var item = new RecyclerViewItem()
            {
                Size = new Size(200, 100),
            };

            gridLayouter.NotifyItemSizeChanged(item);
            item.Dispose();

            view.Dispose();
            gridLayouter.Dispose();

            source.Dispose();
            emptySource.Dispose();

            tlog.Debug(tag, $"GridLayouterNotifyItemInserted END (OK)");
        }
Ejemplo n.º 4
0
        public void RecyclerViewItemConstructorWithStyle()
        {
            tlog.Debug(tag, $"RecyclerViewItem START");

            var testingTarget = new RecyclerViewItem("Tizen.NUI.Components.RecyclerViewItem");

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

            testingTarget.Dispose();
            tlog.Debug(tag, $"RecyclerViewItem END (OK)");
        }
Ejemplo n.º 5
0
        public void RecyclerViewItemIndex()
        {
            tlog.Debug(tag, $"RecyclerViewItem START");

            var testingTarget = new RecyclerViewItem("Tizen.NUI.Components.RecyclerViewItem");

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

            testingTarget.Index = 0;
            Assert.AreEqual(testingTarget.Index, 0, "should be equal to 0.");

            testingTarget.Dispose();
            tlog.Debug(tag, $"RecyclerViewItem END (OK)");
        }
Ejemplo n.º 6
0
        public void RecyclerViewItemIsSelected()
        {
            tlog.Debug(tag, $"RecyclerViewItem START");

            var testingTarget = new RecyclerViewItem("Tizen.NUI.Components.RecyclerViewItem");

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

            testingTarget.IsSelected = true;
            Assert.IsTrue(testingTarget.IsSelected, "should be selected.");

            testingTarget.Dispose();
            tlog.Debug(tag, $"RecyclerViewItem END (OK)");
        }
Ejemplo n.º 7
0
        public void RecyclerViewItemConstructorWithItemStyle()
        {
            tlog.Debug(tag, $"RecyclerViewItem START");

            var style = new RecyclerViewItemStyle()
            {
                BackgroundColor = new Selector <Color>()
                {
                    Normal   = new Color(1, 1, 1, 1),
                    Pressed  = new Color(0.85f, 0.85f, 0.85f, 1),
                    Disabled = new Color(0.70f, 0.70f, 0.70f, 1),
                    Selected = new Color(0.701f, 0.898f, 0.937f, 1),
                },
            };
            var testingTarget = new RecyclerViewItem(style);

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

            testingTarget.Dispose();
            tlog.Debug(tag, $"RecyclerViewItem END (OK)");
        }
Ejemplo n.º 8
0
        public void LinearLayouterNotifyItemSizeChanged()
        {
            tlog.Debug(tag, $"LinearLayouterNotifyItemSizeChanged");

            var view = new CollectionView(new List <string>()
            {
                "123"
            })
            {
                Header    = new RecyclerViewItem(),
                IsGrouped = false,
            };

            Assert.IsNotNull(view, "Should not be null");

            view.GroupHeaderTemplate = new DataTemplate(typeof(RecyclerViewItem));
            view.ItemTemplate        = new DataTemplate(typeof(RecyclerViewItem));

            var emptySource = new CustomEmptySource();

            var linearLayouter = new LinearLayouter();

            Assert.IsNotNull(linearLayouter, "Should not be null");

            linearLayouter.Initialize(view);

            var item = new RecyclerViewItem()
            {
                Size = new Size(200, 100),
            };

            //linearLayouter.NotifyItemSizeChanged(item);
            item.Dispose();

            view.Dispose();
            linearLayouter.Dispose();

            tlog.Debug(tag, $"LinearLayouterNotifyItemSizeChanged END (OK)");
        }