Exemple #1
0
        public void Test_padding_side_overrides_horizontal_and_vertical()
        {
            var edges = new[] { YogaEdge.Top,
                                YogaEdge.Bottom,
                                YogaEdge.Start,
                                YogaEdge.End,
                                YogaEdge.Left,
                                YogaEdge.Right };

            for (float edgeValue = 0; edgeValue < 2; ++edgeValue)
            {
                foreach (var edge in edges)
                {
                    var horizontalOrVertical = edge == YogaEdge.Top || edge == YogaEdge.Bottom
                                               YogaEdge.Vertical
                                               : YogaEdge.Horizontal;
                    var root = new YogaNode();
                    root.Width  = 100;
                    root.Height = 100;
                    root.Style.Padding[horizontalOrVertical] = 10;
                    root.Style.Padding[edge] = edgeValue;
                    root.CalculateLayout(100, 100, YogaDirection.LeftToRight);
                    Assert.AreEqual(edgeValue, root.GetLayoutPadding(edge));
                }
            }
        }