Beispiel #1
0
        public void DefaultGridItemConstructorWithItemStyle()
        {
            tlog.Debug(tag, $"DefaultGridItem START");

            var itemStyle = new DefaultGridItemStyle()
            {
                Padding = new Extents(0, 0, 0, 0),
                Margin  = new Extents(5, 5, 5, 5),
                Label   = new TextLabelStyle()
                {
                    SizeHeight           = 60,
                    PixelSize            = 24,
                    LineWrapMode         = LineWrapMode.Character,
                    ThemeChangeSensitive = false
                },
                Badge = new ViewStyle()
                {
                    Margin = new Extents(5, 5, 5, 5),
                },
            };

            var testingTarget = new DefaultGridItem(itemStyle);

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

            testingTarget.Dispose();
            tlog.Debug(tag, $"DefaultGridItem END (OK)");
        }
Beispiel #2
0
        public async Task DefaultGridItemImageNull()
        {
            tlog.Debug(tag, $"DefaultGridItem START");

            TaskCompletionSource <bool> tcs = new TaskCompletionSource <bool>(false);
            EventHandler onRelayout         = (s, e) => { tcs.TrySetResult(true); };

            var testingTarget = new DefaultGridItem();

            testingTarget.Relayout += onRelayout;

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

            Window.Instance.Add(testingTarget);
            var result = await tcs.Task;

            Assert.IsTrue(result, "Relayout event should be invoked");

            Assert.IsNotNull(testingTarget.Image, "DefaultGridItem image should not be null.");

            if (testingTarget != null)
            {
                Window.Instance.Remove(testingTarget);
                testingTarget.Dispose();
                testingTarget = null;
            }
            tlog.Debug(tag, $"DefaultGridItem END (OK)");
        }
        public void Activate()
        {
            Window window = NUIApplication.GetDefaultWindow();

            var myViewModelSource = gallerySource = new GalleryViewModel(itemCount);

            // Add test menu options.
            gallerySource.Insert(0, moveMenu);
            gallerySource.Insert(0, deleteMenu);
            gallerySource.Insert(0, insertMenu);

            selMode = ItemSelectionMode.Multiple;
            DefaultTitleItem myTitle = new DefaultTitleItem();

            myTitle.Text = "Grid Sample Count[" + itemCount + "]";
            //Set Width Specification as MatchParent to fit the Item width with parent View.
            myTitle.WidthSpecification = LayoutParamPolicies.MatchParent;

            colView = new CollectionView()
            {
                ItemsSource   = myViewModelSource,
                ItemsLayouter = new GridLayouter(),
                ItemTemplate  = new DataTemplate(() =>
                {
                    DefaultGridItem item     = new DefaultGridItem();
                    item.WidthSpecification  = 180;
                    item.HeightSpecification = 240;
                    //Decorate Label
                    item.Label.SetBinding(TextLabel.TextProperty, "ViewLabel");
                    item.Label.HorizontalAlignment = HorizontalAlignment.Center;
                    //Decorate Image
                    item.Image.SetBinding(ImageView.ResourceUrlProperty, "ImageUrl");
                    item.Image.WidthSpecification  = 170;
                    item.Image.HeightSpecification = 170;
                    //Decorate Badge checkbox.
                    //[NOTE] This is sample of CheckBox usage in CollectionView.
                    // Checkbox change their selection by IsSelectedProperty bindings with
                    // SelectionChanged event with Mulitple ItemSelectionMode of CollectionView.
                    item.Badge = new CheckBox();
                    //FIXME : SetBinding in RadioButton crashed as Sensitive Property is disposed.
                    //item.Badge.SetBinding(CheckBox.IsSelectedProperty, "Selected");
                    item.Badge.WidthSpecification  = 30;
                    item.Badge.HeightSpecification = 30;

                    return(item);
                }),
                Header              = myTitle,
                ScrollingDirection  = ScrollableBase.Direction.Vertical,
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
                SelectionMode       = selMode
            };
            colView.SelectionChanged += SelectionEvt;

            window.Add(colView);
        }
Beispiel #4
0
        public void DefaultGridItemConstructorWithStyle()
        {
            tlog.Debug(tag, $"DefaultGridItem START");

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

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

            testingTarget.Dispose();
            tlog.Debug(tag, $"DefaultGridItem END (OK)");
        }
Beispiel #5
0
        public void DefaultGridItemLabelOrientationType()
        {
            tlog.Debug(tag, $"DefaultGridItem START");

            var testingTarget = new DefaultGridItem();

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

            testingTarget.LabelOrientationType = DefaultGridItem.LabelOrientation.InsideBottom;
            Assert.AreEqual(testingTarget.LabelOrientationType, DefaultGridItem.LabelOrientation.InsideBottom, "DefaultGridItem LabelOrientationType should be equal to original value.");

            testingTarget.Dispose();
            tlog.Debug(tag, $"DefaultGridItem END (OK)");
        }
Beispiel #6
0
        public void DefaultGridItemText()
        {
            tlog.Debug(tag, $"DefaultGridItem START");

            var testingTarget = new DefaultGridItem();

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

            testingTarget.Text = "test";
            Assert.AreEqual(testingTarget.Text, "test", "DefaultGridItem Text should be equal to original text.");

            testingTarget.Dispose();
            tlog.Debug(tag, $"DefaultGridItem END (OK)");
        }
        DefaultGridItem CreateItem(int width, int height, string resource = null, string text = null)
        {
            var item = new DefaultGridItem()
            {
                WidthSpecification   = width,
                HeightSpecification  = height,
                LabelOrientationType = DefaultGridItem.LabelOrientation.InsideBottom,
            };

            item.Image.ResourceUrl        = resource;
            item.Image.WidthResizePolicy  = ResizePolicyType.FillToParent;
            item.Image.HeightResizePolicy = ResizePolicyType.FillToParent;
            if (text != null)
            {
                item.Text = text;
            }
            return(item);
        }
Beispiel #8
0
        public void DefaultGridItemLabel()
        {
            tlog.Debug(tag, $"DefaultGridItem START");

            var testingTarget = new DefaultGridItem();

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

            testingTarget.Label = new TextLabel()
            {
                WidthSpecification  = 170,
                HeightSpecification = 170,
            };
            Assert.IsNotNull(testingTarget.Label, "DefaultGridItem Label should not be null.");

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