Add experiment support to gentest

Summary:
This diff does two things
- Clean up some of the generated code making the files smaller.
- Add experiment support to generated tests allowing us to use gentest for things still being experimented with such as more compliant flex-basis behavior.

Reviewed By: gkassabli

Differential Revision: D4226734

fbshipit-source-id: 2cc1471c21883e8e326f16e7a8bb1a3657acd84b
This commit is contained in:
Emil Sjolander
2016-11-23 11:12:51 -08:00
committed by Facebook Github Bot
parent a0d560a24b
commit 22b0fdb3e6
49 changed files with 6574 additions and 6119 deletions

View File

@@ -7,37 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
/**
* @Generated by gentest/gentest.sh with the following input
*
<div id="absolute_layout_width_height_start_top" style="width: 100px; height: 100px;">
<div style="width:10px; height: 10px; position: absolute; start: 10px; top: 10px;"></div>
</div>
<div id="absolute_layout_width_height_end_bottom" style="width: 100px; height: 100px;">
<div style="width:10px; height: 10px; position: absolute; end: 10px; bottom: 10px;"></div>
</div>
<div id="absolute_layout_start_top_end_bottom" style="width: 100px; height: 100px;">
<div style="position: absolute; start: 10px; top: 10px; end: 10px; bottom: 10px;"></div>
</div>
<div id="absolute_layout_width_height_start_top_end_bottom" style="width: 100px; height: 100px;">
<div style="width:10px; height: 10px; position: absolute; start: 10px; top: 10px; end: 10px; bottom: 10px;"></div>
</div>
<div id="do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent" style="height: 50px; width: 50px; overflow: hidden; flex-direction: row;">
<div style="position: absolute; start: 0px; top: 0px;">
<div style="width: 100px; height: 100px;"></div>
</div>
</div>
<div id="absolute_layout_within_border" style="height:100px; width:100px; border-width: 10px; margin: 10px; padding: 10px;">
<div style="position: absolute; width: 50px; height: 50px; left: 0px; top: 0px;"></div>
<div style="position: absolute; width: 50px; height: 50px; right: 0px; bottom: 0px;"></div>
</div>
*
*/
// @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutAbsolutePositionTest.html
using System;
using NUnit.Framework;
@@ -51,166 +21,166 @@ namespace Facebook.CSSLayout
public void Test_absolute_layout_width_height_start_top()
{
CSSNode root = new CSSNode();
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.PositionType = CSSPositionType.Absolute;
root_child0.SetPosition(CSSEdge.Start, 10);
root_child0.SetPosition(CSSEdge.Top, 10);
root_child0.StyleWidth = 10;
root_child0.StyleHeight = 10;
root_child0.SetPosition(CSSEdge.Start, 10f);
root_child0.SetPosition(CSSEdge.Top, 10f);
root_child0.StyleWidth = 10f;
root_child0.StyleHeight = 10f;
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(10, root_child0.LayoutX);
Assert.AreEqual(10, root_child0.LayoutY);
Assert.AreEqual(10, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(10f, root_child0.LayoutX);
Assert.AreEqual(10f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(80, root_child0.LayoutX);
Assert.AreEqual(10, root_child0.LayoutY);
Assert.AreEqual(10, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(80f, root_child0.LayoutX);
Assert.AreEqual(10f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
}
[Test]
public void Test_absolute_layout_width_height_end_bottom()
{
CSSNode root = new CSSNode();
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.PositionType = CSSPositionType.Absolute;
root_child0.SetPosition(CSSEdge.End, 10);
root_child0.SetPosition(CSSEdge.Bottom, 10);
root_child0.StyleWidth = 10;
root_child0.StyleHeight = 10;
root_child0.SetPosition(CSSEdge.End, 10f);
root_child0.SetPosition(CSSEdge.Bottom, 10f);
root_child0.StyleWidth = 10f;
root_child0.StyleHeight = 10f;
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(80, root_child0.LayoutX);
Assert.AreEqual(80, root_child0.LayoutY);
Assert.AreEqual(10, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(80f, root_child0.LayoutX);
Assert.AreEqual(80f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(10, root_child0.LayoutX);
Assert.AreEqual(80, root_child0.LayoutY);
Assert.AreEqual(10, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(10f, root_child0.LayoutX);
Assert.AreEqual(80f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
}
[Test]
public void Test_absolute_layout_start_top_end_bottom()
{
CSSNode root = new CSSNode();
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
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_child0.SetPosition(CSSEdge.Start, 10f);
root_child0.SetPosition(CSSEdge.Top, 10f);
root_child0.SetPosition(CSSEdge.End, 10f);
root_child0.SetPosition(CSSEdge.Bottom, 10f);
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, 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);
Assert.AreEqual(10f, root_child0.LayoutX);
Assert.AreEqual(10f, root_child0.LayoutY);
Assert.AreEqual(80f, root_child0.LayoutWidth);
Assert.AreEqual(80f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, 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);
Assert.AreEqual(10f, root_child0.LayoutX);
Assert.AreEqual(10f, root_child0.LayoutY);
Assert.AreEqual(80f, root_child0.LayoutWidth);
Assert.AreEqual(80f, root_child0.LayoutHeight);
}
[Test]
public void Test_absolute_layout_width_height_start_top_end_bottom()
{
CSSNode root = new CSSNode();
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
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_child0.StyleWidth = 10;
root_child0.StyleHeight = 10;
root_child0.SetPosition(CSSEdge.Start, 10f);
root_child0.SetPosition(CSSEdge.Top, 10f);
root_child0.SetPosition(CSSEdge.End, 10f);
root_child0.SetPosition(CSSEdge.Bottom, 10f);
root_child0.StyleWidth = 10f;
root_child0.StyleHeight = 10f;
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(10, root_child0.LayoutX);
Assert.AreEqual(10, root_child0.LayoutY);
Assert.AreEqual(10, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(10f, root_child0.LayoutX);
Assert.AreEqual(10f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(80, root_child0.LayoutX);
Assert.AreEqual(10, root_child0.LayoutY);
Assert.AreEqual(10, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(80f, root_child0.LayoutX);
Assert.AreEqual(10f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
}
[Test]
@@ -219,125 +189,125 @@ namespace Facebook.CSSLayout
CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row;
root.Overflow = CSSOverflow.Hidden;
root.StyleWidth = 50;
root.StyleHeight = 50;
root.StyleWidth = 50f;
root.StyleHeight = 50f;
CSSNode root_child0 = new CSSNode();
root_child0.PositionType = CSSPositionType.Absolute;
root_child0.SetPosition(CSSEdge.Start, 0);
root_child0.SetPosition(CSSEdge.Top, 0);
root_child0.SetPosition(CSSEdge.Start, 0f);
root_child0.SetPosition(CSSEdge.Top, 0f);
root.Insert(0, root_child0);
CSSNode root_child0_child0 = new CSSNode();
root_child0_child0.StyleWidth = 100;
root_child0_child0.StyleHeight = 100;
root_child0_child0.StyleWidth = 100f;
root_child0_child0.StyleHeight = 100f;
root_child0.Insert(0, root_child0_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(50, root.LayoutWidth);
Assert.AreEqual(50, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(50f, root.LayoutWidth);
Assert.AreEqual(50f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(100, root_child0.LayoutWidth);
Assert.AreEqual(100, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child0_child0.LayoutX);
Assert.AreEqual(0, root_child0_child0.LayoutY);
Assert.AreEqual(100, root_child0_child0.LayoutWidth);
Assert.AreEqual(100, root_child0_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0_child0.LayoutX);
Assert.AreEqual(0f, root_child0_child0.LayoutY);
Assert.AreEqual(100f, root_child0_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(50, root.LayoutWidth);
Assert.AreEqual(50, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(50f, root.LayoutWidth);
Assert.AreEqual(50f, root.LayoutHeight);
Assert.AreEqual(-50, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(100, root_child0.LayoutWidth);
Assert.AreEqual(100, root_child0.LayoutHeight);
Assert.AreEqual(-50f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child0_child0.LayoutX);
Assert.AreEqual(0, root_child0_child0.LayoutY);
Assert.AreEqual(100, root_child0_child0.LayoutWidth);
Assert.AreEqual(100, root_child0_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0_child0.LayoutX);
Assert.AreEqual(0f, root_child0_child0.LayoutY);
Assert.AreEqual(100f, root_child0_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0_child0.LayoutHeight);
}
[Test]
public void Test_absolute_layout_within_border()
{
CSSNode root = new CSSNode();
root.SetMargin(CSSEdge.Left, 10);
root.SetMargin(CSSEdge.Top, 10);
root.SetMargin(CSSEdge.Right, 10);
root.SetMargin(CSSEdge.Bottom, 10);
root.SetPadding(CSSEdge.Left, 10);
root.SetPadding(CSSEdge.Top, 10);
root.SetPadding(CSSEdge.Right, 10);
root.SetPadding(CSSEdge.Bottom, 10);
root.SetBorder(CSSEdge.Left, 10);
root.SetBorder(CSSEdge.Top, 10);
root.SetBorder(CSSEdge.Right, 10);
root.SetBorder(CSSEdge.Bottom, 10);
root.StyleWidth = 100;
root.StyleHeight = 100;
root.SetMargin(CSSEdge.Left, 10f);
root.SetMargin(CSSEdge.Top, 10f);
root.SetMargin(CSSEdge.Right, 10f);
root.SetMargin(CSSEdge.Bottom, 10f);
root.SetPadding(CSSEdge.Left, 10f);
root.SetPadding(CSSEdge.Top, 10f);
root.SetPadding(CSSEdge.Right, 10f);
root.SetPadding(CSSEdge.Bottom, 10f);
root.SetBorder(CSSEdge.Left, 10f);
root.SetBorder(CSSEdge.Top, 10f);
root.SetBorder(CSSEdge.Right, 10f);
root.SetBorder(CSSEdge.Bottom, 10f);
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.PositionType = CSSPositionType.Absolute;
root_child0.SetPosition(CSSEdge.Left, 0);
root_child0.SetPosition(CSSEdge.Top, 0);
root_child0.StyleWidth = 50;
root_child0.StyleHeight = 50;
root_child0.SetPosition(CSSEdge.Left, 0f);
root_child0.SetPosition(CSSEdge.Top, 0f);
root_child0.StyleWidth = 50f;
root_child0.StyleHeight = 50f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.PositionType = CSSPositionType.Absolute;
root_child1.SetPosition(CSSEdge.Right, 0);
root_child1.SetPosition(CSSEdge.Bottom, 0);
root_child1.StyleWidth = 50;
root_child1.StyleHeight = 50;
root_child1.SetPosition(CSSEdge.Right, 0f);
root_child1.SetPosition(CSSEdge.Bottom, 0f);
root_child1.StyleWidth = 50f;
root_child1.StyleHeight = 50f;
root.Insert(1, root_child1);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(10, root.LayoutX);
Assert.AreEqual(10, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(10f, root.LayoutX);
Assert.AreEqual(10f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(10, root_child0.LayoutX);
Assert.AreEqual(10, root_child0.LayoutY);
Assert.AreEqual(50, root_child0.LayoutWidth);
Assert.AreEqual(50, root_child0.LayoutHeight);
Assert.AreEqual(10f, root_child0.LayoutX);
Assert.AreEqual(10f, root_child0.LayoutY);
Assert.AreEqual(50f, root_child0.LayoutWidth);
Assert.AreEqual(50f, root_child0.LayoutHeight);
Assert.AreEqual(40, root_child1.LayoutX);
Assert.AreEqual(40, root_child1.LayoutY);
Assert.AreEqual(50, root_child1.LayoutWidth);
Assert.AreEqual(50, root_child1.LayoutHeight);
Assert.AreEqual(40f, root_child1.LayoutX);
Assert.AreEqual(40f, root_child1.LayoutY);
Assert.AreEqual(50f, root_child1.LayoutWidth);
Assert.AreEqual(50f, root_child1.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(10, root.LayoutX);
Assert.AreEqual(10, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(10f, root.LayoutX);
Assert.AreEqual(10f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(10, root_child0.LayoutX);
Assert.AreEqual(10, root_child0.LayoutY);
Assert.AreEqual(50, root_child0.LayoutWidth);
Assert.AreEqual(50, root_child0.LayoutHeight);
Assert.AreEqual(10f, root_child0.LayoutX);
Assert.AreEqual(10f, root_child0.LayoutY);
Assert.AreEqual(50f, root_child0.LayoutWidth);
Assert.AreEqual(50f, root_child0.LayoutHeight);
Assert.AreEqual(40, root_child1.LayoutX);
Assert.AreEqual(40, root_child1.LayoutY);
Assert.AreEqual(50, root_child1.LayoutWidth);
Assert.AreEqual(50, root_child1.LayoutHeight);
Assert.AreEqual(40f, root_child1.LayoutX);
Assert.AreEqual(40f, root_child1.LayoutY);
Assert.AreEqual(50f, root_child1.LayoutWidth);
Assert.AreEqual(50f, root_child1.LayoutHeight);
}
}

View File

@@ -7,42 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
/**
* @Generated by gentest/gentest.sh with the following input
*
<div id="align_content_flex_start" style="width: 100px; height: 100px; flex-wrap: wrap; flex-direction: column; align-content: flex-start;">
<div style="width: 50px; height: 10px;"></div>
<div style="width: 50px; height: 10px;"></div>
<div style="width: 50px; height: 10px;"></div>
<div style="width: 50px; height: 10px;"></div>
<div style="width: 50px; height: 10px;"></div>
</div>
<div id="align_content_flex_end" style="width: 100px; height: 100px; flex-wrap: wrap; flex-direction: column; align-content: flex-end;">
<div style="width: 50px; height: 10px;"></div>
<div style="width: 50px; height: 10px;"></div>
<div style="width: 50px; height: 10px;"></div>
<div style="width: 50px; height: 10px;"></div>
<div style="width: 50px; height: 10px;"></div>
</div>
<div id="align_content_center" style="width: 100px; height: 100px; flex-wrap: wrap; flex-direction: column; align-content: center;">
<div style="width: 50px; height: 10px;"></div>
<div style="width: 50px; height: 10px;"></div>
<div style="width: 50px; height: 10px;"></div>
<div style="width: 50px; height: 10px;"></div>
<div style="width: 50px; height: 10px;"></div>
</div>
<div id="align_content_stretch" style="width: 100px; height: 100px; flex-wrap: wrap; flex-direction: column; align-content: stretch;">
<div style="width: 50px;"></div>
<div style="width: 50px;"></div>
<div style="width: 50px;"></div>
<div style="width: 50px;"></div>
<div style="width: 50px;"></div>
</div>
*
*/
// @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutAlignContentTest.html
using System;
using NUnit.Framework;
@@ -57,98 +22,98 @@ namespace Facebook.CSSLayout
{
CSSNode root = new CSSNode();
root.Wrap = CSSWrap.Wrap;
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.StyleWidth = 50;
root_child0.StyleHeight = 10;
root_child0.StyleWidth = 50f;
root_child0.StyleHeight = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.StyleWidth = 50;
root_child1.StyleHeight = 10;
root_child1.StyleWidth = 50f;
root_child1.StyleHeight = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
root_child2.StyleWidth = 50;
root_child2.StyleHeight = 10;
root_child2.StyleWidth = 50f;
root_child2.StyleHeight = 10f;
root.Insert(2, root_child2);
CSSNode root_child3 = new CSSNode();
root_child3.StyleWidth = 50;
root_child3.StyleHeight = 10;
root_child3.StyleWidth = 50f;
root_child3.StyleHeight = 10f;
root.Insert(3, root_child3);
CSSNode root_child4 = new CSSNode();
root_child4.StyleWidth = 50;
root_child4.StyleHeight = 10;
root_child4.StyleWidth = 50f;
root_child4.StyleHeight = 10f;
root.Insert(4, root_child4);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(50, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(50f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child1.LayoutX);
Assert.AreEqual(10, root_child1.LayoutY);
Assert.AreEqual(50, root_child1.LayoutWidth);
Assert.AreEqual(10, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(10f, root_child1.LayoutY);
Assert.AreEqual(50f, root_child1.LayoutWidth);
Assert.AreEqual(10f, root_child1.LayoutHeight);
Assert.AreEqual(0, root_child2.LayoutX);
Assert.AreEqual(20, root_child2.LayoutY);
Assert.AreEqual(50, root_child2.LayoutWidth);
Assert.AreEqual(10, root_child2.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(20f, root_child2.LayoutY);
Assert.AreEqual(50f, root_child2.LayoutWidth);
Assert.AreEqual(10f, root_child2.LayoutHeight);
Assert.AreEqual(0, root_child3.LayoutX);
Assert.AreEqual(30, root_child3.LayoutY);
Assert.AreEqual(50, root_child3.LayoutWidth);
Assert.AreEqual(10, root_child3.LayoutHeight);
Assert.AreEqual(0f, root_child3.LayoutX);
Assert.AreEqual(30f, root_child3.LayoutY);
Assert.AreEqual(50f, root_child3.LayoutWidth);
Assert.AreEqual(10f, root_child3.LayoutHeight);
Assert.AreEqual(0, root_child4.LayoutX);
Assert.AreEqual(40, root_child4.LayoutY);
Assert.AreEqual(50, root_child4.LayoutWidth);
Assert.AreEqual(10, root_child4.LayoutHeight);
Assert.AreEqual(0f, root_child4.LayoutX);
Assert.AreEqual(40f, root_child4.LayoutY);
Assert.AreEqual(50f, root_child4.LayoutWidth);
Assert.AreEqual(10f, root_child4.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(50, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(50, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(50f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(50f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
Assert.AreEqual(50, root_child1.LayoutX);
Assert.AreEqual(10, root_child1.LayoutY);
Assert.AreEqual(50, root_child1.LayoutWidth);
Assert.AreEqual(10, root_child1.LayoutHeight);
Assert.AreEqual(50f, root_child1.LayoutX);
Assert.AreEqual(10f, root_child1.LayoutY);
Assert.AreEqual(50f, root_child1.LayoutWidth);
Assert.AreEqual(10f, root_child1.LayoutHeight);
Assert.AreEqual(50, root_child2.LayoutX);
Assert.AreEqual(20, root_child2.LayoutY);
Assert.AreEqual(50, root_child2.LayoutWidth);
Assert.AreEqual(10, root_child2.LayoutHeight);
Assert.AreEqual(50f, root_child2.LayoutX);
Assert.AreEqual(20f, root_child2.LayoutY);
Assert.AreEqual(50f, root_child2.LayoutWidth);
Assert.AreEqual(10f, root_child2.LayoutHeight);
Assert.AreEqual(50, root_child3.LayoutX);
Assert.AreEqual(30, root_child3.LayoutY);
Assert.AreEqual(50, root_child3.LayoutWidth);
Assert.AreEqual(10, root_child3.LayoutHeight);
Assert.AreEqual(50f, root_child3.LayoutX);
Assert.AreEqual(30f, root_child3.LayoutY);
Assert.AreEqual(50f, root_child3.LayoutWidth);
Assert.AreEqual(10f, root_child3.LayoutHeight);
Assert.AreEqual(50, root_child4.LayoutX);
Assert.AreEqual(40, root_child4.LayoutY);
Assert.AreEqual(50, root_child4.LayoutWidth);
Assert.AreEqual(10, root_child4.LayoutHeight);
Assert.AreEqual(50f, root_child4.LayoutX);
Assert.AreEqual(40f, root_child4.LayoutY);
Assert.AreEqual(50f, root_child4.LayoutWidth);
Assert.AreEqual(10f, root_child4.LayoutHeight);
}
[Test]
@@ -157,98 +122,98 @@ namespace Facebook.CSSLayout
CSSNode root = new CSSNode();
root.AlignContent = CSSAlign.FlexEnd;
root.Wrap = CSSWrap.Wrap;
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.StyleWidth = 50;
root_child0.StyleHeight = 10;
root_child0.StyleWidth = 50f;
root_child0.StyleHeight = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.StyleWidth = 50;
root_child1.StyleHeight = 10;
root_child1.StyleWidth = 50f;
root_child1.StyleHeight = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
root_child2.StyleWidth = 50;
root_child2.StyleHeight = 10;
root_child2.StyleWidth = 50f;
root_child2.StyleHeight = 10f;
root.Insert(2, root_child2);
CSSNode root_child3 = new CSSNode();
root_child3.StyleWidth = 50;
root_child3.StyleHeight = 10;
root_child3.StyleWidth = 50f;
root_child3.StyleHeight = 10f;
root.Insert(3, root_child3);
CSSNode root_child4 = new CSSNode();
root_child4.StyleWidth = 50;
root_child4.StyleHeight = 10;
root_child4.StyleWidth = 50f;
root_child4.StyleHeight = 10f;
root.Insert(4, root_child4);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(50, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(50f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child1.LayoutX);
Assert.AreEqual(10, root_child1.LayoutY);
Assert.AreEqual(50, root_child1.LayoutWidth);
Assert.AreEqual(10, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(10f, root_child1.LayoutY);
Assert.AreEqual(50f, root_child1.LayoutWidth);
Assert.AreEqual(10f, root_child1.LayoutHeight);
Assert.AreEqual(0, root_child2.LayoutX);
Assert.AreEqual(20, root_child2.LayoutY);
Assert.AreEqual(50, root_child2.LayoutWidth);
Assert.AreEqual(10, root_child2.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(20f, root_child2.LayoutY);
Assert.AreEqual(50f, root_child2.LayoutWidth);
Assert.AreEqual(10f, root_child2.LayoutHeight);
Assert.AreEqual(0, root_child3.LayoutX);
Assert.AreEqual(30, root_child3.LayoutY);
Assert.AreEqual(50, root_child3.LayoutWidth);
Assert.AreEqual(10, root_child3.LayoutHeight);
Assert.AreEqual(0f, root_child3.LayoutX);
Assert.AreEqual(30f, root_child3.LayoutY);
Assert.AreEqual(50f, root_child3.LayoutWidth);
Assert.AreEqual(10f, root_child3.LayoutHeight);
Assert.AreEqual(0, root_child4.LayoutX);
Assert.AreEqual(40, root_child4.LayoutY);
Assert.AreEqual(50, root_child4.LayoutWidth);
Assert.AreEqual(10, root_child4.LayoutHeight);
Assert.AreEqual(0f, root_child4.LayoutX);
Assert.AreEqual(40f, root_child4.LayoutY);
Assert.AreEqual(50f, root_child4.LayoutWidth);
Assert.AreEqual(10f, root_child4.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(50, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(50, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(50f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(50f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
Assert.AreEqual(50, root_child1.LayoutX);
Assert.AreEqual(10, root_child1.LayoutY);
Assert.AreEqual(50, root_child1.LayoutWidth);
Assert.AreEqual(10, root_child1.LayoutHeight);
Assert.AreEqual(50f, root_child1.LayoutX);
Assert.AreEqual(10f, root_child1.LayoutY);
Assert.AreEqual(50f, root_child1.LayoutWidth);
Assert.AreEqual(10f, root_child1.LayoutHeight);
Assert.AreEqual(50, root_child2.LayoutX);
Assert.AreEqual(20, root_child2.LayoutY);
Assert.AreEqual(50, root_child2.LayoutWidth);
Assert.AreEqual(10, root_child2.LayoutHeight);
Assert.AreEqual(50f, root_child2.LayoutX);
Assert.AreEqual(20f, root_child2.LayoutY);
Assert.AreEqual(50f, root_child2.LayoutWidth);
Assert.AreEqual(10f, root_child2.LayoutHeight);
Assert.AreEqual(50, root_child3.LayoutX);
Assert.AreEqual(30, root_child3.LayoutY);
Assert.AreEqual(50, root_child3.LayoutWidth);
Assert.AreEqual(10, root_child3.LayoutHeight);
Assert.AreEqual(50f, root_child3.LayoutX);
Assert.AreEqual(30f, root_child3.LayoutY);
Assert.AreEqual(50f, root_child3.LayoutWidth);
Assert.AreEqual(10f, root_child3.LayoutHeight);
Assert.AreEqual(50, root_child4.LayoutX);
Assert.AreEqual(40, root_child4.LayoutY);
Assert.AreEqual(50, root_child4.LayoutWidth);
Assert.AreEqual(10, root_child4.LayoutHeight);
Assert.AreEqual(50f, root_child4.LayoutX);
Assert.AreEqual(40f, root_child4.LayoutY);
Assert.AreEqual(50f, root_child4.LayoutWidth);
Assert.AreEqual(10f, root_child4.LayoutHeight);
}
[Test]
@@ -257,98 +222,98 @@ namespace Facebook.CSSLayout
CSSNode root = new CSSNode();
root.AlignContent = CSSAlign.Center;
root.Wrap = CSSWrap.Wrap;
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.StyleWidth = 50;
root_child0.StyleHeight = 10;
root_child0.StyleWidth = 50f;
root_child0.StyleHeight = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.StyleWidth = 50;
root_child1.StyleHeight = 10;
root_child1.StyleWidth = 50f;
root_child1.StyleHeight = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
root_child2.StyleWidth = 50;
root_child2.StyleHeight = 10;
root_child2.StyleWidth = 50f;
root_child2.StyleHeight = 10f;
root.Insert(2, root_child2);
CSSNode root_child3 = new CSSNode();
root_child3.StyleWidth = 50;
root_child3.StyleHeight = 10;
root_child3.StyleWidth = 50f;
root_child3.StyleHeight = 10f;
root.Insert(3, root_child3);
CSSNode root_child4 = new CSSNode();
root_child4.StyleWidth = 50;
root_child4.StyleHeight = 10;
root_child4.StyleWidth = 50f;
root_child4.StyleHeight = 10f;
root.Insert(4, root_child4);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(50, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(50f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child1.LayoutX);
Assert.AreEqual(10, root_child1.LayoutY);
Assert.AreEqual(50, root_child1.LayoutWidth);
Assert.AreEqual(10, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(10f, root_child1.LayoutY);
Assert.AreEqual(50f, root_child1.LayoutWidth);
Assert.AreEqual(10f, root_child1.LayoutHeight);
Assert.AreEqual(0, root_child2.LayoutX);
Assert.AreEqual(20, root_child2.LayoutY);
Assert.AreEqual(50, root_child2.LayoutWidth);
Assert.AreEqual(10, root_child2.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(20f, root_child2.LayoutY);
Assert.AreEqual(50f, root_child2.LayoutWidth);
Assert.AreEqual(10f, root_child2.LayoutHeight);
Assert.AreEqual(0, root_child3.LayoutX);
Assert.AreEqual(30, root_child3.LayoutY);
Assert.AreEqual(50, root_child3.LayoutWidth);
Assert.AreEqual(10, root_child3.LayoutHeight);
Assert.AreEqual(0f, root_child3.LayoutX);
Assert.AreEqual(30f, root_child3.LayoutY);
Assert.AreEqual(50f, root_child3.LayoutWidth);
Assert.AreEqual(10f, root_child3.LayoutHeight);
Assert.AreEqual(0, root_child4.LayoutX);
Assert.AreEqual(40, root_child4.LayoutY);
Assert.AreEqual(50, root_child4.LayoutWidth);
Assert.AreEqual(10, root_child4.LayoutHeight);
Assert.AreEqual(0f, root_child4.LayoutX);
Assert.AreEqual(40f, root_child4.LayoutY);
Assert.AreEqual(50f, root_child4.LayoutWidth);
Assert.AreEqual(10f, root_child4.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(50, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(50, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(50f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(50f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
Assert.AreEqual(50, root_child1.LayoutX);
Assert.AreEqual(10, root_child1.LayoutY);
Assert.AreEqual(50, root_child1.LayoutWidth);
Assert.AreEqual(10, root_child1.LayoutHeight);
Assert.AreEqual(50f, root_child1.LayoutX);
Assert.AreEqual(10f, root_child1.LayoutY);
Assert.AreEqual(50f, root_child1.LayoutWidth);
Assert.AreEqual(10f, root_child1.LayoutHeight);
Assert.AreEqual(50, root_child2.LayoutX);
Assert.AreEqual(20, root_child2.LayoutY);
Assert.AreEqual(50, root_child2.LayoutWidth);
Assert.AreEqual(10, root_child2.LayoutHeight);
Assert.AreEqual(50f, root_child2.LayoutX);
Assert.AreEqual(20f, root_child2.LayoutY);
Assert.AreEqual(50f, root_child2.LayoutWidth);
Assert.AreEqual(10f, root_child2.LayoutHeight);
Assert.AreEqual(50, root_child3.LayoutX);
Assert.AreEqual(30, root_child3.LayoutY);
Assert.AreEqual(50, root_child3.LayoutWidth);
Assert.AreEqual(10, root_child3.LayoutHeight);
Assert.AreEqual(50f, root_child3.LayoutX);
Assert.AreEqual(30f, root_child3.LayoutY);
Assert.AreEqual(50f, root_child3.LayoutWidth);
Assert.AreEqual(10f, root_child3.LayoutHeight);
Assert.AreEqual(50, root_child4.LayoutX);
Assert.AreEqual(40, root_child4.LayoutY);
Assert.AreEqual(50, root_child4.LayoutWidth);
Assert.AreEqual(10, root_child4.LayoutHeight);
Assert.AreEqual(50f, root_child4.LayoutX);
Assert.AreEqual(40f, root_child4.LayoutY);
Assert.AreEqual(50f, root_child4.LayoutWidth);
Assert.AreEqual(10f, root_child4.LayoutHeight);
}
[Test]
@@ -357,93 +322,93 @@ namespace Facebook.CSSLayout
CSSNode root = new CSSNode();
root.AlignContent = CSSAlign.Stretch;
root.Wrap = CSSWrap.Wrap;
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.StyleWidth = 50;
root_child0.StyleWidth = 50f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.StyleWidth = 50;
root_child1.StyleWidth = 50f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
root_child2.StyleWidth = 50;
root_child2.StyleWidth = 50f;
root.Insert(2, root_child2);
CSSNode root_child3 = new CSSNode();
root_child3.StyleWidth = 50;
root_child3.StyleWidth = 50f;
root.Insert(3, root_child3);
CSSNode root_child4 = new CSSNode();
root_child4.StyleWidth = 50;
root_child4.StyleWidth = 50f;
root.Insert(4, root_child4);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(50, root_child0.LayoutWidth);
Assert.AreEqual(0, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(50f, root_child0.LayoutWidth);
Assert.AreEqual(0f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child1.LayoutX);
Assert.AreEqual(0, root_child1.LayoutY);
Assert.AreEqual(50, root_child1.LayoutWidth);
Assert.AreEqual(0, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(0f, root_child1.LayoutY);
Assert.AreEqual(50f, root_child1.LayoutWidth);
Assert.AreEqual(0f, root_child1.LayoutHeight);
Assert.AreEqual(0, root_child2.LayoutX);
Assert.AreEqual(0, root_child2.LayoutY);
Assert.AreEqual(50, root_child2.LayoutWidth);
Assert.AreEqual(0, root_child2.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(0f, root_child2.LayoutY);
Assert.AreEqual(50f, root_child2.LayoutWidth);
Assert.AreEqual(0f, root_child2.LayoutHeight);
Assert.AreEqual(0, root_child3.LayoutX);
Assert.AreEqual(0, root_child3.LayoutY);
Assert.AreEqual(50, root_child3.LayoutWidth);
Assert.AreEqual(0, root_child3.LayoutHeight);
Assert.AreEqual(0f, root_child3.LayoutX);
Assert.AreEqual(0f, root_child3.LayoutY);
Assert.AreEqual(50f, root_child3.LayoutWidth);
Assert.AreEqual(0f, root_child3.LayoutHeight);
Assert.AreEqual(0, root_child4.LayoutX);
Assert.AreEqual(0, root_child4.LayoutY);
Assert.AreEqual(50, root_child4.LayoutWidth);
Assert.AreEqual(0, root_child4.LayoutHeight);
Assert.AreEqual(0f, root_child4.LayoutX);
Assert.AreEqual(0f, root_child4.LayoutY);
Assert.AreEqual(50f, root_child4.LayoutWidth);
Assert.AreEqual(0f, root_child4.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(50, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(50, root_child0.LayoutWidth);
Assert.AreEqual(0, root_child0.LayoutHeight);
Assert.AreEqual(50f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(50f, root_child0.LayoutWidth);
Assert.AreEqual(0f, root_child0.LayoutHeight);
Assert.AreEqual(50, root_child1.LayoutX);
Assert.AreEqual(0, root_child1.LayoutY);
Assert.AreEqual(50, root_child1.LayoutWidth);
Assert.AreEqual(0, root_child1.LayoutHeight);
Assert.AreEqual(50f, root_child1.LayoutX);
Assert.AreEqual(0f, root_child1.LayoutY);
Assert.AreEqual(50f, root_child1.LayoutWidth);
Assert.AreEqual(0f, root_child1.LayoutHeight);
Assert.AreEqual(50, root_child2.LayoutX);
Assert.AreEqual(0, root_child2.LayoutY);
Assert.AreEqual(50, root_child2.LayoutWidth);
Assert.AreEqual(0, root_child2.LayoutHeight);
Assert.AreEqual(50f, root_child2.LayoutX);
Assert.AreEqual(0f, root_child2.LayoutY);
Assert.AreEqual(50f, root_child2.LayoutWidth);
Assert.AreEqual(0f, root_child2.LayoutHeight);
Assert.AreEqual(50, root_child3.LayoutX);
Assert.AreEqual(0, root_child3.LayoutY);
Assert.AreEqual(50, root_child3.LayoutWidth);
Assert.AreEqual(0, root_child3.LayoutHeight);
Assert.AreEqual(50f, root_child3.LayoutX);
Assert.AreEqual(0f, root_child3.LayoutY);
Assert.AreEqual(50f, root_child3.LayoutWidth);
Assert.AreEqual(0f, root_child3.LayoutHeight);
Assert.AreEqual(50, root_child4.LayoutX);
Assert.AreEqual(0, root_child4.LayoutY);
Assert.AreEqual(50, root_child4.LayoutWidth);
Assert.AreEqual(0, root_child4.LayoutHeight);
Assert.AreEqual(50f, root_child4.LayoutX);
Assert.AreEqual(0f, root_child4.LayoutY);
Assert.AreEqual(50f, root_child4.LayoutWidth);
Assert.AreEqual(0f, root_child4.LayoutHeight);
}
}

View File

@@ -7,26 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
/**
* @Generated by gentest/gentest.sh with the following input
*
<div id="align_items_stretch" style="width: 100px; height: 100px;">
<div style="height: 10px;"></div>
</div>
<div id="align_items_center" style="width: 100px; height: 100px; align-items: center;">
<div style="height: 10px; width: 10px;"></div>
</div>
<div id="align_items_flex_start" style="width: 100px; height: 100px; align-items: flex-start;">
<div style="height: 10px; width: 10px;"></div>
</div>
<div id="align_items_flex_end" style="width: 100px; height: 100px; align-items: flex-end;">
<div style="height: 10px; width: 10px;"></div>
</div>
*
*/
// @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutAlignItemsTest.html
using System;
using NUnit.Framework;
@@ -40,37 +21,37 @@ namespace Facebook.CSSLayout
public void Test_align_items_stretch()
{
CSSNode root = new CSSNode();
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.StyleHeight = 10;
root_child0.StyleHeight = 10f;
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(100, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(100, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
}
[Test]
@@ -78,38 +59,38 @@ namespace Facebook.CSSLayout
{
CSSNode root = new CSSNode();
root.AlignItems = CSSAlign.Center;
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.StyleWidth = 10;
root_child0.StyleHeight = 10;
root_child0.StyleWidth = 10f;
root_child0.StyleHeight = 10f;
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, 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);
Assert.AreEqual(45f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, 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);
Assert.AreEqual(45f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
}
[Test]
@@ -117,38 +98,38 @@ namespace Facebook.CSSLayout
{
CSSNode root = new CSSNode();
root.AlignItems = CSSAlign.FlexStart;
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.StyleWidth = 10;
root_child0.StyleHeight = 10;
root_child0.StyleWidth = 10f;
root_child0.StyleHeight = 10f;
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, 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);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, 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);
Assert.AreEqual(90f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
}
[Test]
@@ -156,38 +137,38 @@ namespace Facebook.CSSLayout
{
CSSNode root = new CSSNode();
root.AlignItems = CSSAlign.FlexEnd;
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.StyleWidth = 10;
root_child0.StyleHeight = 10;
root_child0.StyleWidth = 10f;
root_child0.StyleHeight = 10f;
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, 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);
Assert.AreEqual(90f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, 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);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
}
}

View File

@@ -7,26 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
/**
* @Generated by gentest/gentest.sh with the following input
*
<div id="align_self_center" style="width:100px; height: 100px;">
<div style="height: 10px; width: 10px; align-self: center;"></div>
</div>
<div id="align_self_flex_end" style="width:100px; height: 100px;">
<div style="height: 10px; width: 10px; align-self: flex-end;"></div>
</div>
<div id="align_self_flex_start" style="width:100px; height: 100px;">
<div style="height: 10px; width: 10px; align-self: flex-start;"></div>
</div>
<div id="align_self_flex_end_override_flex_start" style="width:100px; height: 100px; align-items: flex-start;">
<div style="height: 10px; width: 10px; align-self: flex-end;"></div>
</div>
*
*/
// @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutAlignSelfTest.html
using System;
using NUnit.Framework;
@@ -40,117 +21,117 @@ namespace Facebook.CSSLayout
public void Test_align_self_center()
{
CSSNode root = new CSSNode();
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.AlignSelf = CSSAlign.Center;
root_child0.StyleWidth = 10;
root_child0.StyleHeight = 10;
root_child0.StyleWidth = 10f;
root_child0.StyleHeight = 10f;
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, 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);
Assert.AreEqual(45f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, 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);
Assert.AreEqual(45f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
}
[Test]
public void Test_align_self_flex_end()
{
CSSNode root = new CSSNode();
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.AlignSelf = CSSAlign.FlexEnd;
root_child0.StyleWidth = 10;
root_child0.StyleHeight = 10;
root_child0.StyleWidth = 10f;
root_child0.StyleHeight = 10f;
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, 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);
Assert.AreEqual(90f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, 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);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
}
[Test]
public void Test_align_self_flex_start()
{
CSSNode root = new CSSNode();
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.AlignSelf = CSSAlign.FlexStart;
root_child0.StyleWidth = 10;
root_child0.StyleHeight = 10;
root_child0.StyleWidth = 10f;
root_child0.StyleHeight = 10f;
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, 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);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, 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);
Assert.AreEqual(90f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
}
[Test]
@@ -158,39 +139,39 @@ namespace Facebook.CSSLayout
{
CSSNode root = new CSSNode();
root.AlignItems = CSSAlign.FlexStart;
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.AlignSelf = CSSAlign.FlexEnd;
root_child0.StyleWidth = 10;
root_child0.StyleHeight = 10;
root_child0.StyleWidth = 10f;
root_child0.StyleHeight = 10f;
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, 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);
Assert.AreEqual(90f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, 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);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
}
}

View File

@@ -7,29 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
/**
* @Generated by gentest/gentest.sh with the following input
*
<div id="border_no_size" style="border-width: 10px;">
</div>
<div id="border_container_match_child" style="border-width: 10px;">
<div style="width: 10px; height: 10px;"></div>
</div>
<div id="border_flex_child" style="width: 100px; height: 100px; border-width: 10px;">
<div style="width: 10px; flex-grow:1"></div>
</div>
<div id="border_stretch_child" style="width: 100px; height: 100px; border-width: 10px;">
<div style="height: 10px;"></div>
</div>
<div id="border_center_child" style="width: 100px; height: 100px; border-start-width: 10px; border-top-width: 10; border-end-width: 20px; border-bottom-width: 20px; align-items: center; justify-content: center;">
<div style="height: 10px; width: 10px;"></div>
</div>
*
*/
// @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutBorderTest.html
using System;
using NUnit.Framework;
@@ -43,148 +21,148 @@ namespace Facebook.CSSLayout
public void Test_border_no_size()
{
CSSNode root = new CSSNode();
root.SetBorder(CSSEdge.Left, 10);
root.SetBorder(CSSEdge.Top, 10);
root.SetBorder(CSSEdge.Right, 10);
root.SetBorder(CSSEdge.Bottom, 10);
root.SetBorder(CSSEdge.Left, 10f);
root.SetBorder(CSSEdge.Top, 10f);
root.SetBorder(CSSEdge.Right, 10f);
root.SetBorder(CSSEdge.Bottom, 10f);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(20, root.LayoutWidth);
Assert.AreEqual(20, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(20f, root.LayoutWidth);
Assert.AreEqual(20f, root.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(20, root.LayoutWidth);
Assert.AreEqual(20, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(20f, root.LayoutWidth);
Assert.AreEqual(20f, root.LayoutHeight);
}
[Test]
public void Test_border_container_match_child()
{
CSSNode root = new CSSNode();
root.SetBorder(CSSEdge.Left, 10);
root.SetBorder(CSSEdge.Top, 10);
root.SetBorder(CSSEdge.Right, 10);
root.SetBorder(CSSEdge.Bottom, 10);
root.SetBorder(CSSEdge.Left, 10f);
root.SetBorder(CSSEdge.Top, 10f);
root.SetBorder(CSSEdge.Right, 10f);
root.SetBorder(CSSEdge.Bottom, 10f);
CSSNode root_child0 = new CSSNode();
root_child0.StyleWidth = 10;
root_child0.StyleHeight = 10;
root_child0.StyleWidth = 10f;
root_child0.StyleHeight = 10f;
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(30, root.LayoutWidth);
Assert.AreEqual(30, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(30f, root.LayoutWidth);
Assert.AreEqual(30f, root.LayoutHeight);
Assert.AreEqual(10, root_child0.LayoutX);
Assert.AreEqual(10, root_child0.LayoutY);
Assert.AreEqual(10, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(10f, root_child0.LayoutX);
Assert.AreEqual(10f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(30, root.LayoutWidth);
Assert.AreEqual(30, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(30f, root.LayoutWidth);
Assert.AreEqual(30f, root.LayoutHeight);
Assert.AreEqual(10, root_child0.LayoutX);
Assert.AreEqual(10, root_child0.LayoutY);
Assert.AreEqual(10, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(10f, root_child0.LayoutX);
Assert.AreEqual(10f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
}
[Test]
public void Test_border_flex_child()
{
CSSNode root = new CSSNode();
root.SetBorder(CSSEdge.Left, 10);
root.SetBorder(CSSEdge.Top, 10);
root.SetBorder(CSSEdge.Right, 10);
root.SetBorder(CSSEdge.Bottom, 10);
root.StyleWidth = 100;
root.StyleHeight = 100;
root.SetBorder(CSSEdge.Left, 10f);
root.SetBorder(CSSEdge.Top, 10f);
root.SetBorder(CSSEdge.Right, 10f);
root.SetBorder(CSSEdge.Bottom, 10f);
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.FlexGrow = 1;
root_child0.StyleWidth = 10;
root_child0.FlexGrow = 1f;
root_child0.StyleWidth = 10f;
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(10, root_child0.LayoutX);
Assert.AreEqual(10, root_child0.LayoutY);
Assert.AreEqual(10, root_child0.LayoutWidth);
Assert.AreEqual(80, root_child0.LayoutHeight);
Assert.AreEqual(10f, root_child0.LayoutX);
Assert.AreEqual(10f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(80f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(80, root_child0.LayoutX);
Assert.AreEqual(10, root_child0.LayoutY);
Assert.AreEqual(10, root_child0.LayoutWidth);
Assert.AreEqual(80, root_child0.LayoutHeight);
Assert.AreEqual(80f, root_child0.LayoutX);
Assert.AreEqual(10f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(80f, root_child0.LayoutHeight);
}
[Test]
public void Test_border_stretch_child()
{
CSSNode root = new CSSNode();
root.SetBorder(CSSEdge.Left, 10);
root.SetBorder(CSSEdge.Top, 10);
root.SetBorder(CSSEdge.Right, 10);
root.SetBorder(CSSEdge.Bottom, 10);
root.StyleWidth = 100;
root.StyleHeight = 100;
root.SetBorder(CSSEdge.Left, 10f);
root.SetBorder(CSSEdge.Top, 10f);
root.SetBorder(CSSEdge.Right, 10f);
root.SetBorder(CSSEdge.Bottom, 10f);
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.StyleHeight = 10;
root_child0.StyleHeight = 10f;
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(10, root_child0.LayoutX);
Assert.AreEqual(10, root_child0.LayoutY);
Assert.AreEqual(80, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(10f, root_child0.LayoutX);
Assert.AreEqual(10f, root_child0.LayoutY);
Assert.AreEqual(80f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(10, root_child0.LayoutX);
Assert.AreEqual(10, root_child0.LayoutY);
Assert.AreEqual(80, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(10f, root_child0.LayoutX);
Assert.AreEqual(10f, root_child0.LayoutY);
Assert.AreEqual(80f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
}
[Test]
@@ -193,41 +171,41 @@ namespace Facebook.CSSLayout
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;
root.SetBorder(CSSEdge.Start, 10f);
root.SetBorder(CSSEdge.End, 20f);
root.SetBorder(CSSEdge.Bottom, 20f);
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.StyleWidth = 10;
root_child0.StyleHeight = 10;
root_child0.StyleWidth = 10f;
root_child0.StyleHeight = 10f;
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, 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);
Assert.AreEqual(40f, root_child0.LayoutX);
Assert.AreEqual(35f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, 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);
Assert.AreEqual(50f, root_child0.LayoutX);
Assert.AreEqual(35f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
}
}

View File

@@ -7,46 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
/**
* @Generated by gentest/gentest.sh with the following input
*
<div id="flex_direction_column_no_height" style="width: 100px">
<div style="height: 10px;"></div>
<div style="height: 10px;"></div>
<div style="height: 10px;"></div>
</div>
<div id="flex_direction_row_no_width" style="height: 100px; flex-direction: row;">
<div style="width: 10px;"></div>
<div style="width: 10px;"></div>
<div style="width: 10px;"></div>
</div>
<div id="flex_direction_column" style="height: 100px; width: 100px;">
<div style="height: 10px;"></div>
<div style="height: 10px;"></div>
<div style="height: 10px;"></div>
</div>
<div id="flex_direction_row" style="height: 100px; width: 100px; flex-direction: row;">
<div style="width: 10px;"></div>
<div style="width: 10px;"></div>
<div style="width: 10px;"></div>
</div>
<div id="flex_direction_column_reverse" style="height: 100px; width: 100px; flex-direction: column-reverse;">
<div style="height: 10px;"></div>
<div style="height: 10px;"></div>
<div style="height: 10px;"></div>
</div>
<div id="flex_direction_row_reverse" style="height: 100px; width: 100px; flex-direction: row-reverse;">
<div style="width: 10px;"></div>
<div style="width: 10px;"></div>
<div style="width: 10px;"></div>
</div>
*
*/
// @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutFlexDirectionTest.html
using System;
using NUnit.Framework;
@@ -60,64 +21,64 @@ namespace Facebook.CSSLayout
public void Test_flex_direction_column_no_height()
{
CSSNode root = new CSSNode();
root.StyleWidth = 100;
root.StyleWidth = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.StyleHeight = 10;
root_child0.StyleHeight = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.StyleHeight = 10;
root_child1.StyleHeight = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
root_child2.StyleHeight = 10;
root_child2.StyleHeight = 10f;
root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(30, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(30f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(100, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child1.LayoutX);
Assert.AreEqual(10, root_child1.LayoutY);
Assert.AreEqual(100, root_child1.LayoutWidth);
Assert.AreEqual(10, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(10f, root_child1.LayoutY);
Assert.AreEqual(100f, root_child1.LayoutWidth);
Assert.AreEqual(10f, root_child1.LayoutHeight);
Assert.AreEqual(0, root_child2.LayoutX);
Assert.AreEqual(20, root_child2.LayoutY);
Assert.AreEqual(100, root_child2.LayoutWidth);
Assert.AreEqual(10, root_child2.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(20f, root_child2.LayoutY);
Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(10f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(30, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(30f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(100, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child1.LayoutX);
Assert.AreEqual(10, root_child1.LayoutY);
Assert.AreEqual(100, root_child1.LayoutWidth);
Assert.AreEqual(10, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(10f, root_child1.LayoutY);
Assert.AreEqual(100f, root_child1.LayoutWidth);
Assert.AreEqual(10f, root_child1.LayoutHeight);
Assert.AreEqual(0, root_child2.LayoutX);
Assert.AreEqual(20, root_child2.LayoutY);
Assert.AreEqual(100, root_child2.LayoutWidth);
Assert.AreEqual(10, root_child2.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(20f, root_child2.LayoutY);
Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(10f, root_child2.LayoutHeight);
}
[Test]
@@ -125,129 +86,129 @@ namespace Facebook.CSSLayout
{
CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row;
root.StyleHeight = 100;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.StyleWidth = 10;
root_child0.StyleWidth = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.StyleWidth = 10;
root_child1.StyleWidth = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
root_child2.StyleWidth = 10;
root_child2.StyleWidth = 10f;
root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(30, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(30f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(10, root_child0.LayoutWidth);
Assert.AreEqual(100, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight);
Assert.AreEqual(10, root_child1.LayoutX);
Assert.AreEqual(0, root_child1.LayoutY);
Assert.AreEqual(10, root_child1.LayoutWidth);
Assert.AreEqual(100, root_child1.LayoutHeight);
Assert.AreEqual(10f, root_child1.LayoutX);
Assert.AreEqual(0f, root_child1.LayoutY);
Assert.AreEqual(10f, root_child1.LayoutWidth);
Assert.AreEqual(100f, root_child1.LayoutHeight);
Assert.AreEqual(20, root_child2.LayoutX);
Assert.AreEqual(0, root_child2.LayoutY);
Assert.AreEqual(10, root_child2.LayoutWidth);
Assert.AreEqual(100, root_child2.LayoutHeight);
Assert.AreEqual(20f, root_child2.LayoutX);
Assert.AreEqual(0f, root_child2.LayoutY);
Assert.AreEqual(10f, root_child2.LayoutWidth);
Assert.AreEqual(100f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(30, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(30f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(20, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(10, root_child0.LayoutWidth);
Assert.AreEqual(100, root_child0.LayoutHeight);
Assert.AreEqual(20f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight);
Assert.AreEqual(10, root_child1.LayoutX);
Assert.AreEqual(0, root_child1.LayoutY);
Assert.AreEqual(10, root_child1.LayoutWidth);
Assert.AreEqual(100, root_child1.LayoutHeight);
Assert.AreEqual(10f, root_child1.LayoutX);
Assert.AreEqual(0f, root_child1.LayoutY);
Assert.AreEqual(10f, root_child1.LayoutWidth);
Assert.AreEqual(100f, root_child1.LayoutHeight);
Assert.AreEqual(0, root_child2.LayoutX);
Assert.AreEqual(0, root_child2.LayoutY);
Assert.AreEqual(10, root_child2.LayoutWidth);
Assert.AreEqual(100, root_child2.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(0f, root_child2.LayoutY);
Assert.AreEqual(10f, root_child2.LayoutWidth);
Assert.AreEqual(100f, root_child2.LayoutHeight);
}
[Test]
public void Test_flex_direction_column()
{
CSSNode root = new CSSNode();
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.StyleHeight = 10;
root_child0.StyleHeight = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.StyleHeight = 10;
root_child1.StyleHeight = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
root_child2.StyleHeight = 10;
root_child2.StyleHeight = 10f;
root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(100, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child1.LayoutX);
Assert.AreEqual(10, root_child1.LayoutY);
Assert.AreEqual(100, root_child1.LayoutWidth);
Assert.AreEqual(10, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(10f, root_child1.LayoutY);
Assert.AreEqual(100f, root_child1.LayoutWidth);
Assert.AreEqual(10f, root_child1.LayoutHeight);
Assert.AreEqual(0, root_child2.LayoutX);
Assert.AreEqual(20, root_child2.LayoutY);
Assert.AreEqual(100, root_child2.LayoutWidth);
Assert.AreEqual(10, root_child2.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(20f, root_child2.LayoutY);
Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(10f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(100, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child1.LayoutX);
Assert.AreEqual(10, root_child1.LayoutY);
Assert.AreEqual(100, root_child1.LayoutWidth);
Assert.AreEqual(10, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(10f, root_child1.LayoutY);
Assert.AreEqual(100f, root_child1.LayoutWidth);
Assert.AreEqual(10f, root_child1.LayoutHeight);
Assert.AreEqual(0, root_child2.LayoutX);
Assert.AreEqual(20, root_child2.LayoutY);
Assert.AreEqual(100, root_child2.LayoutWidth);
Assert.AreEqual(10, root_child2.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(20f, root_child2.LayoutY);
Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(10f, root_child2.LayoutHeight);
}
[Test]
@@ -255,65 +216,65 @@ namespace Facebook.CSSLayout
{
CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row;
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.StyleWidth = 10;
root_child0.StyleWidth = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.StyleWidth = 10;
root_child1.StyleWidth = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
root_child2.StyleWidth = 10;
root_child2.StyleWidth = 10f;
root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(10, root_child0.LayoutWidth);
Assert.AreEqual(100, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight);
Assert.AreEqual(10, root_child1.LayoutX);
Assert.AreEqual(0, root_child1.LayoutY);
Assert.AreEqual(10, root_child1.LayoutWidth);
Assert.AreEqual(100, root_child1.LayoutHeight);
Assert.AreEqual(10f, root_child1.LayoutX);
Assert.AreEqual(0f, root_child1.LayoutY);
Assert.AreEqual(10f, root_child1.LayoutWidth);
Assert.AreEqual(100f, root_child1.LayoutHeight);
Assert.AreEqual(20, root_child2.LayoutX);
Assert.AreEqual(0, root_child2.LayoutY);
Assert.AreEqual(10, root_child2.LayoutWidth);
Assert.AreEqual(100, root_child2.LayoutHeight);
Assert.AreEqual(20f, root_child2.LayoutX);
Assert.AreEqual(0f, root_child2.LayoutY);
Assert.AreEqual(10f, root_child2.LayoutWidth);
Assert.AreEqual(100f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(90, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(10, root_child0.LayoutWidth);
Assert.AreEqual(100, root_child0.LayoutHeight);
Assert.AreEqual(90f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight);
Assert.AreEqual(80, root_child1.LayoutX);
Assert.AreEqual(0, root_child1.LayoutY);
Assert.AreEqual(10, root_child1.LayoutWidth);
Assert.AreEqual(100, root_child1.LayoutHeight);
Assert.AreEqual(80f, root_child1.LayoutX);
Assert.AreEqual(0f, root_child1.LayoutY);
Assert.AreEqual(10f, root_child1.LayoutWidth);
Assert.AreEqual(100f, root_child1.LayoutHeight);
Assert.AreEqual(70, root_child2.LayoutX);
Assert.AreEqual(0, root_child2.LayoutY);
Assert.AreEqual(10, root_child2.LayoutWidth);
Assert.AreEqual(100, root_child2.LayoutHeight);
Assert.AreEqual(70f, root_child2.LayoutX);
Assert.AreEqual(0f, root_child2.LayoutY);
Assert.AreEqual(10f, root_child2.LayoutWidth);
Assert.AreEqual(100f, root_child2.LayoutHeight);
}
[Test]
@@ -321,65 +282,65 @@ namespace Facebook.CSSLayout
{
CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.ColumnReverse;
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.StyleHeight = 10;
root_child0.StyleHeight = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.StyleHeight = 10;
root_child1.StyleHeight = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
root_child2.StyleHeight = 10;
root_child2.StyleHeight = 10f;
root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(90, root_child0.LayoutY);
Assert.AreEqual(100, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(90f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child1.LayoutX);
Assert.AreEqual(80, root_child1.LayoutY);
Assert.AreEqual(100, root_child1.LayoutWidth);
Assert.AreEqual(10, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(80f, root_child1.LayoutY);
Assert.AreEqual(100f, root_child1.LayoutWidth);
Assert.AreEqual(10f, root_child1.LayoutHeight);
Assert.AreEqual(0, root_child2.LayoutX);
Assert.AreEqual(70, root_child2.LayoutY);
Assert.AreEqual(100, root_child2.LayoutWidth);
Assert.AreEqual(10, root_child2.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(70f, root_child2.LayoutY);
Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(10f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(90, root_child0.LayoutY);
Assert.AreEqual(100, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(90f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child1.LayoutX);
Assert.AreEqual(80, root_child1.LayoutY);
Assert.AreEqual(100, root_child1.LayoutWidth);
Assert.AreEqual(10, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(80f, root_child1.LayoutY);
Assert.AreEqual(100f, root_child1.LayoutWidth);
Assert.AreEqual(10f, root_child1.LayoutHeight);
Assert.AreEqual(0, root_child2.LayoutX);
Assert.AreEqual(70, root_child2.LayoutY);
Assert.AreEqual(100, root_child2.LayoutWidth);
Assert.AreEqual(10, root_child2.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(70f, root_child2.LayoutY);
Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(10f, root_child2.LayoutHeight);
}
[Test]
@@ -387,65 +348,65 @@ namespace Facebook.CSSLayout
{
CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.RowReverse;
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.StyleWidth = 10;
root_child0.StyleWidth = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.StyleWidth = 10;
root_child1.StyleWidth = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
root_child2.StyleWidth = 10;
root_child2.StyleWidth = 10f;
root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(90, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(10, root_child0.LayoutWidth);
Assert.AreEqual(100, root_child0.LayoutHeight);
Assert.AreEqual(90f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight);
Assert.AreEqual(80, root_child1.LayoutX);
Assert.AreEqual(0, root_child1.LayoutY);
Assert.AreEqual(10, root_child1.LayoutWidth);
Assert.AreEqual(100, root_child1.LayoutHeight);
Assert.AreEqual(80f, root_child1.LayoutX);
Assert.AreEqual(0f, root_child1.LayoutY);
Assert.AreEqual(10f, root_child1.LayoutWidth);
Assert.AreEqual(100f, root_child1.LayoutHeight);
Assert.AreEqual(70, root_child2.LayoutX);
Assert.AreEqual(0, root_child2.LayoutY);
Assert.AreEqual(10, root_child2.LayoutWidth);
Assert.AreEqual(100, root_child2.LayoutHeight);
Assert.AreEqual(70f, root_child2.LayoutX);
Assert.AreEqual(0f, root_child2.LayoutY);
Assert.AreEqual(10f, root_child2.LayoutWidth);
Assert.AreEqual(100f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(10, root_child0.LayoutWidth);
Assert.AreEqual(100, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight);
Assert.AreEqual(10, root_child1.LayoutX);
Assert.AreEqual(0, root_child1.LayoutY);
Assert.AreEqual(10, root_child1.LayoutWidth);
Assert.AreEqual(100, root_child1.LayoutHeight);
Assert.AreEqual(10f, root_child1.LayoutX);
Assert.AreEqual(0f, root_child1.LayoutY);
Assert.AreEqual(10f, root_child1.LayoutWidth);
Assert.AreEqual(100f, root_child1.LayoutHeight);
Assert.AreEqual(20, root_child2.LayoutX);
Assert.AreEqual(0, root_child2.LayoutY);
Assert.AreEqual(10, root_child2.LayoutWidth);
Assert.AreEqual(100, root_child2.LayoutHeight);
Assert.AreEqual(20f, root_child2.LayoutX);
Assert.AreEqual(0f, root_child2.LayoutY);
Assert.AreEqual(10f, root_child2.LayoutWidth);
Assert.AreEqual(100f, root_child2.LayoutHeight);
}
}

View File

@@ -7,48 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
/**
* @Generated by gentest/gentest.sh with the following input
*
<div id="flex_basis_flex_grow_column" style="width: 100px; height: 100px;">
<div style="flex-basis: 50px; flex-grow: 1;"></div>
<div style="flex-grow: 1;"></div>
</div>
<div id="flex_basis_flex_grow_row" style="width: 100px; height: 100px; flex-direction: row;">
<div style="flex-basis: 50px; flex-grow: 1;"></div>
<div style="flex-grow: 1;"></div>
</div>
<div id="flex_basis_flex_shrink_column" style="width: 100px; height: 100px;">
<div style="flex-basis: 100px; flex-shrink: 1;"></div>
<div style="flex-basis: 50px;"></div>
</div>
<div id="flex_basis_flex_shrink_row" style="width: 100px; height: 100px; flex-direction: row;">
<div style="flex-basis: 100px; flex-shrink: 1;"></div>
<div style="flex-basis: 50px;"></div>
</div>
<div id="flex_shrink_to_zero" style="height: 75px;">
<div style="width: 50px; height: 50px; flex-shrink:0;"></div>
<div style="width: 50px; height: 50px; flex-shrink:1;"></div>
<div style="width: 50px; height: 50px; flex-shrink:0;"></div>
</div>
<div id="flex_basis_overrides_main_size" style="height: 100px; width: 100px;">
<div style="height: 20px; flex-grow:1; flex-basis:50px;"></div>
<div style="height: 10px; flex-grow:1;"></div>
<div style="height: 10px; flex-grow:1;"></div>
</div>
<div id="flex_grow_shrink_at_most" style="height: 100px; width: 100px;">
<div>
<div style="flex-grow:1; flex-shrink:1;"></div>
</div>
</div>
*
*/
// @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutFlexTest.html
using System;
using NUnit.Framework;
@@ -62,52 +21,52 @@ namespace Facebook.CSSLayout
public void Test_flex_basis_flex_grow_column()
{
CSSNode root = new CSSNode();
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.FlexGrow = 1;
root_child0.FlexBasis = 50;
root_child0.FlexGrow = 1f;
root_child0.FlexBasis = 50f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.FlexGrow = 1;
root_child1.FlexGrow = 1f;
root.Insert(1, root_child1);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, 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(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(75f, 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);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(75f, root_child1.LayoutY);
Assert.AreEqual(100f, root_child1.LayoutWidth);
Assert.AreEqual(25f, root_child1.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, 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(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(75f, 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);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(75f, root_child1.LayoutY);
Assert.AreEqual(100f, root_child1.LayoutWidth);
Assert.AreEqual(25f, root_child1.LayoutHeight);
}
[Test]
@@ -115,104 +74,104 @@ namespace Facebook.CSSLayout
{
CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row;
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.FlexGrow = 1;
root_child0.FlexBasis = 50;
root_child0.FlexGrow = 1f;
root_child0.FlexBasis = 50f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.FlexGrow = 1;
root_child1.FlexGrow = 1f;
root.Insert(1, root_child1);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(75, root_child0.LayoutWidth);
Assert.AreEqual(100, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(75f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight);
Assert.AreEqual(75, root_child1.LayoutX);
Assert.AreEqual(0, root_child1.LayoutY);
Assert.AreEqual(25, root_child1.LayoutWidth);
Assert.AreEqual(100, root_child1.LayoutHeight);
Assert.AreEqual(75f, root_child1.LayoutX);
Assert.AreEqual(0f, root_child1.LayoutY);
Assert.AreEqual(25f, root_child1.LayoutWidth);
Assert.AreEqual(100f, root_child1.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(25, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(75, root_child0.LayoutWidth);
Assert.AreEqual(100, root_child0.LayoutHeight);
Assert.AreEqual(25f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(75f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child1.LayoutX);
Assert.AreEqual(0, root_child1.LayoutY);
Assert.AreEqual(25, root_child1.LayoutWidth);
Assert.AreEqual(100, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(0f, root_child1.LayoutY);
Assert.AreEqual(25f, root_child1.LayoutWidth);
Assert.AreEqual(100f, root_child1.LayoutHeight);
}
[Test]
public void Test_flex_basis_flex_shrink_column()
{
CSSNode root = new CSSNode();
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.FlexShrink = 1;
root_child0.FlexBasis = 100;
root_child0.FlexShrink = 1f;
root_child0.FlexBasis = 100f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.FlexBasis = 50;
root_child1.FlexBasis = 50f;
root.Insert(1, root_child1);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(100, root_child0.LayoutWidth);
Assert.AreEqual(50, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(50f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child1.LayoutX);
Assert.AreEqual(50, root_child1.LayoutY);
Assert.AreEqual(100, root_child1.LayoutWidth);
Assert.AreEqual(50, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(50f, root_child1.LayoutY);
Assert.AreEqual(100f, root_child1.LayoutWidth);
Assert.AreEqual(50f, root_child1.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(100, root_child0.LayoutWidth);
Assert.AreEqual(50, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(50f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child1.LayoutX);
Assert.AreEqual(50, root_child1.LayoutY);
Assert.AreEqual(100, root_child1.LayoutWidth);
Assert.AreEqual(50, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(50f, root_child1.LayoutY);
Assert.AreEqual(100f, root_child1.LayoutWidth);
Assert.AreEqual(50f, root_child1.LayoutHeight);
}
[Test]
@@ -220,240 +179,240 @@ namespace Facebook.CSSLayout
{
CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row;
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.FlexShrink = 1;
root_child0.FlexBasis = 100;
root_child0.FlexShrink = 1f;
root_child0.FlexBasis = 100f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.FlexBasis = 50;
root_child1.FlexBasis = 50f;
root.Insert(1, root_child1);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(50, root_child0.LayoutWidth);
Assert.AreEqual(100, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(50f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight);
Assert.AreEqual(50, root_child1.LayoutX);
Assert.AreEqual(0, root_child1.LayoutY);
Assert.AreEqual(50, root_child1.LayoutWidth);
Assert.AreEqual(100, root_child1.LayoutHeight);
Assert.AreEqual(50f, root_child1.LayoutX);
Assert.AreEqual(0f, root_child1.LayoutY);
Assert.AreEqual(50f, root_child1.LayoutWidth);
Assert.AreEqual(100f, root_child1.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(50, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(50, root_child0.LayoutWidth);
Assert.AreEqual(100, root_child0.LayoutHeight);
Assert.AreEqual(50f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(50f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child1.LayoutX);
Assert.AreEqual(0, root_child1.LayoutY);
Assert.AreEqual(50, root_child1.LayoutWidth);
Assert.AreEqual(100, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(0f, root_child1.LayoutY);
Assert.AreEqual(50f, root_child1.LayoutWidth);
Assert.AreEqual(100f, root_child1.LayoutHeight);
}
[Test]
public void Test_flex_shrink_to_zero()
{
CSSNode root = new CSSNode();
root.StyleHeight = 75;
root.StyleHeight = 75f;
CSSNode root_child0 = new CSSNode();
root_child0.StyleWidth = 50;
root_child0.StyleHeight = 50;
root_child0.StyleWidth = 50f;
root_child0.StyleHeight = 50f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.FlexShrink = 1;
root_child1.StyleWidth = 50;
root_child1.StyleHeight = 50;
root_child1.FlexShrink = 1f;
root_child1.StyleWidth = 50f;
root_child1.StyleHeight = 50f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
root_child2.StyleWidth = 50;
root_child2.StyleHeight = 50;
root_child2.StyleWidth = 50f;
root_child2.StyleHeight = 50f;
root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(50, root.LayoutWidth);
Assert.AreEqual(75, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(50f, root.LayoutWidth);
Assert.AreEqual(75f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(50, root_child0.LayoutWidth);
Assert.AreEqual(50, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(50f, root_child0.LayoutWidth);
Assert.AreEqual(50f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child1.LayoutX);
Assert.AreEqual(50, root_child1.LayoutY);
Assert.AreEqual(50, root_child1.LayoutWidth);
Assert.AreEqual(0, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(50f, root_child1.LayoutY);
Assert.AreEqual(50f, root_child1.LayoutWidth);
Assert.AreEqual(0f, root_child1.LayoutHeight);
Assert.AreEqual(0, root_child2.LayoutX);
Assert.AreEqual(50, root_child2.LayoutY);
Assert.AreEqual(50, root_child2.LayoutWidth);
Assert.AreEqual(50, root_child2.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(50f, root_child2.LayoutY);
Assert.AreEqual(50f, root_child2.LayoutWidth);
Assert.AreEqual(50f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(50, root.LayoutWidth);
Assert.AreEqual(75, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(50f, root.LayoutWidth);
Assert.AreEqual(75f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(50, root_child0.LayoutWidth);
Assert.AreEqual(50, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(50f, root_child0.LayoutWidth);
Assert.AreEqual(50f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child1.LayoutX);
Assert.AreEqual(50, root_child1.LayoutY);
Assert.AreEqual(50, root_child1.LayoutWidth);
Assert.AreEqual(0, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(50f, root_child1.LayoutY);
Assert.AreEqual(50f, root_child1.LayoutWidth);
Assert.AreEqual(0f, root_child1.LayoutHeight);
Assert.AreEqual(0, root_child2.LayoutX);
Assert.AreEqual(50, root_child2.LayoutY);
Assert.AreEqual(50, root_child2.LayoutWidth);
Assert.AreEqual(50, root_child2.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(50f, root_child2.LayoutY);
Assert.AreEqual(50f, root_child2.LayoutWidth);
Assert.AreEqual(50f, root_child2.LayoutHeight);
}
[Test]
public void Test_flex_basis_overrides_main_size()
{
CSSNode root = new CSSNode();
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.FlexGrow = 1;
root_child0.FlexBasis = 50;
root_child0.StyleHeight = 20;
root_child0.FlexGrow = 1f;
root_child0.FlexBasis = 50f;
root_child0.StyleHeight = 20f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.FlexGrow = 1;
root_child1.StyleHeight = 10;
root_child1.FlexGrow = 1f;
root_child1.StyleHeight = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
root_child2.FlexGrow = 1;
root_child2.StyleHeight = 10;
root_child2.FlexGrow = 1f;
root_child2.StyleHeight = 10f;
root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(100, root_child0.LayoutWidth);
Assert.AreEqual(60, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(60f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child1.LayoutX);
Assert.AreEqual(60, root_child1.LayoutY);
Assert.AreEqual(100, root_child1.LayoutWidth);
Assert.AreEqual(20, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(60f, root_child1.LayoutY);
Assert.AreEqual(100f, root_child1.LayoutWidth);
Assert.AreEqual(20f, root_child1.LayoutHeight);
Assert.AreEqual(0, root_child2.LayoutX);
Assert.AreEqual(80, root_child2.LayoutY);
Assert.AreEqual(100, root_child2.LayoutWidth);
Assert.AreEqual(20, root_child2.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(80f, root_child2.LayoutY);
Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(20f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(100, root_child0.LayoutWidth);
Assert.AreEqual(60, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(60f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child1.LayoutX);
Assert.AreEqual(60, root_child1.LayoutY);
Assert.AreEqual(100, root_child1.LayoutWidth);
Assert.AreEqual(20, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(60f, root_child1.LayoutY);
Assert.AreEqual(100f, root_child1.LayoutWidth);
Assert.AreEqual(20f, root_child1.LayoutHeight);
Assert.AreEqual(0, root_child2.LayoutX);
Assert.AreEqual(80, root_child2.LayoutY);
Assert.AreEqual(100, root_child2.LayoutWidth);
Assert.AreEqual(20, root_child2.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(80f, root_child2.LayoutY);
Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(20f, root_child2.LayoutHeight);
}
[Test]
public void Test_flex_grow_shrink_at_most()
{
CSSNode root = new CSSNode();
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root.Insert(0, root_child0);
CSSNode root_child0_child0 = new CSSNode();
root_child0_child0.FlexGrow = 1;
root_child0_child0.FlexShrink = 1;
root_child0_child0.FlexGrow = 1f;
root_child0_child0.FlexShrink = 1f;
root_child0.Insert(0, root_child0_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(100, root_child0.LayoutWidth);
Assert.AreEqual(0, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(0f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child0_child0.LayoutX);
Assert.AreEqual(0, root_child0_child0.LayoutY);
Assert.AreEqual(100, root_child0_child0.LayoutWidth);
Assert.AreEqual(0, root_child0_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0_child0.LayoutX);
Assert.AreEqual(0f, root_child0_child0.LayoutY);
Assert.AreEqual(100f, root_child0_child0.LayoutWidth);
Assert.AreEqual(0f, root_child0_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(100, root_child0.LayoutWidth);
Assert.AreEqual(0, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(0f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child0_child0.LayoutX);
Assert.AreEqual(0, root_child0_child0.LayoutY);
Assert.AreEqual(100, root_child0_child0.LayoutWidth);
Assert.AreEqual(0, root_child0_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0_child0.LayoutX);
Assert.AreEqual(0f, root_child0_child0.LayoutY);
Assert.AreEqual(100f, root_child0_child0.LayoutWidth);
Assert.AreEqual(0f, root_child0_child0.LayoutHeight);
}
}

View File

@@ -7,38 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
/**
* @Generated by gentest/gentest.sh with the following input
*
<div id="wrap_column" style="height: 100px; flex-wrap: wrap">
<div style="height: 30px; width: 30px;"></div>
<div style="height: 30px; width: 30px;"></div>
<div style="height: 30px; width: 30px;"></div>
<div style="height: 30px; width: 30px;"></div>
</div>
<div id="wrap_row" style="width: 100px; flex-direction: row; flex-wrap: wrap">
<div style="height: 30px; width: 30px;"></div>
<div style="height: 30px; width: 30px;"></div>
<div style="height: 30px; width: 30px;"></div>
<div style="height: 30px; width: 30px;"></div>
</div>
<div id="wrap_row_align_items_flex_end" style="width: 100px; flex-direction: row; flex-wrap: wrap; align-items: flex-end;">
<div style="height: 10px; width: 30px;"></div>
<div style="height: 20px; width: 30px;"></div>
<div style="height: 30px; width: 30px;"></div>
<div style="height: 30px; width: 30px;"></div>
</div>
<div id="wrap_row_align_items_center" style="width: 100px; flex-direction: row; flex-wrap: wrap; align-items: center;">
<div style="height: 10px; width: 30px;"></div>
<div style="height: 20px; width: 30px;"></div>
<div style="height: 30px; width: 30px;"></div>
<div style="height: 30px; width: 30px;"></div>
</div>
*
*/
// @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutFlexWrapTest.html
using System;
using NUnit.Framework;
@@ -53,82 +22,82 @@ namespace Facebook.CSSLayout
{
CSSNode root = new CSSNode();
root.Wrap = CSSWrap.Wrap;
root.StyleHeight = 100;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.StyleWidth = 30;
root_child0.StyleHeight = 30;
root_child0.StyleWidth = 30f;
root_child0.StyleHeight = 30f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.StyleWidth = 30;
root_child1.StyleHeight = 30;
root_child1.StyleWidth = 30f;
root_child1.StyleHeight = 30f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
root_child2.StyleWidth = 30;
root_child2.StyleHeight = 30;
root_child2.StyleWidth = 30f;
root_child2.StyleHeight = 30f;
root.Insert(2, root_child2);
CSSNode root_child3 = new CSSNode();
root_child3.StyleWidth = 30;
root_child3.StyleHeight = 30;
root_child3.StyleWidth = 30f;
root_child3.StyleHeight = 30f;
root.Insert(3, root_child3);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(60, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(60f, root.LayoutWidth);
Assert.AreEqual(100f, 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(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(30f, root_child0.LayoutWidth);
Assert.AreEqual(30f, 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(0f, root_child1.LayoutX);
Assert.AreEqual(30f, root_child1.LayoutY);
Assert.AreEqual(30f, root_child1.LayoutWidth);
Assert.AreEqual(30f, 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(0f, root_child2.LayoutX);
Assert.AreEqual(60f, root_child2.LayoutY);
Assert.AreEqual(30f, root_child2.LayoutWidth);
Assert.AreEqual(30f, 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);
Assert.AreEqual(30f, root_child3.LayoutX);
Assert.AreEqual(0f, root_child3.LayoutY);
Assert.AreEqual(30f, root_child3.LayoutWidth);
Assert.AreEqual(30f, root_child3.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(60, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(60f, root.LayoutWidth);
Assert.AreEqual(100f, 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(30f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(30f, root_child0.LayoutWidth);
Assert.AreEqual(30f, 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(30f, root_child1.LayoutX);
Assert.AreEqual(30f, root_child1.LayoutY);
Assert.AreEqual(30f, root_child1.LayoutWidth);
Assert.AreEqual(30f, 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(30f, root_child2.LayoutX);
Assert.AreEqual(60f, root_child2.LayoutY);
Assert.AreEqual(30f, root_child2.LayoutWidth);
Assert.AreEqual(30f, 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);
Assert.AreEqual(0f, root_child3.LayoutX);
Assert.AreEqual(0f, root_child3.LayoutY);
Assert.AreEqual(30f, root_child3.LayoutWidth);
Assert.AreEqual(30f, root_child3.LayoutHeight);
}
[Test]
@@ -137,82 +106,82 @@ namespace Facebook.CSSLayout
CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row;
root.Wrap = CSSWrap.Wrap;
root.StyleWidth = 100;
root.StyleWidth = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.StyleWidth = 30;
root_child0.StyleHeight = 30;
root_child0.StyleWidth = 30f;
root_child0.StyleHeight = 30f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.StyleWidth = 30;
root_child1.StyleHeight = 30;
root_child1.StyleWidth = 30f;
root_child1.StyleHeight = 30f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
root_child2.StyleWidth = 30;
root_child2.StyleHeight = 30;
root_child2.StyleWidth = 30f;
root_child2.StyleHeight = 30f;
root.Insert(2, root_child2);
CSSNode root_child3 = new CSSNode();
root_child3.StyleWidth = 30;
root_child3.StyleHeight = 30;
root_child3.StyleWidth = 30f;
root_child3.StyleHeight = 30f;
root.Insert(3, root_child3);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(60, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(60f, 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(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(30f, root_child0.LayoutWidth);
Assert.AreEqual(30f, root_child0.LayoutHeight);
Assert.AreEqual(30, root_child1.LayoutX);
Assert.AreEqual(0, root_child1.LayoutY);
Assert.AreEqual(30, root_child1.LayoutWidth);
Assert.AreEqual(30, root_child1.LayoutHeight);
Assert.AreEqual(30f, root_child1.LayoutX);
Assert.AreEqual(0f, root_child1.LayoutY);
Assert.AreEqual(30f, root_child1.LayoutWidth);
Assert.AreEqual(30f, 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(60f, root_child2.LayoutX);
Assert.AreEqual(0f, root_child2.LayoutY);
Assert.AreEqual(30f, root_child2.LayoutWidth);
Assert.AreEqual(30f, 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);
Assert.AreEqual(0f, root_child3.LayoutX);
Assert.AreEqual(30f, root_child3.LayoutY);
Assert.AreEqual(30f, root_child3.LayoutWidth);
Assert.AreEqual(30f, root_child3.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(60, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(60f, root.LayoutHeight);
Assert.AreEqual(70, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(30, root_child0.LayoutWidth);
Assert.AreEqual(30, root_child0.LayoutHeight);
Assert.AreEqual(70f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(30f, root_child0.LayoutWidth);
Assert.AreEqual(30f, root_child0.LayoutHeight);
Assert.AreEqual(40, root_child1.LayoutX);
Assert.AreEqual(0, root_child1.LayoutY);
Assert.AreEqual(30, root_child1.LayoutWidth);
Assert.AreEqual(30, root_child1.LayoutHeight);
Assert.AreEqual(40f, root_child1.LayoutX);
Assert.AreEqual(0f, root_child1.LayoutY);
Assert.AreEqual(30f, root_child1.LayoutWidth);
Assert.AreEqual(30f, 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(10f, root_child2.LayoutX);
Assert.AreEqual(0f, root_child2.LayoutY);
Assert.AreEqual(30f, root_child2.LayoutWidth);
Assert.AreEqual(30f, 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);
Assert.AreEqual(70f, root_child3.LayoutX);
Assert.AreEqual(30f, root_child3.LayoutY);
Assert.AreEqual(30f, root_child3.LayoutWidth);
Assert.AreEqual(30f, root_child3.LayoutHeight);
}
[Test]
@@ -222,82 +191,82 @@ namespace Facebook.CSSLayout
root.FlexDirection = CSSFlexDirection.Row;
root.AlignItems = CSSAlign.FlexEnd;
root.Wrap = CSSWrap.Wrap;
root.StyleWidth = 100;
root.StyleWidth = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.StyleWidth = 30;
root_child0.StyleHeight = 10;
root_child0.StyleWidth = 30f;
root_child0.StyleHeight = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.StyleWidth = 30;
root_child1.StyleHeight = 20;
root_child1.StyleWidth = 30f;
root_child1.StyleHeight = 20f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
root_child2.StyleWidth = 30;
root_child2.StyleHeight = 30;
root_child2.StyleWidth = 30f;
root_child2.StyleHeight = 30f;
root.Insert(2, root_child2);
CSSNode root_child3 = new CSSNode();
root_child3.StyleWidth = 30;
root_child3.StyleHeight = 30;
root_child3.StyleWidth = 30f;
root_child3.StyleHeight = 30f;
root.Insert(3, root_child3);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(60, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(60f, 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(0f, root_child0.LayoutX);
Assert.AreEqual(20f, root_child0.LayoutY);
Assert.AreEqual(30f, root_child0.LayoutWidth);
Assert.AreEqual(10f, 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(30f, root_child1.LayoutX);
Assert.AreEqual(10f, root_child1.LayoutY);
Assert.AreEqual(30f, root_child1.LayoutWidth);
Assert.AreEqual(20f, 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(60f, root_child2.LayoutX);
Assert.AreEqual(0f, root_child2.LayoutY);
Assert.AreEqual(30f, root_child2.LayoutWidth);
Assert.AreEqual(30f, 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);
Assert.AreEqual(0f, root_child3.LayoutX);
Assert.AreEqual(30f, root_child3.LayoutY);
Assert.AreEqual(30f, root_child3.LayoutWidth);
Assert.AreEqual(30f, root_child3.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(60, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(60f, 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(70f, root_child0.LayoutX);
Assert.AreEqual(20f, root_child0.LayoutY);
Assert.AreEqual(30f, root_child0.LayoutWidth);
Assert.AreEqual(10f, 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(40f, root_child1.LayoutX);
Assert.AreEqual(10f, root_child1.LayoutY);
Assert.AreEqual(30f, root_child1.LayoutWidth);
Assert.AreEqual(20f, 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(10f, root_child2.LayoutX);
Assert.AreEqual(0f, root_child2.LayoutY);
Assert.AreEqual(30f, root_child2.LayoutWidth);
Assert.AreEqual(30f, 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);
Assert.AreEqual(70f, root_child3.LayoutX);
Assert.AreEqual(30f, root_child3.LayoutY);
Assert.AreEqual(30f, root_child3.LayoutWidth);
Assert.AreEqual(30f, root_child3.LayoutHeight);
}
[Test]
@@ -307,82 +276,82 @@ namespace Facebook.CSSLayout
root.FlexDirection = CSSFlexDirection.Row;
root.AlignItems = CSSAlign.Center;
root.Wrap = CSSWrap.Wrap;
root.StyleWidth = 100;
root.StyleWidth = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.StyleWidth = 30;
root_child0.StyleHeight = 10;
root_child0.StyleWidth = 30f;
root_child0.StyleHeight = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.StyleWidth = 30;
root_child1.StyleHeight = 20;
root_child1.StyleWidth = 30f;
root_child1.StyleHeight = 20f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
root_child2.StyleWidth = 30;
root_child2.StyleHeight = 30;
root_child2.StyleWidth = 30f;
root_child2.StyleHeight = 30f;
root.Insert(2, root_child2);
CSSNode root_child3 = new CSSNode();
root_child3.StyleWidth = 30;
root_child3.StyleHeight = 30;
root_child3.StyleWidth = 30f;
root_child3.StyleHeight = 30f;
root.Insert(3, root_child3);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(60, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(60f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(10, root_child0.LayoutY);
Assert.AreEqual(30, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(10f, root_child0.LayoutY);
Assert.AreEqual(30f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
Assert.AreEqual(30, root_child1.LayoutX);
Assert.AreEqual(5, root_child1.LayoutY);
Assert.AreEqual(30, root_child1.LayoutWidth);
Assert.AreEqual(20, root_child1.LayoutHeight);
Assert.AreEqual(30f, root_child1.LayoutX);
Assert.AreEqual(5f, root_child1.LayoutY);
Assert.AreEqual(30f, root_child1.LayoutWidth);
Assert.AreEqual(20f, 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(60f, root_child2.LayoutX);
Assert.AreEqual(0f, root_child2.LayoutY);
Assert.AreEqual(30f, root_child2.LayoutWidth);
Assert.AreEqual(30f, 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);
Assert.AreEqual(0f, root_child3.LayoutX);
Assert.AreEqual(30f, root_child3.LayoutY);
Assert.AreEqual(30f, root_child3.LayoutWidth);
Assert.AreEqual(30f, root_child3.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(60, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(60f, root.LayoutHeight);
Assert.AreEqual(70, root_child0.LayoutX);
Assert.AreEqual(10, root_child0.LayoutY);
Assert.AreEqual(30, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(70f, root_child0.LayoutX);
Assert.AreEqual(10f, root_child0.LayoutY);
Assert.AreEqual(30f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
Assert.AreEqual(40, root_child1.LayoutX);
Assert.AreEqual(5, root_child1.LayoutY);
Assert.AreEqual(30, root_child1.LayoutWidth);
Assert.AreEqual(20, root_child1.LayoutHeight);
Assert.AreEqual(40f, root_child1.LayoutX);
Assert.AreEqual(5f, root_child1.LayoutY);
Assert.AreEqual(30f, root_child1.LayoutWidth);
Assert.AreEqual(20f, 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(10f, root_child2.LayoutX);
Assert.AreEqual(0f, root_child2.LayoutY);
Assert.AreEqual(30f, root_child2.LayoutWidth);
Assert.AreEqual(30f, 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);
Assert.AreEqual(70f, root_child3.LayoutX);
Assert.AreEqual(30f, root_child3.LayoutY);
Assert.AreEqual(30f, root_child3.LayoutWidth);
Assert.AreEqual(30f, root_child3.LayoutHeight);
}
}

View File

@@ -7,52 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
/**
* @Generated by gentest/gentest.sh with the following input
*
<div id="margin_start" style="width: 100px; height: 100px; flex-direction: row;">
<div style="width: 10px; margin-start: 10px;"></div>
</div>
<div id="margin_top" style="width: 100px; height: 100px;">
<div style="height: 10px; margin-top: 10px;"></div>
</div>
<div id="margin_end" style="width: 100px; height: 100px; flex-direction: row; justify-content: flex-end;">
<div style="width: 10px; margin-end: 10px;"></div>
</div>
<div id="margin_bottom" style="width: 100px; height: 100px; justify-content: flex-end;">
<div style="height: 10px; margin-bottom: 10px;"></div>
</div>
<div id="margin_and_flex_row" style="width: 100px; height: 100px; flex-direction: row;">
<div style="margin-start: 10px; margin-end; 10px; flex-grow: 1;"></div>
</div>
<div id="margin_and_flex_column" style="width: 100px; height: 100px;">
<div style="margin-top: 10px; margin-bottom; 10px; flex-grow: 1;"></div>
</div>
<div id="margin_and_stretch_row" style="width: 100px; height: 100px; flex-direction: row;">
<div style="margin-top: 10px; margin-bottom; 10px; flex-grow: 1;"></div>
</div>
<div id="margin_and_stretch_column" style="width: 100px; height: 100px;">
<div style="margin-start: 10px; margin-end; 10px; flex-grow: 1;"></div>
</div>
<div id="margin_with_sibling_row" style="width: 100px; height: 100px; flex-direction: row;">
<div style="margin-end; 10px; flex-grow: 1;"></div>
<div style="flex-grow: 1;"></div>
</div>
<div id="margin_with_sibling_column" style="width: 100px; height: 100px;">
<div style="margin-bottom; 10px; flex-grow: 1;"></div>
<div style="flex-grow: 1;"></div>
</div>
*
*/
// @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutMarginTest.html
using System;
using NUnit.Framework;
@@ -67,76 +22,76 @@ namespace Facebook.CSSLayout
{
CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row;
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.SetMargin(CSSEdge.Start, 10);
root_child0.StyleWidth = 10;
root_child0.SetMargin(CSSEdge.Start, 10f);
root_child0.StyleWidth = 10f;
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(10, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(10, root_child0.LayoutWidth);
Assert.AreEqual(100, root_child0.LayoutHeight);
Assert.AreEqual(10f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(80, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(10, root_child0.LayoutWidth);
Assert.AreEqual(100, root_child0.LayoutHeight);
Assert.AreEqual(80f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight);
}
[Test]
public void Test_margin_top()
{
CSSNode root = new CSSNode();
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.SetMargin(CSSEdge.Top, 10);
root_child0.StyleHeight = 10;
root_child0.SetMargin(CSSEdge.Top, 10f);
root_child0.StyleHeight = 10f;
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(10, root_child0.LayoutY);
Assert.AreEqual(100, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(10f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(10, root_child0.LayoutY);
Assert.AreEqual(100, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(10f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
}
[Test]
@@ -145,38 +100,38 @@ namespace Facebook.CSSLayout
CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row;
root.JustifyContent = CSSJustify.FlexEnd;
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.SetMargin(CSSEdge.End, 10);
root_child0.StyleWidth = 10;
root_child0.SetMargin(CSSEdge.End, 10f);
root_child0.StyleWidth = 10f;
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(80, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(10, root_child0.LayoutWidth);
Assert.AreEqual(100, root_child0.LayoutHeight);
Assert.AreEqual(80f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(10, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(10, root_child0.LayoutWidth);
Assert.AreEqual(100, root_child0.LayoutHeight);
Assert.AreEqual(10f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight);
}
[Test]
@@ -184,38 +139,38 @@ namespace Facebook.CSSLayout
{
CSSNode root = new CSSNode();
root.JustifyContent = CSSJustify.FlexEnd;
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.SetMargin(CSSEdge.Bottom, 10);
root_child0.StyleHeight = 10;
root_child0.SetMargin(CSSEdge.Bottom, 10f);
root_child0.StyleHeight = 10f;
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(80, root_child0.LayoutY);
Assert.AreEqual(100, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(80f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(80, root_child0.LayoutY);
Assert.AreEqual(100, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(80f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
}
[Test]
@@ -223,76 +178,76 @@ namespace Facebook.CSSLayout
{
CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row;
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.FlexGrow = 1;
root_child0.SetMargin(CSSEdge.Start, 10);
root_child0.FlexGrow = 1f;
root_child0.SetMargin(CSSEdge.Start, 10f);
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(10, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(90, root_child0.LayoutWidth);
Assert.AreEqual(100, root_child0.LayoutHeight);
Assert.AreEqual(10f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(90f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(90, root_child0.LayoutWidth);
Assert.AreEqual(100, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(90f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight);
}
[Test]
public void Test_margin_and_flex_column()
{
CSSNode root = new CSSNode();
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.FlexGrow = 1;
root_child0.SetMargin(CSSEdge.Top, 10);
root_child0.FlexGrow = 1f;
root_child0.SetMargin(CSSEdge.Top, 10f);
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, 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);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(10f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(90f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, 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);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(10f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(90f, root_child0.LayoutHeight);
}
[Test]
@@ -300,76 +255,76 @@ namespace Facebook.CSSLayout
{
CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row;
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.FlexGrow = 1;
root_child0.SetMargin(CSSEdge.Top, 10);
root_child0.FlexGrow = 1f;
root_child0.SetMargin(CSSEdge.Top, 10f);
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, 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);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(10f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(90f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, 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);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(10f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(90f, root_child0.LayoutHeight);
}
[Test]
public void Test_margin_and_stretch_column()
{
CSSNode root = new CSSNode();
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.FlexGrow = 1;
root_child0.SetMargin(CSSEdge.Start, 10);
root_child0.FlexGrow = 1f;
root_child0.SetMargin(CSSEdge.Start, 10f);
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(10, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(90, root_child0.LayoutWidth);
Assert.AreEqual(100, root_child0.LayoutHeight);
Assert.AreEqual(10f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(90f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(90, root_child0.LayoutWidth);
Assert.AreEqual(100, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(90f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight);
}
[Test]
@@ -377,102 +332,102 @@ namespace Facebook.CSSLayout
{
CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row;
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.FlexGrow = 1;
root_child0.FlexGrow = 1f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.FlexGrow = 1;
root_child1.FlexGrow = 1f;
root.Insert(1, root_child1);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(50, root_child0.LayoutWidth);
Assert.AreEqual(100, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(50f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight);
Assert.AreEqual(50, root_child1.LayoutX);
Assert.AreEqual(0, root_child1.LayoutY);
Assert.AreEqual(50, root_child1.LayoutWidth);
Assert.AreEqual(100, root_child1.LayoutHeight);
Assert.AreEqual(50f, root_child1.LayoutX);
Assert.AreEqual(0f, root_child1.LayoutY);
Assert.AreEqual(50f, root_child1.LayoutWidth);
Assert.AreEqual(100f, root_child1.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(50, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(50, root_child0.LayoutWidth);
Assert.AreEqual(100, root_child0.LayoutHeight);
Assert.AreEqual(50f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(50f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child1.LayoutX);
Assert.AreEqual(0, root_child1.LayoutY);
Assert.AreEqual(50, root_child1.LayoutWidth);
Assert.AreEqual(100, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(0f, root_child1.LayoutY);
Assert.AreEqual(50f, root_child1.LayoutWidth);
Assert.AreEqual(100f, root_child1.LayoutHeight);
}
[Test]
public void Test_margin_with_sibling_column()
{
CSSNode root = new CSSNode();
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.FlexGrow = 1;
root_child0.FlexGrow = 1f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.FlexGrow = 1;
root_child1.FlexGrow = 1f;
root.Insert(1, root_child1);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(100, root_child0.LayoutWidth);
Assert.AreEqual(50, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(50f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child1.LayoutX);
Assert.AreEqual(50, root_child1.LayoutY);
Assert.AreEqual(100, root_child1.LayoutWidth);
Assert.AreEqual(50, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(50f, root_child1.LayoutY);
Assert.AreEqual(100f, root_child1.LayoutWidth);
Assert.AreEqual(50f, root_child1.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(100, root_child0.LayoutWidth);
Assert.AreEqual(50, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(50f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child1.LayoutX);
Assert.AreEqual(50, root_child1.LayoutY);
Assert.AreEqual(100, root_child1.LayoutWidth);
Assert.AreEqual(50, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(50f, root_child1.LayoutY);
Assert.AreEqual(100f, root_child1.LayoutWidth);
Assert.AreEqual(50f, root_child1.LayoutHeight);
}
}

View File

@@ -7,54 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
/**
* @Generated by gentest/gentest.sh with the following input
*
<div id="max_width" style="width: 100px; height: 100px;">
<div style="height: 10px; max-width: 50px;"></div>
</div>
<div id="max_height" style="width: 100px; height: 100px; flex-direction: row;">
<div style="width: 10px; max-height: 50px;"></div>
</div>
<div id="min_height" style="width: 100px; height: 100px;">
<div style="flex-grow: 1; min-height: 60px;"></div>
<div style="flex-grow: 1;"></div>
</div>
<div id="min_width" style="width: 100px; height: 100px; flex-direction: row">
<div style="flex-grow: 1; min-width: 60px;"></div>
<div style="flex-grow: 1;"></div>
</div>
<div id="justify_content_min_max" style="max-height: 200px; min-height: 100px; width: 100px; justify-content: center;">
<div style="width: 60px; height: 60px;"></div>
</div>
<div id="align_items_min_max" style="max-width: 200px; min-width: 100px; height: 100px; align-items: center;">
<div style="width: 60px; height: 60px;"></div>
</div>
<div id="justify_content_overflow_min_max" style="min-height: 100px; max-height: 110px; justify-content: center;">
<div style="width: 50px; height: 50px;"></div>
<div style="width: 50px; height: 50px;"></div>
<div style="width: 50px; height: 50px;"></div>
</div>
<div id="flex_grow_within_max_width" style="width: 200px; height: 100px;">
<div style="flex-direction: row; max-width: 100px;">
<div style="height: 20px; flex-grow: 1;"></div>
</div>
</div>
<div id="flex_grow_within_constrained_max_width" style="width: 200px; height: 100px;">
<div style="flex-direction: row; max-width: 300px;">
<div style="height: 20px; flex-grow: 1;"></div>
</div>
</div>
*
*/
// @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutMinMaxDimensionTest.html
using System;
using NUnit.Framework;
@@ -68,38 +21,38 @@ namespace Facebook.CSSLayout
public void Test_max_width()
{
CSSNode root = new CSSNode();
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.StyleMaxWidth = 50;
root_child0.StyleHeight = 10;
root_child0.StyleMaxWidth = 50f;
root_child0.StyleHeight = 10f;
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(50, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(50f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(50, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(50, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(50f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(50f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
}
[Test]
@@ -107,90 +60,90 @@ namespace Facebook.CSSLayout
{
CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row;
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.StyleWidth = 10;
root_child0.StyleMaxHeight = 50;
root_child0.StyleWidth = 10f;
root_child0.StyleMaxHeight = 50f;
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(10, root_child0.LayoutWidth);
Assert.AreEqual(50, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(50f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(90, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(10, root_child0.LayoutWidth);
Assert.AreEqual(50, root_child0.LayoutHeight);
Assert.AreEqual(90f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(50f, root_child0.LayoutHeight);
}
[Test]
public void Test_min_height()
{
CSSNode root = new CSSNode();
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.FlexGrow = 1;
root_child0.StyleMinHeight = 60;
root_child0.FlexGrow = 1f;
root_child0.StyleMinHeight = 60f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.FlexGrow = 1;
root_child1.FlexGrow = 1f;
root.Insert(1, root_child1);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(100, root_child0.LayoutWidth);
Assert.AreEqual(80, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(80f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child1.LayoutX);
Assert.AreEqual(80, root_child1.LayoutY);
Assert.AreEqual(100, root_child1.LayoutWidth);
Assert.AreEqual(20, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(80f, root_child1.LayoutY);
Assert.AreEqual(100f, root_child1.LayoutWidth);
Assert.AreEqual(20f, root_child1.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(100, root_child0.LayoutWidth);
Assert.AreEqual(80, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(80f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child1.LayoutX);
Assert.AreEqual(80, root_child1.LayoutY);
Assert.AreEqual(100, root_child1.LayoutWidth);
Assert.AreEqual(20, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(80f, root_child1.LayoutY);
Assert.AreEqual(100f, root_child1.LayoutWidth);
Assert.AreEqual(20f, root_child1.LayoutHeight);
}
[Test]
@@ -198,52 +151,52 @@ namespace Facebook.CSSLayout
{
CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row;
root.StyleWidth = 100;
root.StyleHeight = 100;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.FlexGrow = 1;
root_child0.StyleMinWidth = 60;
root_child0.FlexGrow = 1f;
root_child0.StyleMinWidth = 60f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.FlexGrow = 1;
root_child1.FlexGrow = 1f;
root.Insert(1, root_child1);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, 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(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(80f, root_child0.LayoutWidth);
Assert.AreEqual(100f, 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);
Assert.AreEqual(80f, root_child1.LayoutX);
Assert.AreEqual(0f, root_child1.LayoutY);
Assert.AreEqual(20f, root_child1.LayoutWidth);
Assert.AreEqual(100f, root_child1.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, 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(20f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(80f, root_child0.LayoutWidth);
Assert.AreEqual(100f, 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);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(0f, root_child1.LayoutY);
Assert.AreEqual(20f, root_child1.LayoutWidth);
Assert.AreEqual(100f, root_child1.LayoutHeight);
}
[Test]
@@ -251,39 +204,39 @@ namespace Facebook.CSSLayout
{
CSSNode root = new CSSNode();
root.JustifyContent = CSSJustify.Center;
root.StyleWidth = 100;
root.StyleMinHeight = 100;
root.StyleMaxHeight = 200;
root.StyleWidth = 100f;
root.StyleMinHeight = 100f;
root.StyleMaxHeight = 200f;
CSSNode root_child0 = new CSSNode();
root_child0.StyleWidth = 60;
root_child0.StyleHeight = 60;
root_child0.StyleWidth = 60f;
root_child0.StyleHeight = 60f;
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(20, root_child0.LayoutY);
Assert.AreEqual(60, root_child0.LayoutWidth);
Assert.AreEqual(60, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(20f, root_child0.LayoutY);
Assert.AreEqual(60f, root_child0.LayoutWidth);
Assert.AreEqual(60f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(40, root_child0.LayoutX);
Assert.AreEqual(20, root_child0.LayoutY);
Assert.AreEqual(60, root_child0.LayoutWidth);
Assert.AreEqual(60, root_child0.LayoutHeight);
Assert.AreEqual(40f, root_child0.LayoutX);
Assert.AreEqual(20f, root_child0.LayoutY);
Assert.AreEqual(60f, root_child0.LayoutWidth);
Assert.AreEqual(60f, root_child0.LayoutHeight);
}
[Test]
@@ -291,39 +244,39 @@ namespace Facebook.CSSLayout
{
CSSNode root = new CSSNode();
root.AlignItems = CSSAlign.Center;
root.StyleMinWidth = 100;
root.StyleMaxWidth = 200;
root.StyleHeight = 100;
root.StyleMinWidth = 100f;
root.StyleMaxWidth = 200f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.StyleWidth = 60;
root_child0.StyleHeight = 60;
root_child0.StyleWidth = 60f;
root_child0.StyleHeight = 60f;
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, 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);
Assert.AreEqual(20f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(60f, root_child0.LayoutWidth);
Assert.AreEqual(60f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, 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);
Assert.AreEqual(20f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(60f, root_child0.LayoutWidth);
Assert.AreEqual(60f, root_child0.LayoutHeight);
}
[Test]
@@ -331,174 +284,174 @@ namespace Facebook.CSSLayout
{
CSSNode root = new CSSNode();
root.JustifyContent = CSSJustify.Center;
root.StyleMinHeight = 100;
root.StyleMaxHeight = 110;
root.StyleMinHeight = 100f;
root.StyleMaxHeight = 110f;
CSSNode root_child0 = new CSSNode();
root_child0.StyleWidth = 50;
root_child0.StyleHeight = 50;
root_child0.StyleWidth = 50f;
root_child0.StyleHeight = 50f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.StyleWidth = 50;
root_child1.StyleHeight = 50;
root_child1.StyleWidth = 50f;
root_child1.StyleHeight = 50f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
root_child2.StyleWidth = 50;
root_child2.StyleHeight = 50;
root_child2.StyleWidth = 50f;
root_child2.StyleHeight = 50f;
root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(50, root.LayoutWidth);
Assert.AreEqual(110, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(50f, root.LayoutWidth);
Assert.AreEqual(110f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(-20, root_child0.LayoutY);
Assert.AreEqual(50, root_child0.LayoutWidth);
Assert.AreEqual(50, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(-20f, root_child0.LayoutY);
Assert.AreEqual(50f, root_child0.LayoutWidth);
Assert.AreEqual(50f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child1.LayoutX);
Assert.AreEqual(30, root_child1.LayoutY);
Assert.AreEqual(50, root_child1.LayoutWidth);
Assert.AreEqual(50, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(30f, root_child1.LayoutY);
Assert.AreEqual(50f, root_child1.LayoutWidth);
Assert.AreEqual(50f, root_child1.LayoutHeight);
Assert.AreEqual(0, root_child2.LayoutX);
Assert.AreEqual(80, root_child2.LayoutY);
Assert.AreEqual(50, root_child2.LayoutWidth);
Assert.AreEqual(50, root_child2.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(80f, root_child2.LayoutY);
Assert.AreEqual(50f, root_child2.LayoutWidth);
Assert.AreEqual(50f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(50, root.LayoutWidth);
Assert.AreEqual(110, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(50f, root.LayoutWidth);
Assert.AreEqual(110f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(-20, root_child0.LayoutY);
Assert.AreEqual(50, root_child0.LayoutWidth);
Assert.AreEqual(50, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(-20f, root_child0.LayoutY);
Assert.AreEqual(50f, root_child0.LayoutWidth);
Assert.AreEqual(50f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child1.LayoutX);
Assert.AreEqual(30, root_child1.LayoutY);
Assert.AreEqual(50, root_child1.LayoutWidth);
Assert.AreEqual(50, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(30f, root_child1.LayoutY);
Assert.AreEqual(50f, root_child1.LayoutWidth);
Assert.AreEqual(50f, root_child1.LayoutHeight);
Assert.AreEqual(0, root_child2.LayoutX);
Assert.AreEqual(80, root_child2.LayoutY);
Assert.AreEqual(50, root_child2.LayoutWidth);
Assert.AreEqual(50, root_child2.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(80f, root_child2.LayoutY);
Assert.AreEqual(50f, root_child2.LayoutWidth);
Assert.AreEqual(50f, root_child2.LayoutHeight);
}
[Test]
public void Test_flex_grow_within_max_width()
{
CSSNode root = new CSSNode();
root.StyleWidth = 200;
root.StyleHeight = 100;
root.StyleWidth = 200f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.FlexDirection = CSSFlexDirection.Row;
root_child0.StyleMaxWidth = 100;
root_child0.StyleMaxWidth = 100f;
root.Insert(0, root_child0);
CSSNode root_child0_child0 = new CSSNode();
root_child0_child0.FlexGrow = 1;
root_child0_child0.StyleHeight = 20;
root_child0_child0.FlexGrow = 1f;
root_child0_child0.StyleHeight = 20f;
root_child0.Insert(0, root_child0_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(200, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(200f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(100, root_child0.LayoutWidth);
Assert.AreEqual(20, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(20f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child0_child0.LayoutX);
Assert.AreEqual(0, root_child0_child0.LayoutY);
Assert.AreEqual(100, root_child0_child0.LayoutWidth);
Assert.AreEqual(20, root_child0_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0_child0.LayoutX);
Assert.AreEqual(0f, root_child0_child0.LayoutY);
Assert.AreEqual(100f, root_child0_child0.LayoutWidth);
Assert.AreEqual(20f, root_child0_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(200, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(200f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(100, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(100, root_child0.LayoutWidth);
Assert.AreEqual(20, root_child0.LayoutHeight);
Assert.AreEqual(100f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(20f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child0_child0.LayoutX);
Assert.AreEqual(0, root_child0_child0.LayoutY);
Assert.AreEqual(100, root_child0_child0.LayoutWidth);
Assert.AreEqual(20, root_child0_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0_child0.LayoutX);
Assert.AreEqual(0f, root_child0_child0.LayoutY);
Assert.AreEqual(100f, root_child0_child0.LayoutWidth);
Assert.AreEqual(20f, root_child0_child0.LayoutHeight);
}
[Test]
public void Test_flex_grow_within_constrained_max_width()
{
CSSNode root = new CSSNode();
root.StyleWidth = 200;
root.StyleHeight = 100;
root.StyleWidth = 200f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.FlexDirection = CSSFlexDirection.Row;
root_child0.StyleMaxWidth = 300;
root_child0.StyleMaxWidth = 300f;
root.Insert(0, root_child0);
CSSNode root_child0_child0 = new CSSNode();
root_child0_child0.FlexGrow = 1;
root_child0_child0.StyleHeight = 20;
root_child0_child0.FlexGrow = 1f;
root_child0_child0.StyleHeight = 20f;
root_child0.Insert(0, root_child0_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(200, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(200f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(200, root_child0.LayoutWidth);
Assert.AreEqual(20, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(200f, root_child0.LayoutWidth);
Assert.AreEqual(20f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child0_child0.LayoutX);
Assert.AreEqual(0, root_child0_child0.LayoutY);
Assert.AreEqual(200, root_child0_child0.LayoutWidth);
Assert.AreEqual(20, root_child0_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0_child0.LayoutX);
Assert.AreEqual(0f, root_child0_child0.LayoutY);
Assert.AreEqual(200f, root_child0_child0.LayoutWidth);
Assert.AreEqual(20f, root_child0_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(200, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(200f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0, root_child0.LayoutX);
Assert.AreEqual(0, root_child0.LayoutY);
Assert.AreEqual(200, root_child0.LayoutWidth);
Assert.AreEqual(20, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(200f, root_child0.LayoutWidth);
Assert.AreEqual(20f, root_child0.LayoutHeight);
Assert.AreEqual(0, root_child0_child0.LayoutX);
Assert.AreEqual(0, root_child0_child0.LayoutY);
Assert.AreEqual(200, root_child0_child0.LayoutWidth);
Assert.AreEqual(20, root_child0_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0_child0.LayoutX);
Assert.AreEqual(0f, root_child0_child0.LayoutY);
Assert.AreEqual(200f, root_child0_child0.LayoutWidth);
Assert.AreEqual(20f, root_child0_child0.LayoutHeight);
}
}

View File

@@ -7,29 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
/**
* @Generated by gentest/gentest.sh with the following input
*
<div id="padding_no_size" style="padding: 10px;">
</div>
<div id="padding_container_match_child" style="padding: 10px;">
<div style="width: 10px; height: 10px;"></div>
</div>
<div id="padding_flex_child" style="width: 100px; height: 100px; padding: 10px;">
<div style="width: 10px; flex-grow:1"></div>
</div>
<div id="padding_stretch_child" style="width: 100px; height: 100px; padding: 10px;">
<div style="height: 10px;"></div>
</div>
<div id="padding_center_child" style="width: 100px; height: 100px; padding-start: 10px; padding-top: 10; padding-end: 20px; padding-bottom: 20px; align-items: center; justify-content: center;">
<div style="height: 10px; width: 10px;"></div>
</div>
*
*/
// @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutPaddingTest.html
using System;
using NUnit.Framework;
@@ -43,148 +21,148 @@ namespace Facebook.CSSLayout
public void Test_padding_no_size()
{
CSSNode root = new CSSNode();
root.SetPadding(CSSEdge.Left, 10);
root.SetPadding(CSSEdge.Top, 10);
root.SetPadding(CSSEdge.Right, 10);
root.SetPadding(CSSEdge.Bottom, 10);
root.SetPadding(CSSEdge.Left, 10f);
root.SetPadding(CSSEdge.Top, 10f);
root.SetPadding(CSSEdge.Right, 10f);
root.SetPadding(CSSEdge.Bottom, 10f);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(20, root.LayoutWidth);
Assert.AreEqual(20, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(20f, root.LayoutWidth);
Assert.AreEqual(20f, root.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(20, root.LayoutWidth);
Assert.AreEqual(20, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(20f, root.LayoutWidth);
Assert.AreEqual(20f, root.LayoutHeight);
}
[Test]
public void Test_padding_container_match_child()
{
CSSNode root = new CSSNode();
root.SetPadding(CSSEdge.Left, 10);
root.SetPadding(CSSEdge.Top, 10);
root.SetPadding(CSSEdge.Right, 10);
root.SetPadding(CSSEdge.Bottom, 10);
root.SetPadding(CSSEdge.Left, 10f);
root.SetPadding(CSSEdge.Top, 10f);
root.SetPadding(CSSEdge.Right, 10f);
root.SetPadding(CSSEdge.Bottom, 10f);
CSSNode root_child0 = new CSSNode();
root_child0.StyleWidth = 10;
root_child0.StyleHeight = 10;
root_child0.StyleWidth = 10f;
root_child0.StyleHeight = 10f;
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(30, root.LayoutWidth);
Assert.AreEqual(30, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(30f, root.LayoutWidth);
Assert.AreEqual(30f, root.LayoutHeight);
Assert.AreEqual(10, root_child0.LayoutX);
Assert.AreEqual(10, root_child0.LayoutY);
Assert.AreEqual(10, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(10f, root_child0.LayoutX);
Assert.AreEqual(10f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(30, root.LayoutWidth);
Assert.AreEqual(30, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(30f, root.LayoutWidth);
Assert.AreEqual(30f, root.LayoutHeight);
Assert.AreEqual(10, root_child0.LayoutX);
Assert.AreEqual(10, root_child0.LayoutY);
Assert.AreEqual(10, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(10f, root_child0.LayoutX);
Assert.AreEqual(10f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
}
[Test]
public void Test_padding_flex_child()
{
CSSNode root = new CSSNode();
root.SetPadding(CSSEdge.Left, 10);
root.SetPadding(CSSEdge.Top, 10);
root.SetPadding(CSSEdge.Right, 10);
root.SetPadding(CSSEdge.Bottom, 10);
root.StyleWidth = 100;
root.StyleHeight = 100;
root.SetPadding(CSSEdge.Left, 10f);
root.SetPadding(CSSEdge.Top, 10f);
root.SetPadding(CSSEdge.Right, 10f);
root.SetPadding(CSSEdge.Bottom, 10f);
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.FlexGrow = 1;
root_child0.StyleWidth = 10;
root_child0.FlexGrow = 1f;
root_child0.StyleWidth = 10f;
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(10, root_child0.LayoutX);
Assert.AreEqual(10, root_child0.LayoutY);
Assert.AreEqual(10, root_child0.LayoutWidth);
Assert.AreEqual(80, root_child0.LayoutHeight);
Assert.AreEqual(10f, root_child0.LayoutX);
Assert.AreEqual(10f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(80f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(80, root_child0.LayoutX);
Assert.AreEqual(10, root_child0.LayoutY);
Assert.AreEqual(10, root_child0.LayoutWidth);
Assert.AreEqual(80, root_child0.LayoutHeight);
Assert.AreEqual(80f, root_child0.LayoutX);
Assert.AreEqual(10f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(80f, root_child0.LayoutHeight);
}
[Test]
public void Test_padding_stretch_child()
{
CSSNode root = new CSSNode();
root.SetPadding(CSSEdge.Left, 10);
root.SetPadding(CSSEdge.Top, 10);
root.SetPadding(CSSEdge.Right, 10);
root.SetPadding(CSSEdge.Bottom, 10);
root.StyleWidth = 100;
root.StyleHeight = 100;
root.SetPadding(CSSEdge.Left, 10f);
root.SetPadding(CSSEdge.Top, 10f);
root.SetPadding(CSSEdge.Right, 10f);
root.SetPadding(CSSEdge.Bottom, 10f);
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.StyleHeight = 10;
root_child0.StyleHeight = 10f;
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(10, root_child0.LayoutX);
Assert.AreEqual(10, root_child0.LayoutY);
Assert.AreEqual(80, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(10f, root_child0.LayoutX);
Assert.AreEqual(10f, root_child0.LayoutY);
Assert.AreEqual(80f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(10, root_child0.LayoutX);
Assert.AreEqual(10, root_child0.LayoutY);
Assert.AreEqual(80, root_child0.LayoutWidth);
Assert.AreEqual(10, root_child0.LayoutHeight);
Assert.AreEqual(10f, root_child0.LayoutX);
Assert.AreEqual(10f, root_child0.LayoutY);
Assert.AreEqual(80f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
}
[Test]
@@ -193,41 +171,41 @@ namespace Facebook.CSSLayout
CSSNode root = new CSSNode();
root.JustifyContent = CSSJustify.Center;
root.AlignItems = CSSAlign.Center;
root.SetPadding(CSSEdge.Start, 10);
root.SetPadding(CSSEdge.End, 20);
root.SetPadding(CSSEdge.Bottom, 20);
root.StyleWidth = 100;
root.StyleHeight = 100;
root.SetPadding(CSSEdge.Start, 10f);
root.SetPadding(CSSEdge.End, 20f);
root.SetPadding(CSSEdge.Bottom, 20f);
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.StyleWidth = 10;
root_child0.StyleHeight = 10;
root_child0.StyleWidth = 10f;
root_child0.StyleHeight = 10f;
root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, 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);
Assert.AreEqual(40f, root_child0.LayoutX);
Assert.AreEqual(35f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0, root.LayoutX);
Assert.AreEqual(0, root.LayoutY);
Assert.AreEqual(100, root.LayoutWidth);
Assert.AreEqual(100, root.LayoutHeight);
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, 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);
Assert.AreEqual(50f, root_child0.LayoutX);
Assert.AreEqual(35f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
}
}

View File

@@ -0,0 +1,807 @@
/**
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
// @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutRoundingTest.html
using System;
using NUnit.Framework;
namespace Facebook.CSSLayout
{
[TestFixture]
public class CSSLayoutRoundingTest
{
[Test]
public void Test_rounding_flex_basis_flex_grow_row_width_of_100()
{
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, true);
CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row;
root.StyleWidth = 100f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.FlexGrow = 1f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.FlexGrow = 1f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
root_child2.FlexGrow = 1f;
root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(33f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight);
Assert.AreEqual(33f, root_child1.LayoutX);
Assert.AreEqual(0f, root_child1.LayoutY);
Assert.AreEqual(34f, root_child1.LayoutWidth);
Assert.AreEqual(100f, root_child1.LayoutHeight);
Assert.AreEqual(67f, root_child2.LayoutX);
Assert.AreEqual(0f, root_child2.LayoutY);
Assert.AreEqual(33f, root_child2.LayoutWidth);
Assert.AreEqual(100f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(67f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(33f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight);
Assert.AreEqual(33f, root_child1.LayoutX);
Assert.AreEqual(0f, root_child1.LayoutY);
Assert.AreEqual(34f, root_child1.LayoutWidth);
Assert.AreEqual(100f, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(0f, root_child2.LayoutY);
Assert.AreEqual(33f, root_child2.LayoutWidth);
Assert.AreEqual(100f, root_child2.LayoutHeight);
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, false);
}
[Test]
public void Test_rounding_flex_basis_flex_grow_row_prime_number_width()
{
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, true);
CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row;
root.StyleWidth = 113f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.FlexGrow = 1f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.FlexGrow = 1f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
root_child2.FlexGrow = 1f;
root.Insert(2, root_child2);
CSSNode root_child3 = new CSSNode();
root_child3.FlexGrow = 1f;
root.Insert(3, root_child3);
CSSNode root_child4 = new CSSNode();
root_child4.FlexGrow = 1f;
root.Insert(4, root_child4);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(113f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(23f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight);
Assert.AreEqual(23f, root_child1.LayoutX);
Assert.AreEqual(0f, root_child1.LayoutY);
Assert.AreEqual(22f, root_child1.LayoutWidth);
Assert.AreEqual(100f, root_child1.LayoutHeight);
Assert.AreEqual(45f, root_child2.LayoutX);
Assert.AreEqual(0f, root_child2.LayoutY);
Assert.AreEqual(23f, root_child2.LayoutWidth);
Assert.AreEqual(100f, root_child2.LayoutHeight);
Assert.AreEqual(68f, root_child3.LayoutX);
Assert.AreEqual(0f, root_child3.LayoutY);
Assert.AreEqual(22f, root_child3.LayoutWidth);
Assert.AreEqual(100f, root_child3.LayoutHeight);
Assert.AreEqual(90f, root_child4.LayoutX);
Assert.AreEqual(0f, root_child4.LayoutY);
Assert.AreEqual(23f, root_child4.LayoutWidth);
Assert.AreEqual(100f, root_child4.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(113f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(90f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(23f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight);
Assert.AreEqual(68f, root_child1.LayoutX);
Assert.AreEqual(0f, root_child1.LayoutY);
Assert.AreEqual(22f, root_child1.LayoutWidth);
Assert.AreEqual(100f, root_child1.LayoutHeight);
Assert.AreEqual(45f, root_child2.LayoutX);
Assert.AreEqual(0f, root_child2.LayoutY);
Assert.AreEqual(23f, root_child2.LayoutWidth);
Assert.AreEqual(100f, root_child2.LayoutHeight);
Assert.AreEqual(23f, root_child3.LayoutX);
Assert.AreEqual(0f, root_child3.LayoutY);
Assert.AreEqual(22f, root_child3.LayoutWidth);
Assert.AreEqual(100f, root_child3.LayoutHeight);
Assert.AreEqual(0f, root_child4.LayoutX);
Assert.AreEqual(0f, root_child4.LayoutY);
Assert.AreEqual(23f, root_child4.LayoutWidth);
Assert.AreEqual(100f, root_child4.LayoutHeight);
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, false);
}
[Test]
public void Test_rounding_flex_basis_flex_shrink_row()
{
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, true);
CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row;
root.StyleWidth = 101f;
root.StyleHeight = 100f;
CSSNode root_child0 = new CSSNode();
root_child0.FlexShrink = 1f;
root_child0.FlexBasis = 100f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.FlexBasis = 25f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
root_child2.FlexBasis = 25f;
root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(101f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(51f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight);
Assert.AreEqual(51f, root_child1.LayoutX);
Assert.AreEqual(0f, root_child1.LayoutY);
Assert.AreEqual(25f, root_child1.LayoutWidth);
Assert.AreEqual(100f, root_child1.LayoutHeight);
Assert.AreEqual(76f, root_child2.LayoutX);
Assert.AreEqual(0f, root_child2.LayoutY);
Assert.AreEqual(25f, root_child2.LayoutWidth);
Assert.AreEqual(100f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(101f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(50f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(51f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight);
Assert.AreEqual(25f, root_child1.LayoutX);
Assert.AreEqual(0f, root_child1.LayoutY);
Assert.AreEqual(25f, root_child1.LayoutWidth);
Assert.AreEqual(100f, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(0f, root_child2.LayoutY);
Assert.AreEqual(25f, root_child2.LayoutWidth);
Assert.AreEqual(100f, root_child2.LayoutHeight);
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, false);
}
[Test]
public void Test_rounding_flex_basis_overrides_main_size()
{
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, true);
CSSNode root = new CSSNode();
root.StyleWidth = 100f;
root.StyleHeight = 113f;
CSSNode root_child0 = new CSSNode();
root_child0.FlexGrow = 1f;
root_child0.FlexBasis = 50f;
root_child0.StyleHeight = 20f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.FlexGrow = 1f;
root_child1.StyleHeight = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
root_child2.FlexGrow = 1f;
root_child2.StyleHeight = 10f;
root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(113f, root.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(64f, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(64f, root_child1.LayoutY);
Assert.AreEqual(100f, root_child1.LayoutWidth);
Assert.AreEqual(25f, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(89f, root_child2.LayoutY);
Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(113f, root.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(64f, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(64f, root_child1.LayoutY);
Assert.AreEqual(100f, root_child1.LayoutWidth);
Assert.AreEqual(25f, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(89f, root_child2.LayoutY);
Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight);
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, false);
}
[Test]
public void Test_rounding_total_fractial()
{
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, true);
CSSNode root = new CSSNode();
root.StyleWidth = 87.4f;
root.StyleHeight = 113.4f;
CSSNode root_child0 = new CSSNode();
root_child0.FlexGrow = 0.7f;
root_child0.FlexBasis = 50.3f;
root_child0.StyleHeight = 20.3f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.FlexGrow = 1.6f;
root_child1.StyleHeight = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
root_child2.FlexGrow = 1.1f;
root_child2.StyleHeight = 10.7f;
root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(87f, root.LayoutWidth);
Assert.AreEqual(113f, root.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(87f, root_child0.LayoutWidth);
Assert.AreEqual(59f, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(59f, root_child1.LayoutY);
Assert.AreEqual(87f, root_child1.LayoutWidth);
Assert.AreEqual(30f, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(89f, root_child2.LayoutY);
Assert.AreEqual(87f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(87f, root.LayoutWidth);
Assert.AreEqual(113f, root.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(87f, root_child0.LayoutWidth);
Assert.AreEqual(59f, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(59f, root_child1.LayoutY);
Assert.AreEqual(87f, root_child1.LayoutWidth);
Assert.AreEqual(30f, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(89f, root_child2.LayoutY);
Assert.AreEqual(87f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight);
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, false);
}
[Test]
public void Test_rounding_total_fractial_nested()
{
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, true);
CSSNode root = new CSSNode();
root.StyleWidth = 87.4f;
root.StyleHeight = 113.4f;
CSSNode root_child0 = new CSSNode();
root_child0.FlexGrow = 0.7f;
root_child0.FlexBasis = 50.3f;
root_child0.StyleHeight = 20.3f;
root.Insert(0, root_child0);
CSSNode root_child0_child0 = new CSSNode();
root_child0_child0.FlexGrow = 1f;
root_child0_child0.FlexBasis = 0.3f;
root_child0_child0.SetPosition(CSSEdge.Bottom, 13.3f);
root_child0_child0.StyleHeight = 9.9f;
root_child0.Insert(0, root_child0_child0);
CSSNode root_child0_child1 = new CSSNode();
root_child0_child1.FlexGrow = 4f;
root_child0_child1.FlexBasis = 0.3f;
root_child0_child1.SetPosition(CSSEdge.Top, 13.3f);
root_child0_child1.StyleHeight = 1.1f;
root_child0.Insert(1, root_child0_child1);
CSSNode root_child1 = new CSSNode();
root_child1.FlexGrow = 1.6f;
root_child1.StyleHeight = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
root_child2.FlexGrow = 1.1f;
root_child2.StyleHeight = 10.7f;
root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(87f, root.LayoutWidth);
Assert.AreEqual(113f, root.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(87f, root_child0.LayoutWidth);
Assert.AreEqual(59f, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0_child0.LayoutX);
Assert.AreEqual(-13f, root_child0_child0.LayoutY);
Assert.AreEqual(87f, root_child0_child0.LayoutWidth);
Assert.AreEqual(12f, root_child0_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0_child1.LayoutX);
Assert.AreEqual(25f, root_child0_child1.LayoutY);
Assert.AreEqual(87f, root_child0_child1.LayoutWidth);
Assert.AreEqual(47f, root_child0_child1.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(59f, root_child1.LayoutY);
Assert.AreEqual(87f, root_child1.LayoutWidth);
Assert.AreEqual(30f, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(89f, root_child2.LayoutY);
Assert.AreEqual(87f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(87f, root.LayoutWidth);
Assert.AreEqual(113f, root.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(87f, root_child0.LayoutWidth);
Assert.AreEqual(59f, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0_child0.LayoutX);
Assert.AreEqual(-13f, root_child0_child0.LayoutY);
Assert.AreEqual(87f, root_child0_child0.LayoutWidth);
Assert.AreEqual(12f, root_child0_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0_child1.LayoutX);
Assert.AreEqual(25f, root_child0_child1.LayoutY);
Assert.AreEqual(87f, root_child0_child1.LayoutWidth);
Assert.AreEqual(47f, root_child0_child1.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(59f, root_child1.LayoutY);
Assert.AreEqual(87f, root_child1.LayoutWidth);
Assert.AreEqual(30f, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(89f, root_child2.LayoutY);
Assert.AreEqual(87f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight);
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, false);
}
[Test]
public void Test_rounding_fractial_input_1()
{
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, true);
CSSNode root = new CSSNode();
root.StyleWidth = 100f;
root.StyleHeight = 113.4f;
CSSNode root_child0 = new CSSNode();
root_child0.FlexGrow = 1f;
root_child0.FlexBasis = 50f;
root_child0.StyleHeight = 20f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.FlexGrow = 1f;
root_child1.StyleHeight = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
root_child2.FlexGrow = 1f;
root_child2.StyleHeight = 10f;
root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(113f, root.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(64f, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(64f, root_child1.LayoutY);
Assert.AreEqual(100f, root_child1.LayoutWidth);
Assert.AreEqual(25f, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(89f, root_child2.LayoutY);
Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(113f, root.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(64f, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(64f, root_child1.LayoutY);
Assert.AreEqual(100f, root_child1.LayoutWidth);
Assert.AreEqual(25f, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(89f, root_child2.LayoutY);
Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight);
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, false);
}
[Test]
public void Test_rounding_fractial_input_2()
{
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, true);
CSSNode root = new CSSNode();
root.StyleWidth = 100f;
root.StyleHeight = 113.6f;
CSSNode root_child0 = new CSSNode();
root_child0.FlexGrow = 1f;
root_child0.FlexBasis = 50f;
root_child0.StyleHeight = 20f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.FlexGrow = 1f;
root_child1.StyleHeight = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
root_child2.FlexGrow = 1f;
root_child2.StyleHeight = 10f;
root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(114f, root.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(65f, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(65f, root_child1.LayoutY);
Assert.AreEqual(100f, root_child1.LayoutWidth);
Assert.AreEqual(24f, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(89f, root_child2.LayoutY);
Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(25f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(114f, root.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(65f, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(65f, root_child1.LayoutY);
Assert.AreEqual(100f, root_child1.LayoutWidth);
Assert.AreEqual(24f, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(89f, root_child2.LayoutY);
Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(25f, root_child2.LayoutHeight);
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, false);
}
[Test]
public void Test_rounding_fractial_input_3()
{
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, true);
CSSNode root = new CSSNode();
root.SetPosition(CSSEdge.Top, 0.3f);
root.StyleWidth = 100f;
root.StyleHeight = 113.4f;
CSSNode root_child0 = new CSSNode();
root_child0.FlexGrow = 1f;
root_child0.FlexBasis = 50f;
root_child0.StyleHeight = 20f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.FlexGrow = 1f;
root_child1.StyleHeight = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
root_child2.FlexGrow = 1f;
root_child2.StyleHeight = 10f;
root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(114f, root.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(64f, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(64f, root_child1.LayoutY);
Assert.AreEqual(100f, root_child1.LayoutWidth);
Assert.AreEqual(25f, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(89f, root_child2.LayoutY);
Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(114f, root.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(64f, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(64f, root_child1.LayoutY);
Assert.AreEqual(100f, root_child1.LayoutWidth);
Assert.AreEqual(25f, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(89f, root_child2.LayoutY);
Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight);
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, false);
}
[Test]
public void Test_rounding_fractial_input_4()
{
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, true);
CSSNode root = new CSSNode();
root.SetPosition(CSSEdge.Top, 0.7f);
root.StyleWidth = 100f;
root.StyleHeight = 113.4f;
CSSNode root_child0 = new CSSNode();
root_child0.FlexGrow = 1f;
root_child0.FlexBasis = 50f;
root_child0.StyleHeight = 20f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
root_child1.FlexGrow = 1f;
root_child1.StyleHeight = 10f;
root.Insert(1, root_child1);
CSSNode root_child2 = new CSSNode();
root_child2.FlexGrow = 1f;
root_child2.StyleHeight = 10f;
root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(1f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(113f, root.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(64f, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(64f, root_child1.LayoutY);
Assert.AreEqual(100f, root_child1.LayoutWidth);
Assert.AreEqual(25f, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(89f, root_child2.LayoutY);
Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(1f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(113f, root.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(64f, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(64f, root_child1.LayoutY);
Assert.AreEqual(100f, root_child1.LayoutWidth);
Assert.AreEqual(25f, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child2.LayoutX);
Assert.AreEqual(89f, root_child2.LayoutY);
Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight);
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, false);
}
}
}