Ejemplo n.º 1
0
        public void TestMarginAndStretchColumn()
        {
            var view0 = new View {
                IsPlatformEnabled = true, Margin = new Thickness(10, 0, 10, 0)
            };

            FlexLayout.SetGrow(view0, 1);
            var layout = new FlexLayout
            {
                IsPlatformEnabled = true,
                Children          =
                {
                    view0,
                },
                Direction = FlexDirection.Column,
            };

            layout.Layout(new Rectangle(0, 0, 100, 100));
            Assert.That(layout.Bounds, Is.EqualTo(new Rectangle(0, 0, 100, 100)));
            Assert.That(view0.Bounds, Is.EqualTo(new Rectangle(10, 0, 80, 100)));
        }
Ejemplo n.º 2
0
        public void TestSizeThatFits()
        {
            var platform = new UnitPlatform(useRealisticLabelMeasure: true);

            var layout = new FlexLayout {
                Direction         = FlexDirection.Row,
                AlignItems        = FlexAlignItems.Start,
                Platform          = platform,
                IsPlatformEnabled = true
            };

            var label1 = new Label {
                Platform          = platform,
                IsPlatformEnabled = true,
                LineBreakMode     = LineBreakMode.TailTruncation,
                Text = @"This is a very very very very very very very very long piece of text."
            };

            FlexLayout.SetShrink(label1, 1);
            layout.Children.Add(label1);

            var label2 = new Label {
                Text              = "",
                Platform          = platform,
                IsPlatformEnabled = true,
                WidthRequest      = 10,
                HeightRequest     = 10
            };

            layout.Children.Add(label2);
            layout.Layout(new Rectangle(0, 0, 320, 50));

            var label2Size = label2.Measure(double.PositiveInfinity, double.PositiveInfinity);

            Assert.AreEqual(10, label2Size.Request.Height);
            Assert.AreEqual(10, label2Size.Request.Width);

            var label1Size = label1.Measure(double.PositiveInfinity, double.PositiveInfinity);
            //	var layoutSize = layout.Measure(-1, -1);
        }
Ejemplo n.º 3
0
        public void TestOrderingElements()
        {
            var label0 = new Label {
                IsPlatformEnabled = true
            };
            var label1 = new Label {
                IsPlatformEnabled = true
            };
            var label2 = new Label {
                IsPlatformEnabled = true
            };
            var label3 = new Label {
                IsPlatformEnabled = true
            };

            FlexLayout.SetOrder(label3, 0);
            FlexLayout.SetOrder(label2, 1);
            FlexLayout.SetOrder(label1, 2);
            FlexLayout.SetOrder(label0, 3);

            var layout = new FlexLayout {
                IsPlatformEnabled = true,
                Direction         = FlexDirection.Column,
                Children          =
                {
                    label0,
                    label1,
                    label2,
                    label3
                }
            };

            layout.Layout(new Rectangle(0, 0, 912, 912));

            Assert.That(layout.Bounds, Is.EqualTo(new Rectangle(0, 0, 912, 912)));
            Assert.That(label3.Bounds, Is.EqualTo(new Rectangle(0, 0, 912, 20)));
            Assert.That(label2.Bounds, Is.EqualTo(new Rectangle(0, 20, 912, 20)));
            Assert.That(label1.Bounds, Is.EqualTo(new Rectangle(0, 40, 912, 20)));
            Assert.That(label0.Bounds, Is.EqualTo(new Rectangle(0, 60, 912, 20)));
        }
Ejemplo n.º 4
0
        public void ChangingGrowTriggersLayout()
        //https://github.com/xamarin/Microsoft.Maui.Controls/issues/2821
        {
            var layout = new FlexLayout
            {
                IsPlatformEnabled = true,
                Direction         = FlexDirection.Column,
            };

            layout.Layout(new Rectangle(0, 0, 300, 300));
            for (var i = 0; i < 3; i++)
            {
                var box = new BoxView
                {
                    IsPlatformEnabled = true,
                };
                layout.Children.Add(box);
                FlexLayout.SetGrow(box, 1f);
            }

            Assert.That(layout.Children[2].Bounds, Is.EqualTo(new Rectangle(0, 200, 300, 100)));
        }
        public void TestMarginBottom()
        {
            var platform = new UnitPlatform();
            var view0    = new View {
                Platform = platform, IsPlatformEnabled = true, HeightRequest = 10, Margin = new Thickness(0, 0, 0, 10),
            };
            var layout = new FlexLayout {
                Platform          = platform,
                IsPlatformEnabled = true,
                Children          =
                {
                    view0,
                },

                Direction      = FlexDirection.Column,
                JustifyContent = FlexJustify.End,
            };

            layout.Layout(new Rectangle(0, 0, 100, 100));
            Assert.That(layout.Bounds, Is.EqualTo(new Rectangle(0, 0, 100, 100)));
            Assert.That(view0.Bounds, Is.EqualTo(new Rectangle(0, 80, 100, 10)));
        }
Ejemplo n.º 6
0
        //https://github.com/xamarin/Xamarin.Forms/issues/2551
        public void TestReverseWithGrow()
        {
            var platform = new UnitPlatform();
            var label0   = new Label {
                Platform          = platform,
                IsPlatformEnabled = true,
            };

            FlexLayout.SetGrow(label0, 1);
            var layout = new FlexLayout {
                Platform          = platform,
                IsPlatformEnabled = true,
                Direction         = FlexDirection.ColumnReverse,
                Children          =
                {
                    label0,
                }
            };

            layout.Layout(new Rectangle(0, 0, 300, 300));
            Assert.That(label0.Bounds, Is.EqualTo(new Rectangle(0, 0, 300, 300)));
        }
        public void TestMarginAndStretchRow()
        {
            var platform = new UnitPlatform();
            var view0    = new View {
                Platform = platform, IsPlatformEnabled = true, Margin = new Thickness(0, 10, 0, 10),
            };

            FlexLayout.SetGrow(view0, 1);
            var layout = new FlexLayout {
                Platform          = platform,
                IsPlatformEnabled = true,
                Children          =
                {
                    view0,
                },

                Direction = FlexDirection.Row,
            };

            layout.Layout(new Rectangle(0, 0, 100, 100));
            Assert.That(layout.Bounds, Is.EqualTo(new Rectangle(0, 0, 100, 100)));
            Assert.That(view0.Bounds, Is.EqualTo(new Rectangle(0, 10, 100, 80)));
        }
Ejemplo n.º 8
0
        public void TestIsVisible()
        //https://github.com/xamarin/Xamarin.Forms/issues/2593
        {
            var label0 = new Label {
                IsPlatformEnabled = true,
            };
            var label1 = new Label {
                IsPlatformEnabled = true,
            };
            var label2 = new Label {
                IsPlatformEnabled = true,
            };
            var layout = new FlexLayout {
                IsPlatformEnabled = true,
                Direction         = FlexDirection.Column,
                Children          =
                {
                    label0,
                    label1,
                    label2,
                }
            };

            layout.Layout(new Rectangle(0, 0, 300, 300));
            Assert.That(label0.Bounds, Is.EqualTo(new Rectangle(0, 0, 300, 20)));
            Assert.That(label1.Bounds, Is.EqualTo(new Rectangle(0, 20, 300, 20)));
            Assert.That(label2.Bounds, Is.EqualTo(new Rectangle(0, 40, 300, 20)));

            label1.IsVisible = false;
            Assert.That(label0.Bounds, Is.EqualTo(new Rectangle(0, 0, 300, 20)));
            Assert.That(label2.Bounds, Is.EqualTo(new Rectangle(0, 20, 300, 20)));

            label0.IsVisible = false;
            label1.IsVisible = true;
            Assert.That(label1.Bounds, Is.EqualTo(new Rectangle(0, 0, 300, 20)));
            Assert.That(label2.Bounds, Is.EqualTo(new Rectangle(0, 20, 300, 20)));
        }
Ejemplo n.º 9
0
        public void TestBasicLayoutWithElementsWidth()
        {
            var label1 = new Label {
                IsPlatformEnabled = true, WidthRequest = 120
            };
            var label2 = new Label {
                IsPlatformEnabled = true, WidthRequest = 120
            };

            var layout = new FlexLayout {
                IsPlatformEnabled = true,
                Children          =
                {
                    label1,
                    label2,
                }
            };

            layout.Layout(new Rectangle(0, 0, 912, 912));

            Assert.That(layout.Bounds, Is.EqualTo(new Rectangle(0, 0, 912, 912)));
            Assert.That(label1.Bounds, Is.EqualTo(new Rectangle(0, 0, 120, 912)));
            Assert.That(label2.Bounds, Is.EqualTo(new Rectangle(120, 0, 120, 912)));
        }
Ejemplo n.º 10
0
        public void TestBasicLayout()
        {
            var label1 = new Label {
                IsPlatformEnabled = true
            };
            var label2 = new Label {
                IsPlatformEnabled = true
            };

            var layout = new FlexLayout {
                IsPlatformEnabled = true,
                Children          =
                {
                    label1,
                    label2,
                }
            };

            layout.Layout(new Rectangle(0, 0, 912, 912));

            Assert.That(layout.Bounds, Is.EqualTo(new Rectangle(0, 0, 912, 912)));
            Assert.That(label1.Bounds, Is.EqualTo(new Rectangle(0, 0, 100, 912)));
            Assert.That(label2.Bounds, Is.EqualTo(new Rectangle(100, 0, 100, 912)));
        }
Ejemplo n.º 11
0
        public void TestAlignContentStretchRowWithFlexNoShrink()
        {
            var platform = new UnitPlatform();
            var layout   = new FlexLayout {
                Platform          = platform,
                IsPlatformEnabled = true,
                Direction         = FlexDirection.Row,
                AlignContent      = FlexAlignContent.Stretch,
                Wrap          = FlexWrap.Wrap,
                WidthRequest  = 150,
                HeightRequest = 100
            };
            var view0 = new View {
                IsPlatformEnabled = true, WidthRequest = 50
            };

            layout.Children.Add(view0);

            var view1 = new View {
                IsPlatformEnabled = true, WidthRequest = 50
            };

            FlexLayout.SetGrow(view1, 1);
            FlexLayout.SetShrink(view1, 1);
            FlexLayout.SetBasis(view1, 0);
            layout.Children.Add(view1);

            var view2 = new View {
                IsPlatformEnabled = true, WidthRequest = 50
            };

            layout.Children.Add(view2);

            var view3 = new View {
                IsPlatformEnabled = true, WidthRequest = 50
            };

            FlexLayout.SetGrow(view3, 1);
            FlexLayout.SetBasis(view3, 0);
            layout.Children.Add(view3);

            var view4 = new View {
                IsPlatformEnabled = true, WidthRequest = 50
            };

            layout.Children.Add(view4);

            layout.Layout(new Rectangle(0, 0, 150, 100));

            Assert.AreEqual(0f, layout.X);
            Assert.AreEqual(0f, layout.Y);
            Assert.AreEqual(150f, layout.Width);
            Assert.AreEqual(100f, layout.Height);

            Assert.AreEqual(0f, view0.X);
            Assert.AreEqual(0f, view0.Y);
            Assert.AreEqual(50f, view0.Width);
            Assert.AreEqual(100f, view0.Height);

            Assert.AreEqual(50f, view1.X);
            Assert.AreEqual(0f, view1.Y);
            Assert.AreEqual(0f, view1.Width);
            Assert.AreEqual(100f, view1.Height);

            Assert.AreEqual(50f, view2.X);
            Assert.AreEqual(0f, view2.Y);
            Assert.AreEqual(50f, view2.Width);
            Assert.AreEqual(100f, view2.Height);

            Assert.AreEqual(100f, view3.X);
            Assert.AreEqual(0f, view3.Y);
            Assert.AreEqual(0f, view3.Width);
            Assert.AreEqual(100f, view3.Height);

            Assert.AreEqual(100f, view4.X);
            Assert.AreEqual(0f, view4.Y);
            Assert.AreEqual(50f, view4.Width);
            Assert.AreEqual(100f, view4.Height);
        }
Ejemplo n.º 12
0
        public void TestAlignContentFlexStartWithFlex()
        {
            var platform = new UnitPlatform((visual, width, height) => new SizeRequest(new Size(0, 0)));

            var layout = new FlexLayout {
                Platform          = platform,
                IsPlatformEnabled = true,
                WidthRequest      = 100,
                HeightRequest     = 120,

                Direction  = FlexDirection.Column,
                Wrap       = FlexWrap.Wrap,
                AlignItems = FlexAlignItems.Start,
            };

            var view0 = new View {
                IsPlatformEnabled = true
            };

            FlexLayout.SetGrow(view0, 1);
            FlexLayout.SetBasis(view0, 0);
            view0.WidthRequest = 50;
            layout.Children.Add(view0);

            var view1 = new View {
                IsPlatformEnabled = true
            };

            FlexLayout.SetGrow(view1, 1);
            FlexLayout.SetBasis(view1, 0);
            view1.WidthRequest  = 50;
            view1.HeightRequest = 10;
            layout.Children.Add(view1);

            var view2 = new View {
                IsPlatformEnabled = true
            };

            view2.WidthRequest = 50;
            layout.Children.Add(view2);

            var view3 = new View {
                IsPlatformEnabled = true
            };

            FlexLayout.SetGrow(view3, 1);
            FlexLayout.SetShrink(view3, 1);
            FlexLayout.SetBasis(view3, 0);
            view3.WidthRequest = 50;
            layout.Children.Add(view3);

            var view4 = new View {
                IsPlatformEnabled = true
            };

            view4.WidthRequest = 50;
            layout.Children.Add(view4);

            layout.Layout(new Rectangle(0, 0, 100, 120));

            Assert.That(layout.Bounds, Is.EqualTo(new Rectangle(0, 0, 100, 120)));
            Assert.That(view0.Bounds, Is.EqualTo(new Rectangle(0, 0, 50, 40)));
            Assert.That(view1.Bounds, Is.EqualTo(new Rectangle(0, 40, 50, 40)));
            Assert.That(view2.Bounds, Is.EqualTo(new Rectangle(0, 80, 50, 0)));
            Assert.That(view3.Bounds, Is.EqualTo(new Rectangle(0, 80, 50, 40)));
            Assert.That(view4.Bounds, Is.EqualTo(new Rectangle(0, 120, 50, 0)));
        }
Ejemplo n.º 13
0
        public void TestAlignContentStretchRow()
        {
            var layout = new FlexLayout
            {
                IsPlatformEnabled = true,
                Direction         = FlexDirection.Row,
                AlignContent      = FlexAlignContent.Stretch,
                AlignItems        = FlexAlignItems.Start,
                Wrap          = FlexWrap.Wrap,
                WidthRequest  = 150,
                HeightRequest = 100
            };
            var view0 = new View {
                IsPlatformEnabled = true
            };

            view0.WidthRequest = 50;
            layout.Children.Add(view0);

            var view1 = new View {
                IsPlatformEnabled = true
            };

            view1.WidthRequest = 50;
            layout.Children.Add(view1);

            var view2 = new View {
                IsPlatformEnabled = true
            };

            view2.WidthRequest = 50;
            layout.Children.Add(view2);

            var view3 = new View {
                IsPlatformEnabled = true
            };

            view3.WidthRequest = 50;
            layout.Children.Add(view3);

            var view4 = new View {
                IsPlatformEnabled = true
            };

            view4.WidthRequest = 50;
            layout.Children.Add(view4);

            layout.Layout(new Rect(0, 0, 150, 100));

            Assert.AreEqual(0f, layout.X);
            Assert.AreEqual(0f, layout.Y);
            Assert.AreEqual(150f, layout.Width);
            Assert.AreEqual(100f, layout.Height);

            Assert.AreEqual(0f, view0.X);
            Assert.AreEqual(0f, view0.Y);
            Assert.AreEqual(50f, view0.Width);
            Assert.AreEqual(20f, view0.Height);

            Assert.AreEqual(50f, view1.X);
            Assert.AreEqual(0f, view1.Y);
            Assert.AreEqual(50f, view1.Width);
            Assert.AreEqual(20f, view1.Height);

            Assert.AreEqual(100f, view2.X);
            Assert.AreEqual(0f, view2.Y);
            Assert.AreEqual(50f, view2.Width);
            Assert.AreEqual(20f, view2.Height);

            Assert.AreEqual(0f, view3.X);
            Assert.AreEqual(50f, view3.Y);
            Assert.AreEqual(50f, view3.Width);
            Assert.AreEqual(20f, view3.Height);

            Assert.AreEqual(50f, view4.X);
            Assert.AreEqual(50f, view4.Y);
            Assert.AreEqual(50f, view4.Width);
            Assert.AreEqual(20f, view4.Height);
        }
Ejemplo n.º 14
0
        public void TestAlignContentStretch()
        {
            Device.PlatformServices = new MockPlatformServices(getNativeSizeFunc: (visual, width, height) => new SizeRequest(new Size(0, 0)));
            var layout = new FlexLayout {
                IsPlatformEnabled = true,
                Direction         = FlexDirection.Column,
                AlignContent      = FlexAlignContent.Stretch,
                AlignItems        = FlexAlignItems.Start,
                Wrap          = FlexWrap.Wrap,
                WidthRequest  = 150,
                HeightRequest = 100
            };
            var view0 = new View {
                IsPlatformEnabled = true
            };

            view0.WidthRequest = 50;
            layout.Children.Add(view0);

            var view1 = new View {
                IsPlatformEnabled = true
            };

            view1.WidthRequest = 50;
            layout.Children.Add(view1);

            var view2 = new View {
                IsPlatformEnabled = true
            };

            view2.WidthRequest = 50;
            layout.Children.Add(view2);

            var view3 = new View {
                IsPlatformEnabled = true
            };

            view3.WidthRequest = 50;
            layout.Children.Add(view3);

            var view4 = new View {
                IsPlatformEnabled = true
            };

            view4.WidthRequest = 50;
            layout.Children.Add(view4);

            layout.Layout(new Rectangle(0, 0, 150, 100));

            Assert.AreEqual(0f, layout.X);
            Assert.AreEqual(0f, layout.Y);
            Assert.AreEqual(150f, layout.Width);
            Assert.AreEqual(100f, layout.Height);

            Assert.AreEqual(0f, view0.X);
            Assert.AreEqual(0f, view0.Y);
            Assert.AreEqual(50f, view0.Width);
            Assert.AreEqual(0f, view0.Height);

            Assert.AreEqual(0f, view1.X);
            Assert.AreEqual(0f, view1.Y);
            Assert.AreEqual(50f, view1.Width);
            Assert.AreEqual(0f, view1.Height);

            Assert.AreEqual(0f, view2.X);
            Assert.AreEqual(0f, view2.Y);
            Assert.AreEqual(50f, view2.Width);
            Assert.AreEqual(0f, view2.Height);

            Assert.AreEqual(0f, view3.X);
            Assert.AreEqual(0f, view3.Y);
            Assert.AreEqual(50f, view3.Width);
            Assert.AreEqual(0f, view3.Height);

            Assert.AreEqual(0f, view4.X);
            Assert.AreEqual(0f, view4.Y);
            Assert.AreEqual(50f, view4.Width);
            Assert.AreEqual(0f, view4.Height);
        }
Ejemplo n.º 15
0
        public void TestAlignContentStretchRowWithMargin()
        {
            var platform = new UnitPlatform();
            var layout   = new FlexLayout {
                Platform          = platform,
                IsPlatformEnabled = true,
                WidthRequest      = 150,
                HeightRequest     = 100,

                Direction    = FlexDirection.Row,
                AlignContent = FlexAlignContent.Stretch,
                Wrap         = FlexWrap.Wrap,
            };
            var view0 = new View {
                IsPlatformEnabled = true,
                WidthRequest      = 50,
                HeightRequest     = 20,
            };

            layout.Children.Add(view0);

            var view1 = new View {
                IsPlatformEnabled = true,
                Margin            = 10,
                WidthRequest      = 50,
                HeightRequest     = 20,
            };

            layout.Children.Add(view1);

            var view2 = new View {
                IsPlatformEnabled = true,
                WidthRequest      = 50,
                HeightRequest     = 20,
            };

            layout.Children.Add(view2);

            var view3 = new View {
                IsPlatformEnabled = true,
                Margin            = new Thickness(10),
                WidthRequest      = 50,
                HeightRequest     = 20,
            };

            layout.Children.Add(view3);

            var view4 = new View {
                IsPlatformEnabled = true,
                WidthRequest      = 50,
                HeightRequest     = 20,
            };

            layout.Children.Add(view4);

            layout.Layout(new Rectangle(0, 0, 150, 100));

            Assert.That(layout.Bounds, Is.EqualTo(new Rectangle(0, 0, 150, 100)));
            Assert.That(view0.Bounds, Is.EqualTo(new Rectangle(0, 0, 50, 20)));
            Assert.That(view1.Bounds, Is.EqualTo(new Rectangle(60, 10, 50, 20)));
            Assert.That(view2.Bounds, Is.EqualTo(new Rectangle(0, 40, 50, 20)));
            Assert.That(view3.Bounds, Is.EqualTo(new Rectangle(60, 50, 50, 20)));
            Assert.That(view4.Bounds, Is.EqualTo(new Rectangle(0, 80, 50, 20)));
        }
Ejemplo n.º 16
0
        public void TestAlignContentStretchRowWithFixedHeight()
        {
            var platform = new UnitPlatform((visual, width, height) => new SizeRequest(new Size(0, 0)));
            var layout   = new FlexLayout {
                Platform          = platform,
                IsPlatformEnabled = true,
                Direction         = FlexDirection.Row,
                AlignContent      = FlexAlignContent.Stretch,
                AlignItems        = FlexAlignItems.Start,
                Wrap          = FlexWrap.Wrap,
                WidthRequest  = 150,
                HeightRequest = 100
            };
            var view0 = new View {
                IsPlatformEnabled = true
            };

            view0.WidthRequest = 50;
            layout.Children.Add(view0);

            var view1 = new View {
                IsPlatformEnabled = true
            };

            view1.WidthRequest  = 50;
            view1.HeightRequest = 60;
            layout.Children.Add(view1);

            var view2 = new View {
                IsPlatformEnabled = true
            };

            view2.WidthRequest = 50;
            layout.Children.Add(view2);

            var view3 = new View {
                IsPlatformEnabled = true
            };

            view3.WidthRequest = 50;
            layout.Children.Add(view3);

            var view4 = new View {
                IsPlatformEnabled = true
            };

            view4.WidthRequest = 50;
            layout.Children.Add(view4);

            layout.Layout(new Rectangle(0, 0, 150, 100));

            Assert.AreEqual(0f, layout.X);
            Assert.AreEqual(0f, layout.Y);
            Assert.AreEqual(150f, layout.Width);
            Assert.AreEqual(100f, layout.Height);

            Assert.AreEqual(0f, view0.X);
            Assert.AreEqual(0f, view0.Y);
            Assert.AreEqual(50f, view0.Width);
            Assert.AreEqual(0f, view0.Height);

            Assert.AreEqual(50f, view1.X);
            Assert.AreEqual(0f, view1.Y);
            Assert.AreEqual(50f, view1.Width);
            Assert.AreEqual(60f, view1.Height);

            Assert.AreEqual(100f, view2.X);
            Assert.AreEqual(0f, view2.Y);
            Assert.AreEqual(50f, view2.Width);
            Assert.AreEqual(0f, view2.Height);

            Assert.AreEqual(0f, view3.X);
            Assert.AreEqual(80f, view3.Y);
            Assert.AreEqual(50f, view3.Width);
            Assert.AreEqual(0f, view3.Height);

            Assert.AreEqual(50f, view4.X);
            Assert.AreEqual(80f, view4.Y);
            Assert.AreEqual(50f, view4.Width);
            Assert.AreEqual(0f, view4.Height);
        }
Ejemplo n.º 17
0
        public void TestAlignContentStretchRowWithChildren()
        {
            var layout = new FlexLayout {
                IsPlatformEnabled = true,
                WidthRequest      = 150,
                HeightRequest     = 100,

                Direction    = FlexDirection.Row,
                AlignContent = FlexAlignContent.Stretch,
                Wrap         = FlexWrap.Wrap,
            };
            var view0 = new FlexLayout {
                IsPlatformEnabled = true, WidthRequest = 50,
            };

            layout.Children.Add(view0);

            //var view0_child0 = new View { IsPlatformEnabled = true };
            //FlexLayout.SetGrow(view0_child0, 1);
            //FlexLayout.SetShrink(view0_child0, 1);
            //FlexLayout.SetBasis(view0_child0, 0);
            //view0.Children.Add(view0_child0);

            var view1 = new View {
                IsPlatformEnabled = true, WidthRequest = 50,
            };

            layout.Children.Add(view1);

            var view2 = new View {
                IsPlatformEnabled = true, WidthRequest = 50,
            };

            layout.Children.Add(view2);

            var view3 = new View {
                IsPlatformEnabled = true, WidthRequest = 50,
            };

            layout.Children.Add(view3);

            var view4 = new View {
                IsPlatformEnabled = true, WidthRequest = 50,
            };

            layout.Children.Add(view4);

            layout.Layout(new Rectangle(0, 0, 150, 100));

            Assert.That(layout.Bounds, Is.EqualTo(new Rectangle(0, 0, 150, 100)));

            Assert.AreEqual(0f, view0.X);
            Assert.AreEqual(0f, view0.Y);
            Assert.AreEqual(50f, view0.Width);
            Assert.AreEqual(50f, view0.Height);

            //Assert.AreEqual(0f, view0_child0.X);
            //Assert.AreEqual(0f, view0_child0.Y);
            //Assert.AreEqual(50f, view0_child0.Width);
            //Assert.AreEqual(50f, view0_child0.Height);

            Assert.AreEqual(50f, view1.X);
            Assert.AreEqual(0f, view1.Y);
            Assert.AreEqual(50f, view1.Width);
            Assert.AreEqual(50f, view1.Height);

            Assert.AreEqual(100f, view2.X);
            Assert.AreEqual(0f, view2.Y);
            Assert.AreEqual(50f, view2.Width);
            Assert.AreEqual(50f, view2.Height);

            Assert.AreEqual(0f, view3.X);
            Assert.AreEqual(50f, view3.Y);
            Assert.AreEqual(50f, view3.Width);
            Assert.AreEqual(50f, view3.Height);

            Assert.AreEqual(50f, view4.X);
            Assert.AreEqual(50f, view4.Y);
            Assert.AreEqual(50f, view4.Width);
            Assert.AreEqual(50f, view4.Height);
        }