Example #1
0
        public void TestEmptyLayoutDoesntCrash()
        {
            var layoutInfo = new FlowLayout.LayoutInfo(new Xamarin.Forms.Thickness(0));
            var views      = new List <View>();

            layoutInfo.ProcessLayout(views, 100);
        }
Example #2
0
        public void TestOversizeChildRestricted()
        {
            var layoutInfo = new FlowLayout.LayoutInfo(new Thickness(0));
            var children   = new List <View>();

            children.Add(new BoxView {
                WidthRequest = 110, HeightRequest = 30
            });

            layoutInfo.ProcessLayout(children, 100);

            Assert.AreEqual(100, layoutInfo.Bounds[0].Width);
        }
Example #3
0
        public void TestChildPositionsVertical()
        {
            var layoutInfo = new FlowLayout.LayoutInfo(new Thickness(3, 6, 4, 5));
            var children   = new List <View>();

            children.Add(new BoxView {
                WidthRequest = 90, HeightRequest = 30
            });
            children.Add(new BoxView {
                WidthRequest = 30, HeightRequest = 30
            });

            layoutInfo.ProcessLayout(children, 100);

            Assert.AreEqual(new Rectangle(0, 0, 90, 30), layoutInfo.Bounds[0]);
            Assert.AreEqual(new Rectangle(0, 41, 30, 30), layoutInfo.Bounds[1]);
        }
Example #4
0
        public void InvisibleChildHiddenThreeLine()
        {
            var layoutInfo = new FlowLayout.LayoutInfo(new Thickness(0));
            var children   = new List <View>();

            children.Add(new BoxView {
                WidthRequest = 90, HeightRequest = 30
            });
            children.Add(new BoxView {
                WidthRequest = 90, HeightRequest = 30, IsVisible = false
            });
            children.Add(new BoxView {
                WidthRequest = 90, HeightRequest = 30
            });

            layoutInfo.ProcessLayout(children, 100);

            Assert.AreEqual(new Rectangle(0, 0, 90, 30), layoutInfo.Bounds[0], "Box 1");
            Assert.AreEqual(new Rectangle(0, 30, 90, 30), layoutInfo.Bounds[2], "Box 3");
        }