当前位置: 首页>>代码示例>>C#>>正文


C# CSSNode.Insert方法代码示例

本文整理汇总了C#中CSSNode.Insert方法的典型用法代码示例。如果您正苦于以下问题:C# CSSNode.Insert方法的具体用法?C# CSSNode.Insert怎么用?C# CSSNode.Insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSSNode的用法示例。


在下文中一共展示了CSSNode.Insert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestChildren

        public void TestChildren()
        {
            CSSNode parent = new CSSNode();
            foreach (CSSNode node in parent) {
                Assert.Fail(node.ToString());
            }

            CSSNode child0 = new CSSNode();
            Assert.AreEqual(-1, parent.IndexOf(child0));
            parent.Insert(0, child0);
            foreach (CSSNode node in parent) {
                Assert.AreEqual(0, parent.IndexOf(node));
            }

            CSSNode child1 = new CSSNode();
            parent.Insert(1, child1);
            int index = 0;
            foreach (CSSNode node in parent) {
                Assert.AreEqual(index++, parent.IndexOf(node));
            }

            parent.RemoveAt(0);
            Assert.AreEqual(-1, parent.IndexOf(child0));
            Assert.AreEqual(0, parent.IndexOf(child1));

            parent.Clear();
            Assert.AreEqual(0, parent.Count);

            parent.Clear();
            Assert.AreEqual(0, parent.Count);
        }
开发者ID:zhuyadong,项目名称:css-layout,代码行数:31,代码来源:CSSNodeTest.cs

示例2: Test_flex_basis_flex_grow_column

        public void Test_flex_basis_flex_grow_column()
        {
            CSSNode root = new CSSNode();
            root.StyleWidth = 100;
            root.StyleHeight = 100;

            CSSNode root_child0 = new CSSNode();
            root_child0.FlexGrow = 1;
            root_child0.FlexBasis = 50;
            root.Insert(0, root_child0);

            CSSNode root_child1 = new CSSNode();
            root_child1.FlexGrow = 1;
            root.Insert(1, root_child1);
            root.StyleDirection = CSSDirection.LeftToRight;
            root.CalculateLayout();

            Assert.AreEqual(0, root.LayoutX);
            Assert.AreEqual(0, root.LayoutY);
            Assert.AreEqual(100, root.LayoutWidth);
            Assert.AreEqual(100, root.LayoutHeight);

            Assert.AreEqual(0, root_child0.LayoutX);
            Assert.AreEqual(0, root_child0.LayoutY);
            Assert.AreEqual(100, root_child0.LayoutWidth);
            Assert.AreEqual(75, root_child0.LayoutHeight);

            Assert.AreEqual(0, root_child1.LayoutX);
            Assert.AreEqual(75, root_child1.LayoutY);
            Assert.AreEqual(100, root_child1.LayoutWidth);
            Assert.AreEqual(25, root_child1.LayoutHeight);

            root.StyleDirection = CSSDirection.RightToLeft;
            root.CalculateLayout();

            Assert.AreEqual(0, root.LayoutX);
            Assert.AreEqual(0, root.LayoutY);
            Assert.AreEqual(100, root.LayoutWidth);
            Assert.AreEqual(100, root.LayoutHeight);

            Assert.AreEqual(0, root_child0.LayoutX);
            Assert.AreEqual(0, root_child0.LayoutY);
            Assert.AreEqual(100, root_child0.LayoutWidth);
            Assert.AreEqual(75, root_child0.LayoutHeight);

            Assert.AreEqual(0, root_child1.LayoutX);
            Assert.AreEqual(75, root_child1.LayoutY);
            Assert.AreEqual(100, root_child1.LayoutWidth);
            Assert.AreEqual(25, root_child1.LayoutHeight);
        }
开发者ID:zhuyadong,项目名称:css-layout,代码行数:50,代码来源:CSSLayoutFlexTest.cs

示例3: TestCannotAddChildToMultipleParents

        public void TestCannotAddChildToMultipleParents()
        {
            CSSNode parent1 = new CSSNode();
            CSSNode parent2 = new CSSNode();
            CSSNode child = new CSSNode();

            parent1.Insert(0, child);
            parent2.Insert(0, child);
        }
开发者ID:zhuyadong,项目名称:css-layout,代码行数:9,代码来源:CSSNodeTest.cs

示例4: TestAddChildGetParent

        public void TestAddChildGetParent()
        {
            CSSNode parent = new CSSNode();
            CSSNode child = new CSSNode();

            Assert.IsNull(child.Parent);
            Assert.AreEqual(0, parent.Count);

            parent.Insert(0, child);

            Assert.AreEqual(1, parent.Count);
            Assert.AreEqual(child, parent[0]);
            Assert.AreEqual(parent, child.Parent);

            parent.RemoveAt(0);

            Assert.IsNull(child.Parent);
            Assert.AreEqual(0, parent.Count);
        }
开发者ID:zhuyadong,项目名称:css-layout,代码行数:19,代码来源:CSSNodeTest.cs

示例5: Test_border_center_child

        public void Test_border_center_child()
        {
            CSSNode root = new CSSNode();
            root.JustifyContent = CSSJustify.Center;
            root.AlignItems = CSSAlign.Center;
            root.SetBorder(CSSEdge.Start, 10);
            root.SetBorder(CSSEdge.End, 20);
            root.SetBorder(CSSEdge.Bottom, 20);
            root.StyleWidth = 100;
            root.StyleHeight = 100;

            CSSNode root_child0 = new CSSNode();
            root_child0.StyleWidth = 10;
            root_child0.StyleHeight = 10;
            root.Insert(0, root_child0);
            root.StyleDirection = CSSDirection.LeftToRight;
            root.CalculateLayout();

            Assert.AreEqual(0, root.LayoutX);
            Assert.AreEqual(0, root.LayoutY);
            Assert.AreEqual(100, root.LayoutWidth);
            Assert.AreEqual(100, root.LayoutHeight);

            Assert.AreEqual(40, root_child0.LayoutX);
            Assert.AreEqual(35, root_child0.LayoutY);
            Assert.AreEqual(10, root_child0.LayoutWidth);
            Assert.AreEqual(10, root_child0.LayoutHeight);

            root.StyleDirection = CSSDirection.RightToLeft;
            root.CalculateLayout();

            Assert.AreEqual(0, root.LayoutX);
            Assert.AreEqual(0, root.LayoutY);
            Assert.AreEqual(100, root.LayoutWidth);
            Assert.AreEqual(100, root.LayoutHeight);

            Assert.AreEqual(50, root_child0.LayoutX);
            Assert.AreEqual(35, root_child0.LayoutY);
            Assert.AreEqual(10, root_child0.LayoutWidth);
            Assert.AreEqual(10, root_child0.LayoutHeight);
        }
开发者ID:zhuyadong,项目名称:css-layout,代码行数:41,代码来源:CSSLayoutBorderTest.cs

示例6: Test_absolute_layout_start_top_end_bottom

        public void Test_absolute_layout_start_top_end_bottom()
        {
            CSSNode root = new CSSNode();
            root.StyleWidth = 100;
            root.StyleHeight = 100;

            CSSNode root_child0 = new CSSNode();
            root_child0.PositionType = CSSPositionType.Absolute;
            root_child0.SetPosition(CSSEdge.Start, 10);
            root_child0.SetPosition(CSSEdge.Top, 10);
            root_child0.SetPosition(CSSEdge.End, 10);
            root_child0.SetPosition(CSSEdge.Bottom, 10);
            root.Insert(0, root_child0);
            root.StyleDirection = CSSDirection.LeftToRight;
            root.CalculateLayout();

            Assert.AreEqual(0, root.LayoutX);
            Assert.AreEqual(0, root.LayoutY);
            Assert.AreEqual(100, root.LayoutWidth);
            Assert.AreEqual(100, root.LayoutHeight);

            Assert.AreEqual(10, root_child0.LayoutX);
            Assert.AreEqual(10, root_child0.LayoutY);
            Assert.AreEqual(80, root_child0.LayoutWidth);
            Assert.AreEqual(80, root_child0.LayoutHeight);

            root.StyleDirection = CSSDirection.RightToLeft;
            root.CalculateLayout();

            Assert.AreEqual(0, root.LayoutX);
            Assert.AreEqual(0, root.LayoutY);
            Assert.AreEqual(100, root.LayoutWidth);
            Assert.AreEqual(100, root.LayoutHeight);

            Assert.AreEqual(10, root_child0.LayoutX);
            Assert.AreEqual(10, root_child0.LayoutY);
            Assert.AreEqual(80, root_child0.LayoutWidth);
            Assert.AreEqual(80, root_child0.LayoutHeight);
        }
开发者ID:zhuyadong,项目名称:css-layout,代码行数:39,代码来源:CSSLayoutAbsolutePositionTest.cs

示例7: Test_align_items_min_max

        public void Test_align_items_min_max()
        {
            CSSNode root = new CSSNode();
            root.AlignItems = CSSAlign.Center;
            root.StyleMinWidth = 100;
            root.StyleMaxWidth = 200;
            root.StyleHeight = 100;

            CSSNode root_child0 = new CSSNode();
            root_child0.StyleWidth = 60;
            root_child0.StyleHeight = 60;
            root.Insert(0, root_child0);
            root.StyleDirection = CSSDirection.LeftToRight;
            root.CalculateLayout();

            Assert.AreEqual(0, root.LayoutX);
            Assert.AreEqual(0, root.LayoutY);
            Assert.AreEqual(100, root.LayoutWidth);
            Assert.AreEqual(100, root.LayoutHeight);

            Assert.AreEqual(20, root_child0.LayoutX);
            Assert.AreEqual(0, root_child0.LayoutY);
            Assert.AreEqual(60, root_child0.LayoutWidth);
            Assert.AreEqual(60, root_child0.LayoutHeight);

            root.StyleDirection = CSSDirection.RightToLeft;
            root.CalculateLayout();

            Assert.AreEqual(0, root.LayoutX);
            Assert.AreEqual(0, root.LayoutY);
            Assert.AreEqual(100, root.LayoutWidth);
            Assert.AreEqual(100, root.LayoutHeight);

            Assert.AreEqual(20, root_child0.LayoutX);
            Assert.AreEqual(0, root_child0.LayoutY);
            Assert.AreEqual(60, root_child0.LayoutWidth);
            Assert.AreEqual(60, root_child0.LayoutHeight);
        }
开发者ID:zhuyadong,项目名称:css-layout,代码行数:38,代码来源:CSSLayoutMinMaxDimensionTest.cs

示例8: Test_align_self_center

        public void Test_align_self_center()
        {
            CSSNode root = new CSSNode();
            root.StyleWidth = 100;
            root.StyleHeight = 100;

            CSSNode root_child0 = new CSSNode();
            root_child0.AlignSelf = CSSAlign.Center;
            root_child0.StyleWidth = 10;
            root_child0.StyleHeight = 10;
            root.Insert(0, root_child0);
            root.StyleDirection = CSSDirection.LeftToRight;
            root.CalculateLayout();

            Assert.AreEqual(0, root.LayoutX);
            Assert.AreEqual(0, root.LayoutY);
            Assert.AreEqual(100, root.LayoutWidth);
            Assert.AreEqual(100, root.LayoutHeight);

            Assert.AreEqual(45, root_child0.LayoutX);
            Assert.AreEqual(0, root_child0.LayoutY);
            Assert.AreEqual(10, root_child0.LayoutWidth);
            Assert.AreEqual(10, root_child0.LayoutHeight);

            root.StyleDirection = CSSDirection.RightToLeft;
            root.CalculateLayout();

            Assert.AreEqual(0, root.LayoutX);
            Assert.AreEqual(0, root.LayoutY);
            Assert.AreEqual(100, root.LayoutWidth);
            Assert.AreEqual(100, root.LayoutHeight);

            Assert.AreEqual(45, root_child0.LayoutX);
            Assert.AreEqual(0, root_child0.LayoutY);
            Assert.AreEqual(10, root_child0.LayoutWidth);
            Assert.AreEqual(10, root_child0.LayoutHeight);
        }
开发者ID:zhuyadong,项目名称:css-layout,代码行数:37,代码来源:CSSLayoutAlignSelfTest.cs

示例9: Test_margin_and_flex_column

        public void Test_margin_and_flex_column()
        {
            CSSNode root = new CSSNode();
            root.StyleWidth = 100;
            root.StyleHeight = 100;

            CSSNode root_child0 = new CSSNode();
            root_child0.FlexGrow = 1;
            root_child0.SetMargin(CSSEdge.Top, 10);
            root.Insert(0, root_child0);
            root.StyleDirection = CSSDirection.LeftToRight;
            root.CalculateLayout();

            Assert.AreEqual(0, root.LayoutX);
            Assert.AreEqual(0, root.LayoutY);
            Assert.AreEqual(100, root.LayoutWidth);
            Assert.AreEqual(100, root.LayoutHeight);

            Assert.AreEqual(0, root_child0.LayoutX);
            Assert.AreEqual(10, root_child0.LayoutY);
            Assert.AreEqual(100, root_child0.LayoutWidth);
            Assert.AreEqual(90, root_child0.LayoutHeight);

            root.StyleDirection = CSSDirection.RightToLeft;
            root.CalculateLayout();

            Assert.AreEqual(0, root.LayoutX);
            Assert.AreEqual(0, root.LayoutY);
            Assert.AreEqual(100, root.LayoutWidth);
            Assert.AreEqual(100, root.LayoutHeight);

            Assert.AreEqual(0, root_child0.LayoutX);
            Assert.AreEqual(10, root_child0.LayoutY);
            Assert.AreEqual(100, root_child0.LayoutWidth);
            Assert.AreEqual(90, root_child0.LayoutHeight);
        }
开发者ID:zhuyadong,项目名称:css-layout,代码行数:36,代码来源:CSSLayoutMarginTest.cs

示例10: Test_wrap_column

        public void Test_wrap_column()
        {
            CSSNode root = new CSSNode();
            root.Wrap = CSSWrap.Wrap;
            root.StyleHeight = 100;

            CSSNode root_child0 = new CSSNode();
            root_child0.StyleWidth = 30;
            root_child0.StyleHeight = 30;
            root.Insert(0, root_child0);

            CSSNode root_child1 = new CSSNode();
            root_child1.StyleWidth = 30;
            root_child1.StyleHeight = 30;
            root.Insert(1, root_child1);

            CSSNode root_child2 = new CSSNode();
            root_child2.StyleWidth = 30;
            root_child2.StyleHeight = 30;
            root.Insert(2, root_child2);

            CSSNode root_child3 = new CSSNode();
            root_child3.StyleWidth = 30;
            root_child3.StyleHeight = 30;
            root.Insert(3, root_child3);
            root.StyleDirection = CSSDirection.LeftToRight;
            root.CalculateLayout();

            Assert.AreEqual(0, root.LayoutX);
            Assert.AreEqual(0, root.LayoutY);
            Assert.AreEqual(60, root.LayoutWidth);
            Assert.AreEqual(100, root.LayoutHeight);

            Assert.AreEqual(0, root_child0.LayoutX);
            Assert.AreEqual(0, root_child0.LayoutY);
            Assert.AreEqual(30, root_child0.LayoutWidth);
            Assert.AreEqual(30, root_child0.LayoutHeight);

            Assert.AreEqual(0, root_child1.LayoutX);
            Assert.AreEqual(30, root_child1.LayoutY);
            Assert.AreEqual(30, root_child1.LayoutWidth);
            Assert.AreEqual(30, root_child1.LayoutHeight);

            Assert.AreEqual(0, root_child2.LayoutX);
            Assert.AreEqual(60, root_child2.LayoutY);
            Assert.AreEqual(30, root_child2.LayoutWidth);
            Assert.AreEqual(30, root_child2.LayoutHeight);

            Assert.AreEqual(30, root_child3.LayoutX);
            Assert.AreEqual(0, root_child3.LayoutY);
            Assert.AreEqual(30, root_child3.LayoutWidth);
            Assert.AreEqual(30, root_child3.LayoutHeight);

            root.StyleDirection = CSSDirection.RightToLeft;
            root.CalculateLayout();

            Assert.AreEqual(0, root.LayoutX);
            Assert.AreEqual(0, root.LayoutY);
            Assert.AreEqual(60, root.LayoutWidth);
            Assert.AreEqual(100, root.LayoutHeight);

            Assert.AreEqual(30, root_child0.LayoutX);
            Assert.AreEqual(0, root_child0.LayoutY);
            Assert.AreEqual(30, root_child0.LayoutWidth);
            Assert.AreEqual(30, root_child0.LayoutHeight);

            Assert.AreEqual(30, root_child1.LayoutX);
            Assert.AreEqual(30, root_child1.LayoutY);
            Assert.AreEqual(30, root_child1.LayoutWidth);
            Assert.AreEqual(30, root_child1.LayoutHeight);

            Assert.AreEqual(30, root_child2.LayoutX);
            Assert.AreEqual(60, root_child2.LayoutY);
            Assert.AreEqual(30, root_child2.LayoutWidth);
            Assert.AreEqual(30, root_child2.LayoutHeight);

            Assert.AreEqual(0, root_child3.LayoutX);
            Assert.AreEqual(0, root_child3.LayoutY);
            Assert.AreEqual(30, root_child3.LayoutWidth);
            Assert.AreEqual(30, root_child3.LayoutHeight);
        }
开发者ID:zhuyadong,项目名称:css-layout,代码行数:81,代码来源:CSSLayoutFlexWrapTest.cs

示例11: Test_align_self_flex_end_override_flex_start

        public void Test_align_self_flex_end_override_flex_start()
        {
            CSSNode root = new CSSNode();
            root.AlignItems = CSSAlign.FlexStart;
            root.StyleWidth = 100;
            root.StyleHeight = 100;

            CSSNode root_child0 = new CSSNode();
            root_child0.AlignSelf = CSSAlign.FlexEnd;
            root_child0.StyleWidth = 10;
            root_child0.StyleHeight = 10;
            root.Insert(0, root_child0);
            root.StyleDirection = CSSDirection.LeftToRight;
            root.CalculateLayout();

            Assert.AreEqual(0, root.LayoutX);
            Assert.AreEqual(0, root.LayoutY);
            Assert.AreEqual(100, root.LayoutWidth);
            Assert.AreEqual(100, root.LayoutHeight);

            Assert.AreEqual(90, root_child0.LayoutX);
            Assert.AreEqual(0, root_child0.LayoutY);
            Assert.AreEqual(10, root_child0.LayoutWidth);
            Assert.AreEqual(10, root_child0.LayoutHeight);

            root.StyleDirection = CSSDirection.RightToLeft;
            root.CalculateLayout();

            Assert.AreEqual(0, root.LayoutX);
            Assert.AreEqual(0, root.LayoutY);
            Assert.AreEqual(100, root.LayoutWidth);
            Assert.AreEqual(100, root.LayoutHeight);

            Assert.AreEqual(0, root_child0.LayoutX);
            Assert.AreEqual(0, root_child0.LayoutY);
            Assert.AreEqual(10, root_child0.LayoutWidth);
            Assert.AreEqual(10, root_child0.LayoutHeight);
        }
开发者ID:zhuyadong,项目名称:css-layout,代码行数:38,代码来源:CSSLayoutAlignSelfTest.cs

示例12: TestParentDestructorForGC

 private void TestParentDestructorForGC(CSSNode child, int instanceCount)
 {
     CSSNode parent = new CSSNode();
     Assert.AreEqual(instanceCount + 1, CSSNode.GetInstanceCount());
     parent.Insert(0, child);
 }
开发者ID:zhuyadong,项目名称:css-layout,代码行数:6,代码来源:CSSNodeTest.cs

示例13: Test_wrap_row_align_items_flex_end

        public void Test_wrap_row_align_items_flex_end()
        {
            CSSNode root = new CSSNode();
            root.FlexDirection = CSSFlexDirection.Row;
            root.AlignItems = CSSAlign.FlexEnd;
            root.Wrap = CSSWrap.Wrap;
            root.StyleWidth = 100;

            CSSNode root_child0 = new CSSNode();
            root_child0.StyleWidth = 30;
            root_child0.StyleHeight = 10;
            root.Insert(0, root_child0);

            CSSNode root_child1 = new CSSNode();
            root_child1.StyleWidth = 30;
            root_child1.StyleHeight = 20;
            root.Insert(1, root_child1);

            CSSNode root_child2 = new CSSNode();
            root_child2.StyleWidth = 30;
            root_child2.StyleHeight = 30;
            root.Insert(2, root_child2);

            CSSNode root_child3 = new CSSNode();
            root_child3.StyleWidth = 30;
            root_child3.StyleHeight = 30;
            root.Insert(3, root_child3);
            root.StyleDirection = CSSDirection.LeftToRight;
            root.CalculateLayout();

            Assert.AreEqual(0, root.LayoutX);
            Assert.AreEqual(0, root.LayoutY);
            Assert.AreEqual(100, root.LayoutWidth);
            Assert.AreEqual(60, root.LayoutHeight);

            Assert.AreEqual(0, root_child0.LayoutX);
            Assert.AreEqual(20, root_child0.LayoutY);
            Assert.AreEqual(30, root_child0.LayoutWidth);
            Assert.AreEqual(10, root_child0.LayoutHeight);

            Assert.AreEqual(30, root_child1.LayoutX);
            Assert.AreEqual(10, root_child1.LayoutY);
            Assert.AreEqual(30, root_child1.LayoutWidth);
            Assert.AreEqual(20, root_child1.LayoutHeight);

            Assert.AreEqual(60, root_child2.LayoutX);
            Assert.AreEqual(0, root_child2.LayoutY);
            Assert.AreEqual(30, root_child2.LayoutWidth);
            Assert.AreEqual(30, root_child2.LayoutHeight);

            Assert.AreEqual(0, root_child3.LayoutX);
            Assert.AreEqual(30, root_child3.LayoutY);
            Assert.AreEqual(30, root_child3.LayoutWidth);
            Assert.AreEqual(30, root_child3.LayoutHeight);

            root.StyleDirection = CSSDirection.RightToLeft;
            root.CalculateLayout();

            Assert.AreEqual(0, root.LayoutX);
            Assert.AreEqual(0, root.LayoutY);
            Assert.AreEqual(100, root.LayoutWidth);
            Assert.AreEqual(60, root.LayoutHeight);

            Assert.AreEqual(70, root_child0.LayoutX);
            Assert.AreEqual(20, root_child0.LayoutY);
            Assert.AreEqual(30, root_child0.LayoutWidth);
            Assert.AreEqual(10, root_child0.LayoutHeight);

            Assert.AreEqual(40, root_child1.LayoutX);
            Assert.AreEqual(10, root_child1.LayoutY);
            Assert.AreEqual(30, root_child1.LayoutWidth);
            Assert.AreEqual(20, root_child1.LayoutHeight);

            Assert.AreEqual(10, root_child2.LayoutX);
            Assert.AreEqual(0, root_child2.LayoutY);
            Assert.AreEqual(30, root_child2.LayoutWidth);
            Assert.AreEqual(30, root_child2.LayoutHeight);

            Assert.AreEqual(70, root_child3.LayoutX);
            Assert.AreEqual(30, root_child3.LayoutY);
            Assert.AreEqual(30, root_child3.LayoutWidth);
            Assert.AreEqual(30, root_child3.LayoutHeight);
        }
开发者ID:zhuyadong,项目名称:css-layout,代码行数:83,代码来源:CSSLayoutFlexWrapTest.cs

示例14: Test_justify_content_column_center

        public void Test_justify_content_column_center()
        {
            CSSNode root = new CSSNode();
            root.JustifyContent = CSSJustify.Center;
            root.StyleWidth = 102;
            root.StyleHeight = 102;

            CSSNode root_child0 = new CSSNode();
            root_child0.StyleHeight = 10;
            root.Insert(0, root_child0);

            CSSNode root_child1 = new CSSNode();
            root_child1.StyleHeight = 10;
            root.Insert(1, root_child1);

            CSSNode root_child2 = new CSSNode();
            root_child2.StyleHeight = 10;
            root.Insert(2, root_child2);
            root.StyleDirection = CSSDirection.LeftToRight;
            root.CalculateLayout();

            Assert.AreEqual(0, root.LayoutX);
            Assert.AreEqual(0, root.LayoutY);
            Assert.AreEqual(102, root.LayoutWidth);
            Assert.AreEqual(102, root.LayoutHeight);

            Assert.AreEqual(0, root_child0.LayoutX);
            Assert.AreEqual(36, root_child0.LayoutY);
            Assert.AreEqual(102, root_child0.LayoutWidth);
            Assert.AreEqual(10, root_child0.LayoutHeight);

            Assert.AreEqual(0, root_child1.LayoutX);
            Assert.AreEqual(46, root_child1.LayoutY);
            Assert.AreEqual(102, root_child1.LayoutWidth);
            Assert.AreEqual(10, root_child1.LayoutHeight);

            Assert.AreEqual(0, root_child2.LayoutX);
            Assert.AreEqual(56, root_child2.LayoutY);
            Assert.AreEqual(102, root_child2.LayoutWidth);
            Assert.AreEqual(10, root_child2.LayoutHeight);

            root.StyleDirection = CSSDirection.RightToLeft;
            root.CalculateLayout();

            Assert.AreEqual(0, root.LayoutX);
            Assert.AreEqual(0, root.LayoutY);
            Assert.AreEqual(102, root.LayoutWidth);
            Assert.AreEqual(102, root.LayoutHeight);

            Assert.AreEqual(0, root_child0.LayoutX);
            Assert.AreEqual(36, root_child0.LayoutY);
            Assert.AreEqual(102, root_child0.LayoutWidth);
            Assert.AreEqual(10, root_child0.LayoutHeight);

            Assert.AreEqual(0, root_child1.LayoutX);
            Assert.AreEqual(46, root_child1.LayoutY);
            Assert.AreEqual(102, root_child1.LayoutWidth);
            Assert.AreEqual(10, root_child1.LayoutHeight);

            Assert.AreEqual(0, root_child2.LayoutX);
            Assert.AreEqual(56, root_child2.LayoutY);
            Assert.AreEqual(102, root_child2.LayoutWidth);
            Assert.AreEqual(10, root_child2.LayoutHeight);
        }
开发者ID:zhuyadong,项目名称:css-layout,代码行数:64,代码来源:CSSLayoutJustifyContentTest.cs

示例15: Test_min_width

        public void Test_min_width()
        {
            CSSNode root = new CSSNode();
            root.FlexDirection = CSSFlexDirection.Row;
            root.StyleWidth = 100;
            root.StyleHeight = 100;

            CSSNode root_child0 = new CSSNode();
            root_child0.FlexGrow = 1;
            root_child0.StyleMinWidth = 60;
            root.Insert(0, root_child0);

            CSSNode root_child1 = new CSSNode();
            root_child1.FlexGrow = 1;
            root.Insert(1, root_child1);
            root.StyleDirection = CSSDirection.LeftToRight;
            root.CalculateLayout();

            Assert.AreEqual(0, root.LayoutX);
            Assert.AreEqual(0, root.LayoutY);
            Assert.AreEqual(100, root.LayoutWidth);
            Assert.AreEqual(100, root.LayoutHeight);

            Assert.AreEqual(0, root_child0.LayoutX);
            Assert.AreEqual(0, root_child0.LayoutY);
            Assert.AreEqual(80, root_child0.LayoutWidth);
            Assert.AreEqual(100, root_child0.LayoutHeight);

            Assert.AreEqual(80, root_child1.LayoutX);
            Assert.AreEqual(0, root_child1.LayoutY);
            Assert.AreEqual(20, root_child1.LayoutWidth);
            Assert.AreEqual(100, root_child1.LayoutHeight);

            root.StyleDirection = CSSDirection.RightToLeft;
            root.CalculateLayout();

            Assert.AreEqual(0, root.LayoutX);
            Assert.AreEqual(0, root.LayoutY);
            Assert.AreEqual(100, root.LayoutWidth);
            Assert.AreEqual(100, root.LayoutHeight);

            Assert.AreEqual(20, root_child0.LayoutX);
            Assert.AreEqual(0, root_child0.LayoutY);
            Assert.AreEqual(80, root_child0.LayoutWidth);
            Assert.AreEqual(100, root_child0.LayoutHeight);

            Assert.AreEqual(0, root_child1.LayoutX);
            Assert.AreEqual(0, root_child1.LayoutY);
            Assert.AreEqual(20, root_child1.LayoutWidth);
            Assert.AreEqual(100, root_child1.LayoutHeight);
        }
开发者ID:zhuyadong,项目名称:css-layout,代码行数:51,代码来源:CSSLayoutMinMaxDimensionTest.cs


注:本文中的CSSNode.Insert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。