public static float GetLeftBorderWidth(this CSSNode node)
        {
            var width = node.GetBorder(CSSSpacingType.Left);

            if (!CSSConstants.IsUndefined(width))
            {
                return(width);
            }

            width = node.GetBorder(CSSSpacingType.Horizontal);
            if (!CSSConstants.IsUndefined(width))
            {
                return(width);
            }

            width = node.GetBorder(CSSSpacingType.All);
            if (!CSSConstants.IsUndefined(width))
            {
                return(width);
            }

            return(0.0f);
        }
        public static float GetTopBorderWidth(this CSSNode node)
        {
            var width = node.GetBorder(CSSSpacingType.Top);

            if (!CSSConstants.IsUndefined(width))
            {
                return(width);
            }

            width = node.GetBorder(CSSSpacingType.Vertical);
            if (!CSSConstants.IsUndefined(width))
            {
                return(width);
            }

            width = node.GetBorder(CSSSpacingType.All);
            if (!CSSConstants.IsUndefined(width))
            {
                return(width);
            }

            return(0.0f);
        }
Exemplo n.º 3
0
        public void TestFull()
        {
            CSSNode node = CSSNode.Create(
                styleDirection: CSSDirection.RTL,
                flexDirection: CSSFlexDirection.RowReverse,

                justifyContent: CSSJustify.SpaceAround,
                alignContent: CSSAlign.Center,
                alignItems: CSSAlign.FlexEnd,
                alignSelf: CSSAlign.Stretch,

                positionType: CSSPositionType.Absolute,
                wrap: CSSWrap.Wrap,
                overflow: CSSOverflow.Scroll,

                flex: 1,
                flexGrow: 2,
                flexShrink: 3,
                flexBasis: 4,

                position: new Spacing(top: 5, bottom: 6, left: 7, right: 8),
                margin: new Spacing(top: 9, bottom: 10, left: 11, right: 12),
                padding: new Spacing(top: 13, bottom: 14, left: 15, right: 16),
                border: new Spacing(top: 17, bottom: 18, left: 19, right: 20),

                width: 21,
                height: 22,
                minWidth: 23,
                minHeight: 24,
                maxWidth: 25,
                maxHeight: 26);

            Assert.AreEqual(CSSDirection.RTL, node.StyleDirection);
            Assert.AreEqual(CSSFlexDirection.RowReverse, node.FlexDirection);

            Assert.AreEqual(CSSJustify.SpaceAround, node.JustifyContent);
            Assert.AreEqual(CSSAlign.Center, node.AlignContent);
            Assert.AreEqual(CSSAlign.FlexEnd, node.AlignItems);
            Assert.AreEqual(CSSAlign.Stretch, node.AlignSelf);

            Assert.AreEqual(CSSPositionType.Absolute, node.PositionType);
            Assert.AreEqual(CSSWrap.Wrap, node.Wrap);
            Assert.AreEqual(CSSOverflow.Scroll, node.Overflow);

            Assert.AreEqual(2, node.FlexGrow);
            Assert.AreEqual(3, node.FlexShrink);
            Assert.AreEqual(4, node.FlexBasis);
            node.FlexGrow = CSSConstants.Undefined;
            Assert.AreEqual(1, node.FlexGrow);

            Assert.AreEqual(5, node.GetPosition(CSSEdge.Top));
            Assert.AreEqual(6, node.GetPosition(CSSEdge.Bottom));
            Assert.AreEqual(7, node.GetPosition(CSSEdge.Left));
            Assert.AreEqual(8, node.GetPosition(CSSEdge.Right));

            Assert.AreEqual(9, node.GetMargin(CSSEdge.Top));
            Assert.AreEqual(10, node.GetMargin(CSSEdge.Bottom));
            Assert.AreEqual(11, node.GetMargin(CSSEdge.Left));
            Assert.AreEqual(12, node.GetMargin(CSSEdge.Right));

            Assert.AreEqual(13, node.GetPadding(CSSEdge.Top));
            Assert.AreEqual(14, node.GetPadding(CSSEdge.Bottom));
            Assert.AreEqual(15, node.GetPadding(CSSEdge.Left));
            Assert.AreEqual(16, node.GetPadding(CSSEdge.Right));

            Assert.AreEqual(17, node.GetBorder(CSSEdge.Top));
            Assert.AreEqual(18, node.GetBorder(CSSEdge.Bottom));
            Assert.AreEqual(19, node.GetBorder(CSSEdge.Left));
            Assert.AreEqual(20, node.GetBorder(CSSEdge.Right));

            Assert.AreEqual(21, node.Width);
            Assert.AreEqual(22, node.Height);
            Assert.AreEqual(23, node.MinWidth);
            Assert.AreEqual(24, node.MinHeight);
            Assert.AreEqual(25, node.MaxWidth);
            Assert.AreEqual(26, node.MaxHeight);
        }