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

@@ -569,14 +569,14 @@ namespace Facebook.CSSLayout
return Native.CSSNodeGetInstanceCount();
}
public static void setExperimentalFeatureEnabled(
public static void SetExperimentalFeatureEnabled(
CSSExperimentalFeature feature,
bool enabled)
{
Native.CSSLayoutSetExperimentalFeatureEnabled(feature, enabled);
}
public static bool isExperimentalFeatureEnabled(CSSExperimentalFeature feature)
public static bool IsExperimentalFeatureEnabled(CSSExperimentalFeature feature)
{
return Native.CSSLayoutIsExperimentalFeatureEnabled(feature);
}

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);
}
}
}

View File

@@ -0,0 +1,64 @@
<div id="rounding_flex_basis_flex_grow_row_width_of_100" experiments="Rounding" style="width: 100px; height: 100px; flex-direction: row;">
<div style="flex-grow: 1;"></div>
<div style="flex-grow: 1;"></div>
<div style="flex-grow: 1;"></div>
</div>
<div id="rounding_flex_basis_flex_grow_row_prime_number_width" experiments="Rounding" style="width: 113px; height: 100px; flex-direction: row;">
<div style="flex-grow: 1;"></div>
<div style="flex-grow: 1;"></div>
<div style="flex-grow: 1;"></div>
<div style="flex-grow: 1;"></div>
<div style="flex-grow: 1;"></div>
</div>
<div id="rounding_flex_basis_flex_shrink_row" experiments="Rounding" style="width: 101px; height: 100px; flex-direction: row;">
<div style="flex-basis: 100px; flex-shrink: 1;"></div>
<div style="flex-basis: 25px;"></div>
<div style="flex-basis: 25px;"></div>
</div>
<div id="rounding_flex_basis_overrides_main_size" experiments="Rounding" style="height: 113px; 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="rounding_total_fractial" experiments="Rounding" style="height: 113.4px; width: 87.4px;">
<div style="height: 20.3px; flex-grow:0.7; flex-basis:50.3px;"></div>
<div style="height: 10px; flex-grow:1.6;"></div>
<div style="height: 10.7px; flex-grow:1.1;"></div>
</div>
<div id="rounding_total_fractial_nested" experiments="Rounding" style="height: 113.4px; width: 87.4px;">
<div style="height: 20.3px; flex-grow:0.7; flex-basis:50.3px;">
<div style="bottom: 13.3px; height: 9.9px; flex-grow:1; flex-basis:0.3px;"></div>
<div style="top: 13.3px; height: 1.1px; flex-grow:4; flex-basis:0.3px;"></div>
</div>
<div style="height: 10px; flex-grow:1.6;"></div>
<div style="height: 10.7px; flex-grow:1.1;"></div>
</div>
<div id="rounding_fractial_input_1" experiments="Rounding" style="height: 113.4px; 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="rounding_fractial_input_2" experiments="Rounding" style="height: 113.6px; 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="rounding_fractial_input_3" experiments="Rounding" style="top: 0.3px; height: 113.4px; 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="rounding_fractial_input_4" experiments="Rounding" style="top: 0.7px; height: 113.4px; 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>

View File

@@ -26,20 +26,35 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
]);
}},
emitTestPrologue:{value:function(name) {
emitTestPrologue:{value:function(name, experiments) {
this.push('TEST(CSSLayoutTest, ' + name + ') {');
this.pushIndent();
if (experiments.length > 0) {
for (var i in experiments) {
this.push('CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeature' + experiments[i] +', true);');
}
this.push('');
}
}},
emitTestTreePrologue:{value:function(nodeName) {
this.push('const CSSNodeRef ' + nodeName + ' = CSSNodeNew();');
}},
emitTestEpilogue:{value:function() {
emitTestEpilogue:{value:function(experiments) {
this.push([
'',
'CSSNodeFreeRecursive(root);',
]);
if (experiments.length > 0) {
this.push('');
for (var i in experiments) {
this.push('CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeature' + experiments[i] +', false);');
}
}
this.popIndent();
this.push([
'}',
@@ -130,7 +145,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
}},
CSSNodeStyleSetBorder:{value:function(nodeName, edge, value) {
this.push('CSSNodeStyleSetBorder(' + nodeName + ', ' + edge + ', ' + value + ');');
this.push('CSSNodeStyleSetBorder(' + nodeName + ', ' + edge + ', ' + toFloatString(value) + ');');
}},
CSSNodeStyleSetDirection:{value:function(nodeName, value) {

View File

@@ -31,18 +31,32 @@ CSEmitter.prototype = Object.create(Emitter.prototype, {
this.pushIndent();
}},
emitTestPrologue:{value:function(name) {
emitTestPrologue:{value:function(name, experiments) {
this.push('[Test]');
this.push('public void Test_' + name + '()');
this.push('{');
this.pushIndent();
if (experiments.length > 0) {
for (var i in experiments) {
this.push('CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.' + experiments[i] +', true);');
}
this.push('');
}
}},
emitTestTreePrologue:{value:function(nodeName) {
this.push('CSSNode ' + nodeName + ' = new CSSNode();');
}},
emitTestEpilogue:{value:function() {
emitTestEpilogue:{value:function(experiments) {
if (experiments.length > 0) {
this.push('');
for (var i in experiments) {
this.push('CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.' + experiments[i] +', false);');
}
}
this.popIndent();
this.push([
'}',
@@ -61,7 +75,7 @@ CSEmitter.prototype = Object.create(Emitter.prototype, {
}},
AssertEQ:{value:function(v0, v1) {
this.push('Assert.AreEqual(' + v0 + ', ' + v1 + ');');
this.push('Assert.AreEqual(' + v0 + 'f, ' + v1 + ');');
}},
CSSAlignAuto:{value:'CSSAlign.Auto'},
@@ -141,7 +155,7 @@ CSEmitter.prototype = Object.create(Emitter.prototype, {
}},
CSSNodeStyleSetBorder:{value:function(nodeName, edge, value) {
this.push(nodeName + '.SetBorder(' + edge + ', ' + value + ');');
this.push(nodeName + '.SetBorder(' + edge + ', ' + value + 'f);');
}},
CSSNodeStyleSetDirection:{value:function(nodeName, value) {
@@ -149,7 +163,7 @@ CSEmitter.prototype = Object.create(Emitter.prototype, {
}},
CSSNodeStyleSetFlexBasis:{value:function(nodeName, value) {
this.push(nodeName + '.FlexBasis = ' + value + ';');
this.push(nodeName + '.FlexBasis = ' + value + 'f;');
}},
CSSNodeStyleSetFlexDirection:{value:function(nodeName, value) {
@@ -157,11 +171,11 @@ CSEmitter.prototype = Object.create(Emitter.prototype, {
}},
CSSNodeStyleSetFlexGrow:{value:function(nodeName, value) {
this.push(nodeName + '.FlexGrow = ' + value + ';');
this.push(nodeName + '.FlexGrow = ' + value + 'f;');
}},
CSSNodeStyleSetFlexShrink:{value:function(nodeName, value) {
this.push(nodeName + '.FlexShrink = ' + value + ';');
this.push(nodeName + '.FlexShrink = ' + value + 'f;');
}},
CSSNodeStyleSetFlexWrap:{value:function(nodeName, value) {
@@ -169,7 +183,7 @@ CSEmitter.prototype = Object.create(Emitter.prototype, {
}},
CSSNodeStyleSetHeight:{value:function(nodeName, value) {
this.push(nodeName + '.StyleHeight = ' + value + ';');
this.push(nodeName + '.StyleHeight = ' + value + 'f;');
}},
CSSNodeStyleSetJustifyContent:{value:function(nodeName, value) {
@@ -177,23 +191,23 @@ CSEmitter.prototype = Object.create(Emitter.prototype, {
}},
CSSNodeStyleSetMargin:{value:function(nodeName, edge, value) {
this.push(nodeName + '.SetMargin(' + edge + ', ' + value + ');');
this.push(nodeName + '.SetMargin(' + edge + ', ' + value + 'f);');
}},
CSSNodeStyleSetMaxHeight:{value:function(nodeName, value) {
this.push(nodeName + '.StyleMaxHeight = ' + value + ';');
this.push(nodeName + '.StyleMaxHeight = ' + value + 'f;');
}},
CSSNodeStyleSetMaxWidth:{value:function(nodeName, value) {
this.push(nodeName + '.StyleMaxWidth = ' + value + ';');
this.push(nodeName + '.StyleMaxWidth = ' + value + 'f;');
}},
CSSNodeStyleSetMinHeight:{value:function(nodeName, value) {
this.push(nodeName + '.StyleMinHeight = ' + value + ';');
this.push(nodeName + '.StyleMinHeight = ' + value + 'f;');
}},
CSSNodeStyleSetMinWidth:{value:function(nodeName, value) {
this.push(nodeName + '.StyleMinWidth = ' + value + ';');
this.push(nodeName + '.StyleMinWidth = ' + value + 'f;');
}},
CSSNodeStyleSetOverflow:{value:function(nodeName, value) {
@@ -201,11 +215,11 @@ CSEmitter.prototype = Object.create(Emitter.prototype, {
}},
CSSNodeStyleSetPadding:{value:function(nodeName, edge, value) {
this.push(nodeName + '.SetPadding(' + edge + ', ' + value + ');');
this.push(nodeName + '.SetPadding(' + edge + ', ' + value + 'f);');
}},
CSSNodeStyleSetPosition:{value:function(nodeName, edge, value) {
this.push(nodeName + '.SetPosition(' + edge + ', ' + value + ');');
this.push(nodeName + '.SetPosition(' + edge + ', ' + value + 'f);');
}},
CSSNodeStyleSetPositionType:{value:function(nodeName, value) {
@@ -213,6 +227,6 @@ CSEmitter.prototype = Object.create(Emitter.prototype, {
}},
CSSNodeStyleSetWidth:{value:function(nodeName, value) {
this.push(nodeName + '.StyleWidth = ' + value + ';');
this.push(nodeName + '.StyleWidth = ' + value + 'f;');
}},
});

View File

@@ -11,6 +11,18 @@ var JavaEmitter = function() {
Emitter.call(this, 'java', ' ');
};
function toJavaUpper(symbol) {
var out = '';
for (var i = 0; i < symbol.length; i++) {
var c = symbol[i];
if (c == c.toUpperCase() && i != 0 && symbol[i - 1] != symbol[i - 1].toUpperCase()) {
out += '_';
}
out += c.toUpperCase();
}
return out;
}
JavaEmitter.prototype = Object.create(Emitter.prototype, {
constructor:{value:JavaEmitter},
@@ -27,17 +39,31 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
this.pushIndent();
}},
emitTestPrologue:{value:function(name) {
emitTestPrologue:{value:function(name, experiments) {
this.push('@Test');
this.push('public void test_' + name + '() {');
this.pushIndent();
if (experiments.length > 0) {
for (var i in experiments) {
this.push('CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.' + toJavaUpper(experiments[i]) +', true);');
}
this.push('');
}
}},
emitTestTreePrologue:{value:function(nodeName) {
this.push('final CSSNode ' + nodeName + ' = new CSSNode();');
}},
emitTestEpilogue:{value:function() {
emitTestEpilogue:{value:function(experiments) {
if (experiments.length > 0) {
this.push('');
for (var i in experiments) {
this.push('CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.' + toJavaUpper(experiments[i]) +', false);');
}
}
this.popIndent();
this.push([
'}',
@@ -54,7 +80,7 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
}},
AssertEQ:{value:function(v0, v1) {
this.push('assertEquals(' + v0 + ', ' + v1 + ', 0.0f);');
this.push('assertEquals(' + v0 + 'f, ' + v1 + ', 0.0f);');
}},
CSSAlignAuto:{value:'CSSAlign.AUTO'},
@@ -134,7 +160,7 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
}},
CSSNodeStyleSetBorder:{value:function(nodeName, edge, value) {
this.push(nodeName + '.setBorder(' + edge + ', ' + value + ');');
this.push(nodeName + '.setBorder(' + edge + ', ' + value + 'f);');
}},
CSSNodeStyleSetDirection:{value:function(nodeName, value) {
@@ -142,7 +168,7 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
}},
CSSNodeStyleSetFlexBasis:{value:function(nodeName, value) {
this.push(nodeName + '.setFlexBasis(' + value + ');');
this.push(nodeName + '.setFlexBasis(' + value + 'f);');
}},
CSSNodeStyleSetFlexDirection:{value:function(nodeName, value) {
@@ -150,11 +176,11 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
}},
CSSNodeStyleSetFlexGrow:{value:function(nodeName, value) {
this.push(nodeName + '.setFlexGrow(' + value + ');');
this.push(nodeName + '.setFlexGrow(' + value + 'f);');
}},
CSSNodeStyleSetFlexShrink:{value:function(nodeName, value) {
this.push(nodeName + '.setFlexShrink(' + value + ');');
this.push(nodeName + '.setFlexShrink(' + value + 'f);');
}},
CSSNodeStyleSetFlexWrap:{value:function(nodeName, value) {
@@ -162,7 +188,7 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
}},
CSSNodeStyleSetHeight:{value:function(nodeName, value) {
this.push(nodeName + '.setStyleHeight(' + value + ');');
this.push(nodeName + '.setStyleHeight(' + value + 'f);');
}},
CSSNodeStyleSetJustifyContent:{value:function(nodeName, value) {
@@ -170,23 +196,23 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
}},
CSSNodeStyleSetMargin:{value:function(nodeName, edge, value) {
this.push(nodeName + '.setMargin(' + edge + ', ' + value + ');');
this.push(nodeName + '.setMargin(' + edge + ', ' + value + 'f);');
}},
CSSNodeStyleSetMaxHeight:{value:function(nodeName, value) {
this.push(nodeName + '.setStyleMaxHeight(' + value + ');');
this.push(nodeName + '.setStyleMaxHeight(' + value + 'f);');
}},
CSSNodeStyleSetMaxWidth:{value:function(nodeName, value) {
this.push(nodeName + '.setStyleMaxWidth(' + value + ');');
this.push(nodeName + '.setStyleMaxWidth(' + value + 'f);');
}},
CSSNodeStyleSetMinHeight:{value:function(nodeName, value) {
this.push(nodeName + '.setStyleMinHeight(' + value + ');');
this.push(nodeName + '.setStyleMinHeight(' + value + 'f);');
}},
CSSNodeStyleSetMinWidth:{value:function(nodeName, value) {
this.push(nodeName + '.setStyleMinWidth(' + value + ');');
this.push(nodeName + '.setStyleMinWidth(' + value + 'f);');
}},
CSSNodeStyleSetOverflow:{value:function(nodeName, value) {
@@ -198,7 +224,7 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
}},
CSSNodeStyleSetPosition:{value:function(nodeName, edge, value) {
this.push(nodeName + '.setPosition(' + edge + ', ' + value + ');');
this.push(nodeName + '.setPosition(' + edge + ', ' + value + 'f);');
}},
CSSNodeStyleSetPositionType:{value:function(nodeName, value) {
@@ -206,6 +232,6 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
}},
CSSNodeStyleSetWidth:{value:function(nodeName, value) {
this.push(nodeName + '.setStyleWidth(' + value + ');');
this.push(nodeName + '.setStyleWidth(' + value + 'f);');
}},
});

View File

@@ -46,36 +46,7 @@ function printTest(e, LTRContainer, RTLContainer, genericContainer) {
' * of patent rights can be found in the PATENTS file in the same directory.',
' */',
'',
'/**',
' * @Generated by gentest/gentest.sh with the following input',
' *',
]);
var indentation = 0;
e.push(genericContainer.innerHTML.split('\n').map(function(line) {
return line.trim();
}).filter(function(line) {
return line.length > 0 && line !== '<div id="default"></div>';
}).map(function(line) {
var result;
if (line.indexOf('</div') == 0) {
result = ' '.repeat(indentation - 1) + line;
} else {
result = ' '.repeat(indentation) + line;
}
indentation += (line.match(/<div/g) || []).length;
indentation -= (line.match(/<\/div/g) || []).length;
return result;
}).reduce(function(curr, prev) {
if (prev.indexOf('<div') == 0) {
prev = '\n' + prev;
}
return curr + '\n' + prev;
}));
e.push([
' *',
' */',
' // @Generated by gentest/gentest.rb from gentest/fixtures/' + document.title + '.html',
'',
]);
e.emitPrologue();
@@ -86,7 +57,7 @@ function printTest(e, LTRContainer, RTLContainer, genericContainer) {
for (var i = 0; i < genericLayoutTree.length; i++) {
e.emitTestPrologue(genericLayoutTree[i].name);
e.emitTestPrologue(genericLayoutTree[i].name, genericLayoutTree[i].experiments);
if (genericLayoutTree[i].name == 'wrap_column') {
// Modify width and left values due to both safari and chrome not abiding by the
@@ -127,7 +98,7 @@ function printTest(e, LTRContainer, RTLContainer, genericContainer) {
assertTestTree(e, RTLLayoutTree[i], 'root', null);
e.emitTestEpilogue();
e.emitTestEpilogue(genericLayoutTree[i].experiments);
}
e.emitEpilogue();
@@ -443,6 +414,9 @@ function calculateTree(root) {
style: getCSSLayoutStyle(child),
declaredStyle: child.style,
rawStyle: child.getAttribute('style'),
experiments: child.getAttribute('experiments')
? child.getAttribute('experiments').split(' ')
: [],
});
}

View File

@@ -1,10 +1,17 @@
#!/usr/bin/env ruby
require 'watir-webdriver'
require 'fileutils'
caps = Selenium::WebDriver::Remote::Capabilities.chrome(
"loggingPrefs"=>{"browser"=>"ALL", "performance"=>"ALL"})
"loggingPrefs"=>{
"browser"=>"ALL",
"performance"=>"ALL"
}
)
browser = Watir::Browser.new(:chrome, :desired_capabilities => caps)
Dir.chdir(File.dirname($0))
Dir['fixtures/*.html'].each do |file|
fixture = File.read(file)
name = File.basename(file, '.*')
@@ -22,7 +29,7 @@ Dir['fixtures/*.html'].each do |file|
template = File.open('test-template.html').read
f = File.open('test.html', 'w')
f.write sprintf(template, ltr_fixture, rtl_fixture, fixture)
f.write sprintf(template, name, ltr_fixture, rtl_fixture, fixture)
f.close
FileUtils.copy('test.html', "#{name}.html") if $DEBUG

View File

@@ -2,7 +2,7 @@
<html>
<head>
<meta charset="UTF-8">
<title>test page</title>
<title>%s</title>
<script src="gentest.js"></script>
<script src="gentest-cpp.js"></script>
<script src="gentest-java.js"></script>

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
package com.facebook.csslayout;
@@ -49,163 +19,163 @@ public class CSSLayoutAbsolutePositionTest {
@Test
public void test_absolute_layout_width_height_start_top() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setPositionType(CSSPositionType.ABSOLUTE);
root_child0.setPosition(Spacing.START, 10);
root_child0.setPosition(Spacing.TOP, 10);
root_child0.setStyleWidth(10);
root_child0.setStyleHeight(10);
root_child0.setPosition(Spacing.START, 10f);
root_child0.setPosition(Spacing.TOP, 10f);
root_child0.setStyleWidth(10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(80, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(80f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_absolute_layout_width_height_end_bottom() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setPositionType(CSSPositionType.ABSOLUTE);
root_child0.setPosition(Spacing.END, 10);
root_child0.setPosition(Spacing.BOTTOM, 10);
root_child0.setStyleWidth(10);
root_child0.setStyleHeight(10);
root_child0.setPosition(Spacing.END, 10f);
root_child0.setPosition(Spacing.BOTTOM, 10f);
root_child0.setStyleWidth(10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(80, root_child0.getLayoutX(), 0.0f);
assertEquals(80, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(80f, root_child0.getLayoutX(), 0.0f);
assertEquals(80f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(80, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(80f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_absolute_layout_start_top_end_bottom() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setPositionType(CSSPositionType.ABSOLUTE);
root_child0.setPosition(Spacing.START, 10);
root_child0.setPosition(Spacing.TOP, 10);
root_child0.setPosition(Spacing.END, 10);
root_child0.setPosition(Spacing.BOTTOM, 10);
root_child0.setPosition(Spacing.START, 10f);
root_child0.setPosition(Spacing.TOP, 10f);
root_child0.setPosition(Spacing.END, 10f);
root_child0.setPosition(Spacing.BOTTOM, 10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(80, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(80f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(80, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(80f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_absolute_layout_width_height_start_top_end_bottom() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setPositionType(CSSPositionType.ABSOLUTE);
root_child0.setPosition(Spacing.START, 10);
root_child0.setPosition(Spacing.TOP, 10);
root_child0.setPosition(Spacing.END, 10);
root_child0.setPosition(Spacing.BOTTOM, 10);
root_child0.setStyleWidth(10);
root_child0.setStyleHeight(10);
root_child0.setPosition(Spacing.START, 10f);
root_child0.setPosition(Spacing.TOP, 10f);
root_child0.setPosition(Spacing.END, 10f);
root_child0.setPosition(Spacing.BOTTOM, 10f);
root_child0.setStyleWidth(10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(80, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(80f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
@@ -213,124 +183,124 @@ public class CSSLayoutAbsolutePositionTest {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setOverflow(CSSOverflow.HIDDEN);
root.setStyleWidth(50);
root.setStyleHeight(50);
root.setStyleWidth(50f);
root.setStyleHeight(50f);
final CSSNode root_child0 = new CSSNode();
root_child0.setPositionType(CSSPositionType.ABSOLUTE);
root_child0.setPosition(Spacing.START, 0);
root_child0.setPosition(Spacing.TOP, 0);
root_child0.setPosition(Spacing.START, 0f);
root_child0.setPosition(Spacing.TOP, 0f);
root.addChildAt(root_child0, 0);
final CSSNode root_child0_child0 = new CSSNode();
root_child0_child0.setStyleWidth(100);
root_child0_child0.setStyleHeight(100);
root_child0_child0.setStyleWidth(100f);
root_child0_child0.setStyleHeight(100f);
root_child0.addChildAt(root_child0_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(50, root.getLayoutWidth(), 0.0f);
assertEquals(50, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(50f, root.getLayoutWidth(), 0.0f);
assertEquals(50f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(50, root.getLayoutWidth(), 0.0f);
assertEquals(50, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(50f, root.getLayoutWidth(), 0.0f);
assertEquals(50f, root.getLayoutHeight(), 0.0f);
assertEquals(-50, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(-50f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_absolute_layout_within_border() {
final CSSNode root = new CSSNode();
root.setMargin(Spacing.LEFT, 10);
root.setMargin(Spacing.TOP, 10);
root.setMargin(Spacing.RIGHT, 10);
root.setMargin(Spacing.BOTTOM, 10);
root.setMargin(Spacing.LEFT, 10f);
root.setMargin(Spacing.TOP, 10f);
root.setMargin(Spacing.RIGHT, 10f);
root.setMargin(Spacing.BOTTOM, 10f);
root.setPadding(Spacing.LEFT, 10);
root.setPadding(Spacing.TOP, 10);
root.setPadding(Spacing.RIGHT, 10);
root.setPadding(Spacing.BOTTOM, 10);
root.setBorder(Spacing.LEFT, 10);
root.setBorder(Spacing.TOP, 10);
root.setBorder(Spacing.RIGHT, 10);
root.setBorder(Spacing.BOTTOM, 10);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setBorder(Spacing.LEFT, 10f);
root.setBorder(Spacing.TOP, 10f);
root.setBorder(Spacing.RIGHT, 10f);
root.setBorder(Spacing.BOTTOM, 10f);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setPositionType(CSSPositionType.ABSOLUTE);
root_child0.setPosition(Spacing.LEFT, 0);
root_child0.setPosition(Spacing.TOP, 0);
root_child0.setStyleWidth(50);
root_child0.setStyleHeight(50);
root_child0.setPosition(Spacing.LEFT, 0f);
root_child0.setPosition(Spacing.TOP, 0f);
root_child0.setStyleWidth(50f);
root_child0.setStyleHeight(50f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setPositionType(CSSPositionType.ABSOLUTE);
root_child1.setPosition(Spacing.RIGHT, 0);
root_child1.setPosition(Spacing.BOTTOM, 0);
root_child1.setStyleWidth(50);
root_child1.setStyleHeight(50);
root_child1.setPosition(Spacing.RIGHT, 0f);
root_child1.setPosition(Spacing.BOTTOM, 0f);
root_child1.setStyleWidth(50f);
root_child1.setStyleHeight(50f);
root.addChildAt(root_child1, 1);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(10, root.getLayoutX(), 0.0f);
assertEquals(10, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(10f, root.getLayoutX(), 0.0f);
assertEquals(10f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(40, root_child1.getLayoutX(), 0.0f);
assertEquals(40, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50, root_child1.getLayoutHeight(), 0.0f);
assertEquals(40f, root_child1.getLayoutX(), 0.0f);
assertEquals(40f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(10, root.getLayoutX(), 0.0f);
assertEquals(10, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(10f, root.getLayoutX(), 0.0f);
assertEquals(10f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(40, root_child1.getLayoutX(), 0.0f);
assertEquals(40, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50, root_child1.getLayoutHeight(), 0.0f);
assertEquals(40f, root_child1.getLayoutX(), 0.0f);
assertEquals(40f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
}
}

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
package com.facebook.csslayout;
@@ -55,98 +20,98 @@ public class CSSLayoutAlignContentTest {
public void test_align_content_flex_start() {
final CSSNode root = new CSSNode();
root.setWrap(CSSWrap.WRAP);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(50);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(50f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setStyleWidth(50);
root_child1.setStyleHeight(10);
root_child1.setStyleWidth(50f);
root_child1.setStyleHeight(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleWidth(50);
root_child2.setStyleHeight(10);
root_child2.setStyleWidth(50f);
root_child2.setStyleHeight(10f);
root.addChildAt(root_child2, 2);
final CSSNode root_child3 = new CSSNode();
root_child3.setStyleWidth(50);
root_child3.setStyleHeight(10);
root_child3.setStyleWidth(50f);
root_child3.setStyleHeight(10f);
root.addChildAt(root_child3, 3);
final CSSNode root_child4 = new CSSNode();
root_child4.setStyleWidth(50);
root_child4.setStyleHeight(10);
root_child4.setStyleWidth(50f);
root_child4.setStyleHeight(10f);
root.addChildAt(root_child4, 4);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(10, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(20, root_child2.getLayoutY(), 0.0f);
assertEquals(50, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0, root_child3.getLayoutX(), 0.0f);
assertEquals(30, root_child3.getLayoutY(), 0.0f);
assertEquals(50, root_child3.getLayoutWidth(), 0.0f);
assertEquals(10, root_child3.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child3.getLayoutX(), 0.0f);
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child3.getLayoutHeight(), 0.0f);
assertEquals(0, root_child4.getLayoutX(), 0.0f);
assertEquals(40, root_child4.getLayoutY(), 0.0f);
assertEquals(50, root_child4.getLayoutWidth(), 0.0f);
assertEquals(10, root_child4.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child4.getLayoutX(), 0.0f);
assertEquals(40f, root_child4.getLayoutY(), 0.0f);
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(50, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50, root_child1.getLayoutX(), 0.0f);
assertEquals(10, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(50, root_child2.getLayoutX(), 0.0f);
assertEquals(20, root_child2.getLayoutY(), 0.0f);
assertEquals(50, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child2.getLayoutX(), 0.0f);
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(50, root_child3.getLayoutX(), 0.0f);
assertEquals(30, root_child3.getLayoutY(), 0.0f);
assertEquals(50, root_child3.getLayoutWidth(), 0.0f);
assertEquals(10, root_child3.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child3.getLayoutX(), 0.0f);
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child3.getLayoutHeight(), 0.0f);
assertEquals(50, root_child4.getLayoutX(), 0.0f);
assertEquals(40, root_child4.getLayoutY(), 0.0f);
assertEquals(50, root_child4.getLayoutWidth(), 0.0f);
assertEquals(10, root_child4.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child4.getLayoutX(), 0.0f);
assertEquals(40f, root_child4.getLayoutY(), 0.0f);
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
}
@Test
@@ -154,98 +119,98 @@ public class CSSLayoutAlignContentTest {
final CSSNode root = new CSSNode();
root.setAlignContent(CSSAlign.FLEX_END);
root.setWrap(CSSWrap.WRAP);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(50);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(50f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setStyleWidth(50);
root_child1.setStyleHeight(10);
root_child1.setStyleWidth(50f);
root_child1.setStyleHeight(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleWidth(50);
root_child2.setStyleHeight(10);
root_child2.setStyleWidth(50f);
root_child2.setStyleHeight(10f);
root.addChildAt(root_child2, 2);
final CSSNode root_child3 = new CSSNode();
root_child3.setStyleWidth(50);
root_child3.setStyleHeight(10);
root_child3.setStyleWidth(50f);
root_child3.setStyleHeight(10f);
root.addChildAt(root_child3, 3);
final CSSNode root_child4 = new CSSNode();
root_child4.setStyleWidth(50);
root_child4.setStyleHeight(10);
root_child4.setStyleWidth(50f);
root_child4.setStyleHeight(10f);
root.addChildAt(root_child4, 4);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(10, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(20, root_child2.getLayoutY(), 0.0f);
assertEquals(50, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0, root_child3.getLayoutX(), 0.0f);
assertEquals(30, root_child3.getLayoutY(), 0.0f);
assertEquals(50, root_child3.getLayoutWidth(), 0.0f);
assertEquals(10, root_child3.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child3.getLayoutX(), 0.0f);
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child3.getLayoutHeight(), 0.0f);
assertEquals(0, root_child4.getLayoutX(), 0.0f);
assertEquals(40, root_child4.getLayoutY(), 0.0f);
assertEquals(50, root_child4.getLayoutWidth(), 0.0f);
assertEquals(10, root_child4.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child4.getLayoutX(), 0.0f);
assertEquals(40f, root_child4.getLayoutY(), 0.0f);
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(50, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50, root_child1.getLayoutX(), 0.0f);
assertEquals(10, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(50, root_child2.getLayoutX(), 0.0f);
assertEquals(20, root_child2.getLayoutY(), 0.0f);
assertEquals(50, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child2.getLayoutX(), 0.0f);
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(50, root_child3.getLayoutX(), 0.0f);
assertEquals(30, root_child3.getLayoutY(), 0.0f);
assertEquals(50, root_child3.getLayoutWidth(), 0.0f);
assertEquals(10, root_child3.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child3.getLayoutX(), 0.0f);
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child3.getLayoutHeight(), 0.0f);
assertEquals(50, root_child4.getLayoutX(), 0.0f);
assertEquals(40, root_child4.getLayoutY(), 0.0f);
assertEquals(50, root_child4.getLayoutWidth(), 0.0f);
assertEquals(10, root_child4.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child4.getLayoutX(), 0.0f);
assertEquals(40f, root_child4.getLayoutY(), 0.0f);
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
}
@Test
@@ -253,98 +218,98 @@ public class CSSLayoutAlignContentTest {
final CSSNode root = new CSSNode();
root.setAlignContent(CSSAlign.CENTER);
root.setWrap(CSSWrap.WRAP);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(50);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(50f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setStyleWidth(50);
root_child1.setStyleHeight(10);
root_child1.setStyleWidth(50f);
root_child1.setStyleHeight(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleWidth(50);
root_child2.setStyleHeight(10);
root_child2.setStyleWidth(50f);
root_child2.setStyleHeight(10f);
root.addChildAt(root_child2, 2);
final CSSNode root_child3 = new CSSNode();
root_child3.setStyleWidth(50);
root_child3.setStyleHeight(10);
root_child3.setStyleWidth(50f);
root_child3.setStyleHeight(10f);
root.addChildAt(root_child3, 3);
final CSSNode root_child4 = new CSSNode();
root_child4.setStyleWidth(50);
root_child4.setStyleHeight(10);
root_child4.setStyleWidth(50f);
root_child4.setStyleHeight(10f);
root.addChildAt(root_child4, 4);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(10, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(20, root_child2.getLayoutY(), 0.0f);
assertEquals(50, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0, root_child3.getLayoutX(), 0.0f);
assertEquals(30, root_child3.getLayoutY(), 0.0f);
assertEquals(50, root_child3.getLayoutWidth(), 0.0f);
assertEquals(10, root_child3.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child3.getLayoutX(), 0.0f);
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child3.getLayoutHeight(), 0.0f);
assertEquals(0, root_child4.getLayoutX(), 0.0f);
assertEquals(40, root_child4.getLayoutY(), 0.0f);
assertEquals(50, root_child4.getLayoutWidth(), 0.0f);
assertEquals(10, root_child4.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child4.getLayoutX(), 0.0f);
assertEquals(40f, root_child4.getLayoutY(), 0.0f);
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(50, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50, root_child1.getLayoutX(), 0.0f);
assertEquals(10, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(50, root_child2.getLayoutX(), 0.0f);
assertEquals(20, root_child2.getLayoutY(), 0.0f);
assertEquals(50, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child2.getLayoutX(), 0.0f);
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(50, root_child3.getLayoutX(), 0.0f);
assertEquals(30, root_child3.getLayoutY(), 0.0f);
assertEquals(50, root_child3.getLayoutWidth(), 0.0f);
assertEquals(10, root_child3.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child3.getLayoutX(), 0.0f);
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child3.getLayoutHeight(), 0.0f);
assertEquals(50, root_child4.getLayoutX(), 0.0f);
assertEquals(40, root_child4.getLayoutY(), 0.0f);
assertEquals(50, root_child4.getLayoutWidth(), 0.0f);
assertEquals(10, root_child4.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child4.getLayoutX(), 0.0f);
assertEquals(40f, root_child4.getLayoutY(), 0.0f);
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
}
@Test
@@ -352,93 +317,93 @@ public class CSSLayoutAlignContentTest {
final CSSNode root = new CSSNode();
root.setAlignContent(CSSAlign.STRETCH);
root.setWrap(CSSWrap.WRAP);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(50);
root_child0.setStyleWidth(50f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setStyleWidth(50);
root_child1.setStyleWidth(50f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleWidth(50);
root_child2.setStyleWidth(50f);
root.addChildAt(root_child2, 2);
final CSSNode root_child3 = new CSSNode();
root_child3.setStyleWidth(50);
root_child3.setStyleWidth(50f);
root.addChildAt(root_child3, 3);
final CSSNode root_child4 = new CSSNode();
root_child4.setStyleWidth(50);
root_child4.setStyleWidth(50f);
root.addChildAt(root_child4, 4);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(0, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(0, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(0, root_child2.getLayoutY(), 0.0f);
assertEquals(50, root_child2.getLayoutWidth(), 0.0f);
assertEquals(0, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0, root_child3.getLayoutX(), 0.0f);
assertEquals(0, root_child3.getLayoutY(), 0.0f);
assertEquals(50, root_child3.getLayoutWidth(), 0.0f);
assertEquals(0, root_child3.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child3.getLayoutX(), 0.0f);
assertEquals(0f, root_child3.getLayoutY(), 0.0f);
assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child3.getLayoutHeight(), 0.0f);
assertEquals(0, root_child4.getLayoutX(), 0.0f);
assertEquals(0, root_child4.getLayoutY(), 0.0f);
assertEquals(50, root_child4.getLayoutWidth(), 0.0f);
assertEquals(0, root_child4.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child4.getLayoutX(), 0.0f);
assertEquals(0f, root_child4.getLayoutY(), 0.0f);
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child4.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(50, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(0, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(0, root_child1.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(50, root_child2.getLayoutX(), 0.0f);
assertEquals(0, root_child2.getLayoutY(), 0.0f);
assertEquals(50, root_child2.getLayoutWidth(), 0.0f);
assertEquals(0, root_child2.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(50, root_child3.getLayoutX(), 0.0f);
assertEquals(0, root_child3.getLayoutY(), 0.0f);
assertEquals(50, root_child3.getLayoutWidth(), 0.0f);
assertEquals(0, root_child3.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child3.getLayoutX(), 0.0f);
assertEquals(0f, root_child3.getLayoutY(), 0.0f);
assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child3.getLayoutHeight(), 0.0f);
assertEquals(50, root_child4.getLayoutX(), 0.0f);
assertEquals(0, root_child4.getLayoutY(), 0.0f);
assertEquals(50, root_child4.getLayoutWidth(), 0.0f);
assertEquals(0, root_child4.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child4.getLayoutX(), 0.0f);
assertEquals(0f, root_child4.getLayoutY(), 0.0f);
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child4.getLayoutHeight(), 0.0f);
}
}

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
package com.facebook.csslayout;
@@ -38,151 +19,151 @@ public class CSSLayoutAlignItemsTest {
@Test
public void test_align_items_stretch() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleHeight(10);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_align_items_center() {
final CSSNode root = new CSSNode();
root.setAlignItems(CSSAlign.CENTER);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(10);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(45, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(45f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(45, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(45f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_align_items_flex_start() {
final CSSNode root = new CSSNode();
root.setAlignItems(CSSAlign.FLEX_START);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(10);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(90, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(90f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_align_items_flex_end() {
final CSSNode root = new CSSNode();
root.setAlignItems(CSSAlign.FLEX_END);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(10);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(90, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(90f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
}

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
package com.facebook.csslayout;
@@ -38,154 +19,154 @@ public class CSSLayoutAlignSelfTest {
@Test
public void test_align_self_center() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setAlignSelf(CSSAlign.CENTER);
root_child0.setStyleWidth(10);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(45, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(45f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(45, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(45f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_align_self_flex_end() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setAlignSelf(CSSAlign.FLEX_END);
root_child0.setStyleWidth(10);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(90, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(90f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_align_self_flex_start() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setAlignSelf(CSSAlign.FLEX_START);
root_child0.setStyleWidth(10);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(90, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(90f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_align_self_flex_end_override_flex_start() {
final CSSNode root = new CSSNode();
root.setAlignItems(CSSAlign.FLEX_START);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setAlignSelf(CSSAlign.FLEX_END);
root_child0.setStyleWidth(10);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(90, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(90f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
}

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
package com.facebook.csslayout;
@@ -41,145 +19,145 @@ public class CSSLayoutBorderTest {
@Test
public void test_border_no_size() {
final CSSNode root = new CSSNode();
root.setBorder(Spacing.LEFT, 10);
root.setBorder(Spacing.TOP, 10);
root.setBorder(Spacing.RIGHT, 10);
root.setBorder(Spacing.BOTTOM, 10);
root.setBorder(Spacing.LEFT, 10f);
root.setBorder(Spacing.TOP, 10f);
root.setBorder(Spacing.RIGHT, 10f);
root.setBorder(Spacing.BOTTOM, 10f);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(20, root.getLayoutWidth(), 0.0f);
assertEquals(20, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(20f, root.getLayoutWidth(), 0.0f);
assertEquals(20f, root.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(20, root.getLayoutWidth(), 0.0f);
assertEquals(20, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(20f, root.getLayoutWidth(), 0.0f);
assertEquals(20f, root.getLayoutHeight(), 0.0f);
}
@Test
public void test_border_container_match_child() {
final CSSNode root = new CSSNode();
root.setBorder(Spacing.LEFT, 10);
root.setBorder(Spacing.TOP, 10);
root.setBorder(Spacing.RIGHT, 10);
root.setBorder(Spacing.BOTTOM, 10);
root.setBorder(Spacing.LEFT, 10f);
root.setBorder(Spacing.TOP, 10f);
root.setBorder(Spacing.RIGHT, 10f);
root.setBorder(Spacing.BOTTOM, 10f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(10);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(30, root.getLayoutWidth(), 0.0f);
assertEquals(30, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(30f, root.getLayoutWidth(), 0.0f);
assertEquals(30f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(30, root.getLayoutWidth(), 0.0f);
assertEquals(30, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(30f, root.getLayoutWidth(), 0.0f);
assertEquals(30f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_border_flex_child() {
final CSSNode root = new CSSNode();
root.setBorder(Spacing.LEFT, 10);
root.setBorder(Spacing.TOP, 10);
root.setBorder(Spacing.RIGHT, 10);
root.setBorder(Spacing.BOTTOM, 10);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setBorder(Spacing.LEFT, 10f);
root.setBorder(Spacing.TOP, 10f);
root.setBorder(Spacing.RIGHT, 10f);
root.setBorder(Spacing.BOTTOM, 10f);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1);
root_child0.setStyleWidth(10);
root_child0.setFlexGrow(1f);
root_child0.setStyleWidth(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(80, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80, root_child0.getLayoutHeight(), 0.0f);
assertEquals(80f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_border_stretch_child() {
final CSSNode root = new CSSNode();
root.setBorder(Spacing.LEFT, 10);
root.setBorder(Spacing.TOP, 10);
root.setBorder(Spacing.RIGHT, 10);
root.setBorder(Spacing.BOTTOM, 10);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setBorder(Spacing.LEFT, 10f);
root.setBorder(Spacing.TOP, 10f);
root.setBorder(Spacing.RIGHT, 10f);
root.setBorder(Spacing.BOTTOM, 10f);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleHeight(10);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(80, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(80f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(80, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(80f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
@@ -187,41 +165,41 @@ public class CSSLayoutBorderTest {
final CSSNode root = new CSSNode();
root.setJustifyContent(CSSJustify.CENTER);
root.setAlignItems(CSSAlign.CENTER);
root.setBorder(Spacing.START, 10);
root.setBorder(Spacing.END, 20);
root.setBorder(Spacing.BOTTOM, 20);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setBorder(Spacing.START, 10f);
root.setBorder(Spacing.END, 20f);
root.setBorder(Spacing.BOTTOM, 20f);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(10);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(40, root_child0.getLayoutX(), 0.0f);
assertEquals(35, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(40f, root_child0.getLayoutX(), 0.0f);
assertEquals(35f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(50, root_child0.getLayoutX(), 0.0f);
assertEquals(35, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
assertEquals(35f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
}

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
package com.facebook.csslayout;
@@ -58,387 +19,387 @@ public class CSSLayoutFlexDirectionTest {
@Test
public void test_flex_direction_column_no_height() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleWidth(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleHeight(10);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setStyleHeight(10);
root_child1.setStyleHeight(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleHeight(10);
root_child2.setStyleHeight(10f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(30, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(30f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(10, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(20, root_child2.getLayoutY(), 0.0f);
assertEquals(100, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(30, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(30f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(10, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(20, root_child2.getLayoutY(), 0.0f);
assertEquals(100, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
}
@Test
public void test_flex_direction_row_no_width() {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setStyleHeight(100);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(10);
root_child0.setStyleWidth(10f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setStyleWidth(10);
root_child1.setStyleWidth(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleWidth(10);
root_child2.setStyleWidth(10f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(30, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(30f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(10, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100, root_child1.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(20, root_child2.getLayoutX(), 0.0f);
assertEquals(0, root_child2.getLayoutY(), 0.0f);
assertEquals(10, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100, root_child2.getLayoutHeight(), 0.0f);
assertEquals(20f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(30, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(30f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(20, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(20f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(10, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100, root_child1.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(0, root_child2.getLayoutY(), 0.0f);
assertEquals(10, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
}
@Test
public void test_flex_direction_column() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleHeight(10);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setStyleHeight(10);
root_child1.setStyleHeight(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleHeight(10);
root_child2.setStyleHeight(10f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(10, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(20, root_child2.getLayoutY(), 0.0f);
assertEquals(100, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(10, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(20, root_child2.getLayoutY(), 0.0f);
assertEquals(100, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
}
@Test
public void test_flex_direction_row() {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(10);
root_child0.setStyleWidth(10f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setStyleWidth(10);
root_child1.setStyleWidth(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleWidth(10);
root_child2.setStyleWidth(10f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(10, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100, root_child1.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(20, root_child2.getLayoutX(), 0.0f);
assertEquals(0, root_child2.getLayoutY(), 0.0f);
assertEquals(10, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100, root_child2.getLayoutHeight(), 0.0f);
assertEquals(20f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(90, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(90f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(80, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(10, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100, root_child1.getLayoutHeight(), 0.0f);
assertEquals(80f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(70, root_child2.getLayoutX(), 0.0f);
assertEquals(0, root_child2.getLayoutY(), 0.0f);
assertEquals(10, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100, root_child2.getLayoutHeight(), 0.0f);
assertEquals(70f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
}
@Test
public void test_flex_direction_column_reverse() {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.COLUMN_REVERSE);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleHeight(10);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setStyleHeight(10);
root_child1.setStyleHeight(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleHeight(10);
root_child2.setStyleHeight(10f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(90, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(90f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(80, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(80f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(70, root_child2.getLayoutY(), 0.0f);
assertEquals(100, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(70f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(90, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(90f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(80, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(80f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(70, root_child2.getLayoutY(), 0.0f);
assertEquals(100, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(70f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
}
@Test
public void test_flex_direction_row_reverse() {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW_REVERSE);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(10);
root_child0.setStyleWidth(10f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setStyleWidth(10);
root_child1.setStyleWidth(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleWidth(10);
root_child2.setStyleWidth(10f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(90, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(90f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(80, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(10, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100, root_child1.getLayoutHeight(), 0.0f);
assertEquals(80f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(70, root_child2.getLayoutX(), 0.0f);
assertEquals(0, root_child2.getLayoutY(), 0.0f);
assertEquals(10, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100, root_child2.getLayoutHeight(), 0.0f);
assertEquals(70f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(10, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100, root_child1.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(20, root_child2.getLayoutX(), 0.0f);
assertEquals(0, root_child2.getLayoutY(), 0.0f);
assertEquals(10, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100, root_child2.getLayoutHeight(), 0.0f);
assertEquals(20f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
}
}

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
package com.facebook.csslayout;
@@ -60,392 +19,392 @@ public class CSSLayoutFlexTest {
@Test
public void test_flex_basis_flex_grow_column() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1);
root_child0.setFlexBasis(50);
root_child0.setFlexGrow(1f);
root_child0.setFlexBasis(50f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1);
root_child1.setFlexGrow(1f);
root.addChildAt(root_child1, 1);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(75, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(75f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(75, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(25, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(75f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child1.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(75, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(75f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(75, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(25, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(75f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child1.getLayoutHeight(), 0.0f);
}
@Test
public void test_flex_basis_flex_grow_row() {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1);
root_child0.setFlexBasis(50);
root_child0.setFlexGrow(1f);
root_child0.setFlexBasis(50f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1);
root_child1.setFlexGrow(1f);
root.addChildAt(root_child1, 1);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(75, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(75f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(75, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(25, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100, root_child1.getLayoutHeight(), 0.0f);
assertEquals(75f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(25f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(25, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(75, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(25f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(75f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(25, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(25f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
}
@Test
public void test_flex_basis_flex_shrink_column() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexShrink(1);
root_child0.setFlexBasis(100);
root_child0.setFlexShrink(1f);
root_child0.setFlexBasis(100f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexBasis(50);
root_child1.setFlexBasis(50f);
root.addChildAt(root_child1, 1);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(50, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(50, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
}
@Test
public void test_flex_basis_flex_shrink_row() {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexShrink(1);
root_child0.setFlexBasis(100);
root_child0.setFlexShrink(1f);
root_child0.setFlexBasis(100f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexBasis(50);
root_child1.setFlexBasis(50f);
root.addChildAt(root_child1, 1);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100, root_child1.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(50, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
}
@Test
public void test_flex_shrink_to_zero() {
final CSSNode root = new CSSNode();
root.setStyleHeight(75);
root.setStyleHeight(75f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(50);
root_child0.setStyleHeight(50);
root_child0.setStyleWidth(50f);
root_child0.setStyleHeight(50f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexShrink(1);
root_child1.setStyleWidth(50);
root_child1.setStyleHeight(50);
root_child1.setFlexShrink(1f);
root_child1.setStyleWidth(50f);
root_child1.setStyleHeight(50f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleWidth(50);
root_child2.setStyleHeight(50);
root_child2.setStyleWidth(50f);
root_child2.setStyleHeight(50f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(50, root.getLayoutWidth(), 0.0f);
assertEquals(75, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(50f, root.getLayoutWidth(), 0.0f);
assertEquals(75f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(50, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(0, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(50, root_child2.getLayoutY(), 0.0f);
assertEquals(50, root_child2.getLayoutWidth(), 0.0f);
assertEquals(50, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(50f, root_child2.getLayoutY(), 0.0f);
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(50, root.getLayoutWidth(), 0.0f);
assertEquals(75, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(50f, root.getLayoutWidth(), 0.0f);
assertEquals(75f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(50, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(0, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(50, root_child2.getLayoutY(), 0.0f);
assertEquals(50, root_child2.getLayoutWidth(), 0.0f);
assertEquals(50, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(50f, root_child2.getLayoutY(), 0.0f);
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
}
@Test
public void test_flex_basis_overrides_main_size() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1);
root_child0.setFlexBasis(50);
root_child0.setStyleHeight(20);
root_child0.setFlexGrow(1f);
root_child0.setFlexBasis(50f);
root_child0.setStyleHeight(20f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1);
root_child1.setStyleHeight(10);
root_child1.setFlexGrow(1f);
root_child1.setStyleHeight(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setFlexGrow(1);
root_child2.setStyleHeight(10);
root_child2.setFlexGrow(1f);
root_child2.setStyleHeight(10f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(60, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(60f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(60, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(60f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(80, root_child2.getLayoutY(), 0.0f);
assertEquals(100, root_child2.getLayoutWidth(), 0.0f);
assertEquals(20, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(80f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(60, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(60f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(60, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(60f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(80, root_child2.getLayoutY(), 0.0f);
assertEquals(100, root_child2.getLayoutWidth(), 0.0f);
assertEquals(20, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(80f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child2.getLayoutHeight(), 0.0f);
}
@Test
public void test_flex_grow_shrink_at_most() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root.addChildAt(root_child0, 0);
final CSSNode root_child0_child0 = new CSSNode();
root_child0_child0.setFlexGrow(1);
root_child0_child0.setFlexShrink(1);
root_child0_child0.setFlexGrow(1f);
root_child0_child0.setFlexShrink(1f);
root_child0.addChildAt(root_child0_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(0, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(0, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f);
}
}

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
package com.facebook.csslayout;
@@ -51,82 +20,82 @@ public class CSSLayoutFlexWrapTest {
public void test_wrap_column() {
final CSSNode root = new CSSNode();
root.setWrap(CSSWrap.WRAP);
root.setStyleHeight(100);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(30);
root_child0.setStyleHeight(30);
root_child0.setStyleWidth(30f);
root_child0.setStyleHeight(30f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setStyleWidth(30);
root_child1.setStyleHeight(30);
root_child1.setStyleWidth(30f);
root_child1.setStyleHeight(30f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleWidth(30);
root_child2.setStyleHeight(30);
root_child2.setStyleWidth(30f);
root_child2.setStyleHeight(30f);
root.addChildAt(root_child2, 2);
final CSSNode root_child3 = new CSSNode();
root_child3.setStyleWidth(30);
root_child3.setStyleHeight(30);
root_child3.setStyleWidth(30f);
root_child3.setStyleHeight(30f);
root.addChildAt(root_child3, 3);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(60, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(60f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(30, root_child0.getLayoutWidth(), 0.0f);
assertEquals(30, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(30, root_child1.getLayoutY(), 0.0f);
assertEquals(30, root_child1.getLayoutWidth(), 0.0f);
assertEquals(30, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(30f, root_child1.getLayoutY(), 0.0f);
assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(60, root_child2.getLayoutY(), 0.0f);
assertEquals(30, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(60f, root_child2.getLayoutY(), 0.0f);
assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(30, root_child3.getLayoutX(), 0.0f);
assertEquals(0, root_child3.getLayoutY(), 0.0f);
assertEquals(30, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30, root_child3.getLayoutHeight(), 0.0f);
assertEquals(30f, root_child3.getLayoutX(), 0.0f);
assertEquals(0f, root_child3.getLayoutY(), 0.0f);
assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(60, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(60f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(30, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(30, root_child0.getLayoutWidth(), 0.0f);
assertEquals(30, root_child0.getLayoutHeight(), 0.0f);
assertEquals(30f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(30, root_child1.getLayoutX(), 0.0f);
assertEquals(30, root_child1.getLayoutY(), 0.0f);
assertEquals(30, root_child1.getLayoutWidth(), 0.0f);
assertEquals(30, root_child1.getLayoutHeight(), 0.0f);
assertEquals(30f, root_child1.getLayoutX(), 0.0f);
assertEquals(30f, root_child1.getLayoutY(), 0.0f);
assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(30, root_child2.getLayoutX(), 0.0f);
assertEquals(60, root_child2.getLayoutY(), 0.0f);
assertEquals(30, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30, root_child2.getLayoutHeight(), 0.0f);
assertEquals(30f, root_child2.getLayoutX(), 0.0f);
assertEquals(60f, root_child2.getLayoutY(), 0.0f);
assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0, root_child3.getLayoutX(), 0.0f);
assertEquals(0, root_child3.getLayoutY(), 0.0f);
assertEquals(30, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30, root_child3.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child3.getLayoutX(), 0.0f);
assertEquals(0f, root_child3.getLayoutY(), 0.0f);
assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
}
@Test
@@ -134,82 +103,82 @@ public class CSSLayoutFlexWrapTest {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setWrap(CSSWrap.WRAP);
root.setStyleWidth(100);
root.setStyleWidth(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(30);
root_child0.setStyleHeight(30);
root_child0.setStyleWidth(30f);
root_child0.setStyleHeight(30f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setStyleWidth(30);
root_child1.setStyleHeight(30);
root_child1.setStyleWidth(30f);
root_child1.setStyleHeight(30f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleWidth(30);
root_child2.setStyleHeight(30);
root_child2.setStyleWidth(30f);
root_child2.setStyleHeight(30f);
root.addChildAt(root_child2, 2);
final CSSNode root_child3 = new CSSNode();
root_child3.setStyleWidth(30);
root_child3.setStyleHeight(30);
root_child3.setStyleWidth(30f);
root_child3.setStyleHeight(30f);
root.addChildAt(root_child3, 3);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(60, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(60f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(30, root_child0.getLayoutWidth(), 0.0f);
assertEquals(30, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(30, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(30, root_child1.getLayoutWidth(), 0.0f);
assertEquals(30, root_child1.getLayoutHeight(), 0.0f);
assertEquals(30f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(60, root_child2.getLayoutX(), 0.0f);
assertEquals(0, root_child2.getLayoutY(), 0.0f);
assertEquals(30, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30, root_child2.getLayoutHeight(), 0.0f);
assertEquals(60f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0, root_child3.getLayoutX(), 0.0f);
assertEquals(30, root_child3.getLayoutY(), 0.0f);
assertEquals(30, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30, root_child3.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child3.getLayoutX(), 0.0f);
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(60, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(60f, root.getLayoutHeight(), 0.0f);
assertEquals(70, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(30, root_child0.getLayoutWidth(), 0.0f);
assertEquals(30, root_child0.getLayoutHeight(), 0.0f);
assertEquals(70f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(40, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(30, root_child1.getLayoutWidth(), 0.0f);
assertEquals(30, root_child1.getLayoutHeight(), 0.0f);
assertEquals(40f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(10, root_child2.getLayoutX(), 0.0f);
assertEquals(0, root_child2.getLayoutY(), 0.0f);
assertEquals(30, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30, root_child2.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(70, root_child3.getLayoutX(), 0.0f);
assertEquals(30, root_child3.getLayoutY(), 0.0f);
assertEquals(30, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30, root_child3.getLayoutHeight(), 0.0f);
assertEquals(70f, root_child3.getLayoutX(), 0.0f);
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
}
@Test
@@ -218,82 +187,82 @@ public class CSSLayoutFlexWrapTest {
root.setFlexDirection(CSSFlexDirection.ROW);
root.setAlignItems(CSSAlign.FLEX_END);
root.setWrap(CSSWrap.WRAP);
root.setStyleWidth(100);
root.setStyleWidth(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(30);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(30f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setStyleWidth(30);
root_child1.setStyleHeight(20);
root_child1.setStyleWidth(30f);
root_child1.setStyleHeight(20f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleWidth(30);
root_child2.setStyleHeight(30);
root_child2.setStyleWidth(30f);
root_child2.setStyleHeight(30f);
root.addChildAt(root_child2, 2);
final CSSNode root_child3 = new CSSNode();
root_child3.setStyleWidth(30);
root_child3.setStyleHeight(30);
root_child3.setStyleWidth(30f);
root_child3.setStyleHeight(30f);
root.addChildAt(root_child3, 3);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(60, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(60f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(20, root_child0.getLayoutY(), 0.0f);
assertEquals(30, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(20f, root_child0.getLayoutY(), 0.0f);
assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(30, root_child1.getLayoutX(), 0.0f);
assertEquals(10, root_child1.getLayoutY(), 0.0f);
assertEquals(30, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20, root_child1.getLayoutHeight(), 0.0f);
assertEquals(30f, root_child1.getLayoutX(), 0.0f);
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(60, root_child2.getLayoutX(), 0.0f);
assertEquals(0, root_child2.getLayoutY(), 0.0f);
assertEquals(30, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30, root_child2.getLayoutHeight(), 0.0f);
assertEquals(60f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0, root_child3.getLayoutX(), 0.0f);
assertEquals(30, root_child3.getLayoutY(), 0.0f);
assertEquals(30, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30, root_child3.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child3.getLayoutX(), 0.0f);
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(60, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(60f, root.getLayoutHeight(), 0.0f);
assertEquals(70, root_child0.getLayoutX(), 0.0f);
assertEquals(20, root_child0.getLayoutY(), 0.0f);
assertEquals(30, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(70f, root_child0.getLayoutX(), 0.0f);
assertEquals(20f, root_child0.getLayoutY(), 0.0f);
assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(40, root_child1.getLayoutX(), 0.0f);
assertEquals(10, root_child1.getLayoutY(), 0.0f);
assertEquals(30, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20, root_child1.getLayoutHeight(), 0.0f);
assertEquals(40f, root_child1.getLayoutX(), 0.0f);
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(10, root_child2.getLayoutX(), 0.0f);
assertEquals(0, root_child2.getLayoutY(), 0.0f);
assertEquals(30, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30, root_child2.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(70, root_child3.getLayoutX(), 0.0f);
assertEquals(30, root_child3.getLayoutY(), 0.0f);
assertEquals(30, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30, root_child3.getLayoutHeight(), 0.0f);
assertEquals(70f, root_child3.getLayoutX(), 0.0f);
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
}
@Test
@@ -302,82 +271,82 @@ public class CSSLayoutFlexWrapTest {
root.setFlexDirection(CSSFlexDirection.ROW);
root.setAlignItems(CSSAlign.CENTER);
root.setWrap(CSSWrap.WRAP);
root.setStyleWidth(100);
root.setStyleWidth(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(30);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(30f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setStyleWidth(30);
root_child1.setStyleHeight(20);
root_child1.setStyleWidth(30f);
root_child1.setStyleHeight(20f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleWidth(30);
root_child2.setStyleHeight(30);
root_child2.setStyleWidth(30f);
root_child2.setStyleHeight(30f);
root.addChildAt(root_child2, 2);
final CSSNode root_child3 = new CSSNode();
root_child3.setStyleWidth(30);
root_child3.setStyleHeight(30);
root_child3.setStyleWidth(30f);
root_child3.setStyleHeight(30f);
root.addChildAt(root_child3, 3);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(60, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(60f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(30, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(30, root_child1.getLayoutX(), 0.0f);
assertEquals(5, root_child1.getLayoutY(), 0.0f);
assertEquals(30, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20, root_child1.getLayoutHeight(), 0.0f);
assertEquals(30f, root_child1.getLayoutX(), 0.0f);
assertEquals(5f, root_child1.getLayoutY(), 0.0f);
assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(60, root_child2.getLayoutX(), 0.0f);
assertEquals(0, root_child2.getLayoutY(), 0.0f);
assertEquals(30, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30, root_child2.getLayoutHeight(), 0.0f);
assertEquals(60f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0, root_child3.getLayoutX(), 0.0f);
assertEquals(30, root_child3.getLayoutY(), 0.0f);
assertEquals(30, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30, root_child3.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child3.getLayoutX(), 0.0f);
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(60, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(60f, root.getLayoutHeight(), 0.0f);
assertEquals(70, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(30, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(70f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(40, root_child1.getLayoutX(), 0.0f);
assertEquals(5, root_child1.getLayoutY(), 0.0f);
assertEquals(30, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20, root_child1.getLayoutHeight(), 0.0f);
assertEquals(40f, root_child1.getLayoutX(), 0.0f);
assertEquals(5f, root_child1.getLayoutY(), 0.0f);
assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(10, root_child2.getLayoutX(), 0.0f);
assertEquals(0, root_child2.getLayoutY(), 0.0f);
assertEquals(30, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30, root_child2.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(70, root_child3.getLayoutX(), 0.0f);
assertEquals(30, root_child3.getLayoutY(), 0.0f);
assertEquals(30, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30, root_child3.getLayoutHeight(), 0.0f);
assertEquals(70f, root_child3.getLayoutX(), 0.0f);
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
}
}

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
package com.facebook.csslayout;
@@ -65,75 +20,75 @@ public class CSSLayoutMarginTest {
public void test_margin_start() {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setMargin(Spacing.START, 10);
root_child0.setStyleWidth(10);
root_child0.setMargin(Spacing.START, 10f);
root_child0.setStyleWidth(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(80, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(80f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_margin_top() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setMargin(Spacing.TOP, 10);
root_child0.setStyleHeight(10);
root_child0.setMargin(Spacing.TOP, 10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
@@ -141,327 +96,327 @@ public class CSSLayoutMarginTest {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setJustifyContent(CSSJustify.FLEX_END);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setMargin(Spacing.END, 10);
root_child0.setStyleWidth(10);
root_child0.setMargin(Spacing.END, 10f);
root_child0.setStyleWidth(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(80, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(80f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_margin_bottom() {
final CSSNode root = new CSSNode();
root.setJustifyContent(CSSJustify.FLEX_END);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setMargin(Spacing.BOTTOM, 10);
root_child0.setStyleHeight(10);
root_child0.setMargin(Spacing.BOTTOM, 10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(80, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(80f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(80, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(80f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_margin_and_flex_row() {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1);
root_child0.setMargin(Spacing.START, 10);
root_child0.setFlexGrow(1f);
root_child0.setMargin(Spacing.START, 10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(90, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(90f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(90, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(90f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_margin_and_flex_column() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1);
root_child0.setMargin(Spacing.TOP, 10);
root_child0.setFlexGrow(1f);
root_child0.setMargin(Spacing.TOP, 10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(90, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(90f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(90, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(90f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_margin_and_stretch_row() {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1);
root_child0.setMargin(Spacing.TOP, 10);
root_child0.setFlexGrow(1f);
root_child0.setMargin(Spacing.TOP, 10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(90, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(90f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(90, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(90f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_margin_and_stretch_column() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1);
root_child0.setMargin(Spacing.START, 10);
root_child0.setFlexGrow(1f);
root_child0.setMargin(Spacing.START, 10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(90, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(90f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(90, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(90f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_margin_with_sibling_row() {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1);
root_child0.setFlexGrow(1f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1);
root_child1.setFlexGrow(1f);
root.addChildAt(root_child1, 1);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100, root_child1.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(50, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
}
@Test
public void test_margin_with_sibling_column() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1);
root_child0.setFlexGrow(1f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1);
root_child1.setFlexGrow(1f);
root.addChildAt(root_child1, 1);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(50, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(50, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
}
}

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
package com.facebook.csslayout;
@@ -66,429 +19,429 @@ public class CSSLayoutMinMaxDimensionTest {
@Test
public void test_max_width() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleMaxWidth(50);
root_child0.setStyleHeight(10);
root_child0.setStyleMaxWidth(50f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(50, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_max_height() {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(10);
root_child0.setStyleMaxHeight(50);
root_child0.setStyleWidth(10f);
root_child0.setStyleMaxHeight(50f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(90, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50, root_child0.getLayoutHeight(), 0.0f);
assertEquals(90f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_min_height() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1);
root_child0.setStyleMinHeight(60);
root_child0.setFlexGrow(1f);
root_child0.setStyleMinHeight(60f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1);
root_child1.setFlexGrow(1f);
root.addChildAt(root_child1, 1);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(80, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(80f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(80, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(80f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
}
@Test
public void test_min_width() {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1);
root_child0.setStyleMinWidth(60);
root_child0.setFlexGrow(1f);
root_child0.setStyleMinWidth(60f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1);
root_child1.setFlexGrow(1f);
root.addChildAt(root_child1, 1);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(80, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(80f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(80, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(20, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100, root_child1.getLayoutHeight(), 0.0f);
assertEquals(80f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(20f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(20, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(80, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(20f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(80f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(20, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(20f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
}
@Test
public void test_justify_content_min_max() {
final CSSNode root = new CSSNode();
root.setJustifyContent(CSSJustify.CENTER);
root.setStyleWidth(100);
root.setStyleMinHeight(100);
root.setStyleMaxHeight(200);
root.setStyleWidth(100f);
root.setStyleMinHeight(100f);
root.setStyleMaxHeight(200f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(60);
root_child0.setStyleHeight(60);
root_child0.setStyleWidth(60f);
root_child0.setStyleHeight(60f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(20, root_child0.getLayoutY(), 0.0f);
assertEquals(60, root_child0.getLayoutWidth(), 0.0f);
assertEquals(60, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(20f, root_child0.getLayoutY(), 0.0f);
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(60f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(40, root_child0.getLayoutX(), 0.0f);
assertEquals(20, root_child0.getLayoutY(), 0.0f);
assertEquals(60, root_child0.getLayoutWidth(), 0.0f);
assertEquals(60, root_child0.getLayoutHeight(), 0.0f);
assertEquals(40f, root_child0.getLayoutX(), 0.0f);
assertEquals(20f, root_child0.getLayoutY(), 0.0f);
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(60f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_align_items_min_max() {
final CSSNode root = new CSSNode();
root.setAlignItems(CSSAlign.CENTER);
root.setStyleMinWidth(100);
root.setStyleMaxWidth(200);
root.setStyleHeight(100);
root.setStyleMinWidth(100f);
root.setStyleMaxWidth(200f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(60);
root_child0.setStyleHeight(60);
root_child0.setStyleWidth(60f);
root_child0.setStyleHeight(60f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(20, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(60, root_child0.getLayoutWidth(), 0.0f);
assertEquals(60, root_child0.getLayoutHeight(), 0.0f);
assertEquals(20f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(60f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(20, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(60, root_child0.getLayoutWidth(), 0.0f);
assertEquals(60, root_child0.getLayoutHeight(), 0.0f);
assertEquals(20f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(60f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_justify_content_overflow_min_max() {
final CSSNode root = new CSSNode();
root.setJustifyContent(CSSJustify.CENTER);
root.setStyleMinHeight(100);
root.setStyleMaxHeight(110);
root.setStyleMinHeight(100f);
root.setStyleMaxHeight(110f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(50);
root_child0.setStyleHeight(50);
root_child0.setStyleWidth(50f);
root_child0.setStyleHeight(50f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setStyleWidth(50);
root_child1.setStyleHeight(50);
root_child1.setStyleWidth(50f);
root_child1.setStyleHeight(50f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleWidth(50);
root_child2.setStyleHeight(50);
root_child2.setStyleWidth(50f);
root_child2.setStyleHeight(50f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(50, root.getLayoutWidth(), 0.0f);
assertEquals(110, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(50f, root.getLayoutWidth(), 0.0f);
assertEquals(110f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(-20, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(-20f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(30, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(30f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(80, root_child2.getLayoutY(), 0.0f);
assertEquals(50, root_child2.getLayoutWidth(), 0.0f);
assertEquals(50, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(80f, root_child2.getLayoutY(), 0.0f);
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(50, root.getLayoutWidth(), 0.0f);
assertEquals(110, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(50f, root.getLayoutWidth(), 0.0f);
assertEquals(110f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(-20, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(-20f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(30, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(30f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(80, root_child2.getLayoutY(), 0.0f);
assertEquals(50, root_child2.getLayoutWidth(), 0.0f);
assertEquals(50, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(80f, root_child2.getLayoutY(), 0.0f);
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
}
@Test
public void test_flex_grow_within_max_width() {
final CSSNode root = new CSSNode();
root.setStyleWidth(200);
root.setStyleHeight(100);
root.setStyleWidth(200f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexDirection(CSSFlexDirection.ROW);
root_child0.setStyleMaxWidth(100);
root_child0.setStyleMaxWidth(100f);
root.addChildAt(root_child0, 0);
final CSSNode root_child0_child0 = new CSSNode();
root_child0_child0.setFlexGrow(1);
root_child0_child0.setStyleHeight(20);
root_child0_child0.setFlexGrow(1f);
root_child0_child0.setStyleHeight(20f);
root_child0.addChildAt(root_child0_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(200, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(200f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(20, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(20, root_child0_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(200, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(200f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(100, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(20, root_child0.getLayoutHeight(), 0.0f);
assertEquals(100f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(20, root_child0_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_flex_grow_within_constrained_max_width() {
final CSSNode root = new CSSNode();
root.setStyleWidth(200);
root.setStyleHeight(100);
root.setStyleWidth(200f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexDirection(CSSFlexDirection.ROW);
root_child0.setStyleMaxWidth(300);
root_child0.setStyleMaxWidth(300f);
root.addChildAt(root_child0, 0);
final CSSNode root_child0_child0 = new CSSNode();
root_child0_child0.setFlexGrow(1);
root_child0_child0.setStyleHeight(20);
root_child0_child0.setFlexGrow(1f);
root_child0_child0.setStyleHeight(20f);
root_child0.addChildAt(root_child0_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(200, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(200f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(200, root_child0.getLayoutWidth(), 0.0f);
assertEquals(20, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(200f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(200, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(20, root_child0_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(200, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(200f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(200, root_child0.getLayoutWidth(), 0.0f);
assertEquals(20, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(200f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(200, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(20, root_child0_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
}
}

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
package com.facebook.csslayout;
@@ -48,18 +26,18 @@ public class CSSLayoutPaddingTest {
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(20, root.getLayoutWidth(), 0.0f);
assertEquals(20, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(20f, root.getLayoutWidth(), 0.0f);
assertEquals(20f, root.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(20, root.getLayoutWidth(), 0.0f);
assertEquals(20, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(20f, root.getLayoutWidth(), 0.0f);
assertEquals(20f, root.getLayoutHeight(), 0.0f);
}
@Test
@@ -71,34 +49,34 @@ public class CSSLayoutPaddingTest {
root.setPadding(Spacing.BOTTOM, 10);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(10);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(30, root.getLayoutWidth(), 0.0f);
assertEquals(30, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(30f, root.getLayoutWidth(), 0.0f);
assertEquals(30f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(30, root.getLayoutWidth(), 0.0f);
assertEquals(30, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(30f, root.getLayoutWidth(), 0.0f);
assertEquals(30f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
@@ -108,38 +86,38 @@ public class CSSLayoutPaddingTest {
root.setPadding(Spacing.TOP, 10);
root.setPadding(Spacing.RIGHT, 10);
root.setPadding(Spacing.BOTTOM, 10);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1);
root_child0.setStyleWidth(10);
root_child0.setFlexGrow(1f);
root_child0.setStyleWidth(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(80, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80, root_child0.getLayoutHeight(), 0.0f);
assertEquals(80f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
@@ -149,37 +127,37 @@ public class CSSLayoutPaddingTest {
root.setPadding(Spacing.TOP, 10);
root.setPadding(Spacing.RIGHT, 10);
root.setPadding(Spacing.BOTTOM, 10);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleHeight(10);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(80, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(80f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(80, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(80f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
@@ -190,38 +168,38 @@ public class CSSLayoutPaddingTest {
root.setPadding(Spacing.START, 10);
root.setPadding(Spacing.END, 20);
root.setPadding(Spacing.BOTTOM, 20);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(10);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(40, root_child0.getLayoutX(), 0.0f);
assertEquals(35, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(40f, root_child0.getLayoutX(), 0.0f);
assertEquals(35f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(50, root_child0.getLayoutX(), 0.0f);
assertEquals(35, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
assertEquals(35f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
}

View File

@@ -0,0 +1,795 @@
/**
* 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
package com.facebook.csslayout;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class CSSLayoutRoundingTest {
@Test
public void test_rounding_flex_basis_flex_grow_row_width_of_100() {
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setFlexGrow(1f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(33f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(33f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(34f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(67f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(33f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(67f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(33f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(33f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(34f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(33f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false);
}
@Test
public void test_rounding_flex_basis_flex_grow_row_prime_number_width() {
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setStyleWidth(113f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setFlexGrow(1f);
root.addChildAt(root_child2, 2);
final CSSNode root_child3 = new CSSNode();
root_child3.setFlexGrow(1f);
root.addChildAt(root_child3, 3);
final CSSNode root_child4 = new CSSNode();
root_child4.setFlexGrow(1f);
root.addChildAt(root_child4, 4);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(113f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(23f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(23f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(22f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(45f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(23f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(68f, root_child3.getLayoutX(), 0.0f);
assertEquals(0f, root_child3.getLayoutY(), 0.0f);
assertEquals(22f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child3.getLayoutHeight(), 0.0f);
assertEquals(90f, root_child4.getLayoutX(), 0.0f);
assertEquals(0f, root_child4.getLayoutY(), 0.0f);
assertEquals(23f, root_child4.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child4.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(113f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(90f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(23f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(68f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(22f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(45f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(23f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(23f, root_child3.getLayoutX(), 0.0f);
assertEquals(0f, root_child3.getLayoutY(), 0.0f);
assertEquals(22f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child3.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child4.getLayoutX(), 0.0f);
assertEquals(0f, root_child4.getLayoutY(), 0.0f);
assertEquals(23f, root_child4.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child4.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false);
}
@Test
public void test_rounding_flex_basis_flex_shrink_row() {
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setStyleWidth(101f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexShrink(1f);
root_child0.setFlexBasis(100f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexBasis(25f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setFlexBasis(25f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(101f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(51f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(51f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(25f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(76f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(25f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(101f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(51f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(25f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(25f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(25f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false);
}
@Test
public void test_rounding_flex_basis_overrides_main_size() {
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode();
root.setStyleWidth(100f);
root.setStyleHeight(113f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1f);
root_child0.setFlexBasis(50f);
root_child0.setStyleHeight(20f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1f);
root_child1.setStyleHeight(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setFlexGrow(1f);
root_child2.setStyleHeight(10f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(113f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(64f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(64f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(113f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(64f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(64f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false);
}
@Test
public void test_rounding_total_fractial() {
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode();
root.setStyleWidth(87.4f);
root.setStyleHeight(113.4f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(0.7f);
root_child0.setFlexBasis(50.3f);
root_child0.setStyleHeight(20.3f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1.6f);
root_child1.setStyleHeight(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setFlexGrow(1.1f);
root_child2.setStyleHeight(10.7f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(87f, root.getLayoutWidth(), 0.0f);
assertEquals(113f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(87f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(59f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(59f, root_child1.getLayoutY(), 0.0f);
assertEquals(87f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
assertEquals(87f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(87f, root.getLayoutWidth(), 0.0f);
assertEquals(113f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(87f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(59f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(59f, root_child1.getLayoutY(), 0.0f);
assertEquals(87f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
assertEquals(87f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false);
}
@Test
public void test_rounding_total_fractial_nested() {
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode();
root.setStyleWidth(87.4f);
root.setStyleHeight(113.4f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(0.7f);
root_child0.setFlexBasis(50.3f);
root_child0.setStyleHeight(20.3f);
root.addChildAt(root_child0, 0);
final CSSNode root_child0_child0 = new CSSNode();
root_child0_child0.setFlexGrow(1f);
root_child0_child0.setFlexBasis(0.3f);
root_child0_child0.setPosition(Spacing.BOTTOM, 13.3f);
root_child0_child0.setStyleHeight(9.9f);
root_child0.addChildAt(root_child0_child0, 0);
final CSSNode root_child0_child1 = new CSSNode();
root_child0_child1.setFlexGrow(4f);
root_child0_child1.setFlexBasis(0.3f);
root_child0_child1.setPosition(Spacing.TOP, 13.3f);
root_child0_child1.setStyleHeight(1.1f);
root_child0.addChildAt(root_child0_child1, 1);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1.6f);
root_child1.setStyleHeight(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setFlexGrow(1.1f);
root_child2.setStyleHeight(10.7f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(87f, root.getLayoutWidth(), 0.0f);
assertEquals(113f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(87f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(59f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(-13f, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(87f, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(12f, root_child0_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
assertEquals(25f, root_child0_child1.getLayoutY(), 0.0f);
assertEquals(87f, root_child0_child1.getLayoutWidth(), 0.0f);
assertEquals(47f, root_child0_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(59f, root_child1.getLayoutY(), 0.0f);
assertEquals(87f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
assertEquals(87f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(87f, root.getLayoutWidth(), 0.0f);
assertEquals(113f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(87f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(59f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(-13f, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(87f, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(12f, root_child0_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
assertEquals(25f, root_child0_child1.getLayoutY(), 0.0f);
assertEquals(87f, root_child0_child1.getLayoutWidth(), 0.0f);
assertEquals(47f, root_child0_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(59f, root_child1.getLayoutY(), 0.0f);
assertEquals(87f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
assertEquals(87f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false);
}
@Test
public void test_rounding_fractial_input_1() {
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode();
root.setStyleWidth(100f);
root.setStyleHeight(113.4f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1f);
root_child0.setFlexBasis(50f);
root_child0.setStyleHeight(20f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1f);
root_child1.setStyleHeight(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setFlexGrow(1f);
root_child2.setStyleHeight(10f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(113f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(64f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(64f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(113f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(64f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(64f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false);
}
@Test
public void test_rounding_fractial_input_2() {
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode();
root.setStyleWidth(100f);
root.setStyleHeight(113.6f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1f);
root_child0.setFlexBasis(50f);
root_child0.setStyleHeight(20f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1f);
root_child1.setStyleHeight(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setFlexGrow(1f);
root_child2.setStyleHeight(10f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(114f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(65f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(65f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(114f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(65f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(65f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false);
}
@Test
public void test_rounding_fractial_input_3() {
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode();
root.setPosition(Spacing.TOP, 0.3f);
root.setStyleWidth(100f);
root.setStyleHeight(113.4f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1f);
root_child0.setFlexBasis(50f);
root_child0.setStyleHeight(20f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1f);
root_child1.setStyleHeight(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setFlexGrow(1f);
root_child2.setStyleHeight(10f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(114f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(64f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(64f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(114f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(64f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(64f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false);
}
@Test
public void test_rounding_fractial_input_4() {
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode();
root.setPosition(Spacing.TOP, 0.7f);
root.setStyleWidth(100f);
root.setStyleHeight(113.4f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1f);
root_child0.setFlexBasis(50f);
root_child0.setStyleHeight(20f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1f);
root_child1.setStyleHeight(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setFlexGrow(1f);
root_child2.setStyleHeight(10f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(1f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(113f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(64f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(64f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(1f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(113f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(64f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(64f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false);
}
}

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
#include <CSSLayout/CSSLayout.h>
#include <gtest/gtest.h>

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
#include <CSSLayout/CSSLayout.h>
#include <gtest/gtest.h>

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
#include <CSSLayout/CSSLayout.h>
#include <gtest/gtest.h>

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
#include <CSSLayout/CSSLayout.h>
#include <gtest/gtest.h>

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
#include <CSSLayout/CSSLayout.h>
#include <gtest/gtest.h>

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
#include <CSSLayout/CSSLayout.h>
#include <gtest/gtest.h>

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
#include <CSSLayout/CSSLayout.h>
#include <gtest/gtest.h>

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
#include <CSSLayout/CSSLayout.h>
#include <gtest/gtest.h>

View File

@@ -7,70 +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="justify_content_row_flex_start" style="width: 102px; height: 102px; flex-direction: row; justify-content: flex-start;">
<div style="width: 10px;"></div>
<div style="width: 10px;"></div>
<div style="width: 10px;"></div>
</div>
<div id="justify_content_row_flex_end" style="width: 102px; height: 102px; flex-direction: row; justify-content: flex-end;">
<div style="width: 10px;"></div>
<div style="width: 10px;"></div>
<div style="width: 10px;"></div>
</div>
<div id="justify_content_row_center" style="width: 102px; height: 102px; flex-direction: row; justify-content: center;">
<div style="width: 10px;"></div>
<div style="width: 10px;"></div>
<div style="width: 10px;"></div>
</div>
<div id="justify_content_row_space_between" style="width: 102px; height: 102px; flex-direction: row; justify-content: space-between;">
<div style="width: 10px;"></div>
<div style="width: 10px;"></div>
<div style="width: 10px;"></div>
</div>
<div id="justify_content_row_space_around" style="width: 102px; height: 102px; flex-direction: row; justify-content: space-around;">
<div style="width: 10px;"></div>
<div style="width: 10px;"></div>
<div style="width: 10px;"></div>
</div>
<div id="justify_content_column_flex_start" style="width: 102px; height: 102px; justify-content: flex-start;">
<div style="height: 10px;"></div>
<div style="heigth: 10px;"></div>
<div style="height: 10px;"></div>
</div>
<div id="justify_content_column_flex_end" style="width: 102px; height: 102px; justify-content: flex-end;">
<div style="height: 10px;"></div>
<div style="height: 10px;"></div>
<div style="height: 10px;"></div>
</div>
<div id="justify_content_column_center" style="width: 102px; height: 102px; justify-content: center;">
<div style="height: 10px;"></div>
<div style="height: 10px;"></div>
<div style="height: 10px;"></div>
</div>
<div id="justify_content_column_space_between" style="width: 102px; height: 102px; justify-content: space-between;">
<div style="height: 10px;"></div>
<div style="height: 10px;"></div>
<div style="height: 10px;"></div>
</div>
<div id="justify_content_column_space_around" style="width: 102px; height: 102px; justify-content: space-around;">
<div style="height: 10px;"></div>
<div style="height: 10px;"></div>
<div style="height: 10px;"></div>
</div>
*
*/
// @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutJustifyContentTest.html
#include <CSSLayout/CSSLayout.h>
#include <gtest/gtest.h>

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
#include <CSSLayout/CSSLayout.h>
#include <gtest/gtest.h>

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
#include <CSSLayout/CSSLayout.h>
#include <gtest/gtest.h>

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
#include <CSSLayout/CSSLayout.h>
#include <gtest/gtest.h>

View File

@@ -10,19 +10,9 @@
#include <CSSLayout/CSSLayout.h>
#include <gtest/gtest.h>
class CSSLayoutRelayoutTest : public ::testing::Test {
TEST(CSSLayoutTest, dont_cache_computed_flex_basis_between_layouts) {
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureWebFlexBasis, true);
protected:
virtual void SetUp() {
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureWebFlexBasis, true);
}
virtual void TearDown() {
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureWebFlexBasis, false);
}
};
TEST_F(CSSLayoutRelayoutTest, dont_cache_computed_flex_basis_between_layouts) {
const CSSNodeRef root = CSSNodeNew();
const CSSNodeRef root_child0 = CSSNodeNew();
@@ -36,4 +26,6 @@ TEST_F(CSSLayoutRelayoutTest, dont_cache_computed_flex_basis_between_layouts) {
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetHeight(root_child0));
CSSNodeFreeRecursive(root);
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureWebFlexBasis, false);
}

View File

@@ -0,0 +1,73 @@
/**
* 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.
*/
#include <CSSLayout/CSSLayout.h>
#include <gtest/gtest.h>
static CSSSize _measureFloor(CSSNodeRef node,
float width,
CSSMeasureMode widthMode,
float height,
CSSMeasureMode heightMode) {
return CSSSize{
width = 10.2,
height = 10.2,
};
}
static CSSSize _measureCeil(CSSNodeRef node,
float width,
CSSMeasureMode widthMode,
float height,
CSSMeasureMode heightMode) {
return CSSSize{
width = 10.5,
height = 10.5,
};
}
TEST(CSSLayoutTest, rounding_feature_with_custom_measure_func_floor) {
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true);
const CSSNodeRef root = CSSNodeNew();
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeSetMeasureFunc(root_child0, _measureFloor);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeFreeRecursive(root);
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false);
}
TEST(CSSLayoutTest, rounding_feature_with_custom_measure_func_ceil) {
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true);
const CSSNodeRef root = CSSNodeNew();
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeSetMeasureFunc(root_child0, _measureCeil);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
ASSERT_FLOAT_EQ(11, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(11, CSSNodeLayoutGetHeight(root_child0));
CSSNodeFreeRecursive(root);
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false);
}

View File

@@ -7,67 +7,14 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
/*
*
<div id="pixel_rounding_flex_basis_flex_grow_row_width_of_100" style="width: 100px; height: 100px; flex-direction: row;">
<div style="flex-grow: 1;"></div>
<div style="flex-grow: 1;"></div>
<div style="flex-grow: 1;"></div>
</div>
<div id="pixel_rounding_flex_basis_flex_grow_row_prime_number_width" style="width: 113px; height: 100px; flex-direction: row;">
<div style="flex-grow: 1;"></div>
<div style="flex-grow: 1;"></div>
<div style="flex-grow: 1;"></div>
<div style="flex-grow: 1;"></div>
<div style="flex-grow: 1;"></div>
</div>
<div id="pixel_rounding_flex_basis_flex_shrink_row" style="width: 101px; height: 100px; flex-direction: row;">
<div style="flex-basis: 100px; flex-shrink: 1;"></div>
<div style="flex-basis: 25px;"></div>
<div style="flex-basis: 25px;"></div>
</div>
<div id="pixel_rounding_flex_basis_overrides_main_size" style="height: 113px; 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="rounding_feature_total_fractial" style="height: 113.4px; width: 87.4px;">
<div style="height: 20.3px; flex-grow:0.7; flex-basis:50.3px;"></div>
<div style="height: 10px; flex-grow:1.6;"></div>
<div style="height: 10.7px; flex-grow:1.1;"></div>
</div>
<div id="rounding_feature_total_fractial_nested" style="height: 113.4px; width: 87.4px;">
<div style="height: 20.3px; flex-grow:0.7; flex-basis:50.3px;">
<div style="bottom: 13.3px; height: 9.9px; flex-grow:1.2; flex-basis:0.3px;"></div>
<div style="top: 13.3px; height: 1.1px; flex-grow:4.2; flex-basis:0.3px;"></div>
</div>
<div style="height: 10px; flex-grow:1.6;"></div>
<div style="height: 10.7px; flex-grow:1.1;"></div>
</div>
*
*/
// @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutRoundingTest.html
#include <CSSLayout/CSSLayout.h>
#include <gtest/gtest.h>
class CSSLayoutFeatureRoundingTest : public ::testing::Test {
TEST(CSSLayoutTest, rounding_flex_basis_flex_grow_row_width_of_100) {
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true);
protected:
virtual void SetUp() {
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true);
}
virtual void TearDown() {
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false);
}
};
TEST_F(CSSLayoutFeatureRoundingTest, pixel_rounding_flex_basis_flex_grow_row_width_of_100) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100);
@@ -129,9 +76,13 @@ TEST_F(CSSLayoutFeatureRoundingTest, pixel_rounding_flex_basis_flex_grow_row_wid
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child2));
CSSNodeFreeRecursive(root);
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false);
}
TEST_F(CSSLayoutFeatureRoundingTest, pixel_rounding_flex_basis_flex_grow_row_prime_number_width) {
TEST(CSSLayoutTest, rounding_flex_basis_flex_grow_row_prime_number_width) {
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true);
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetWidth(root, 113);
@@ -221,9 +172,13 @@ TEST_F(CSSLayoutFeatureRoundingTest, pixel_rounding_flex_basis_flex_grow_row_pri
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child4));
CSSNodeFreeRecursive(root);
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false);
}
TEST_F(CSSLayoutFeatureRoundingTest, pixel_rounding_flex_basis_flex_shrink_row) {
TEST(CSSLayoutTest, rounding_flex_basis_flex_shrink_row) {
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true);
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetWidth(root, 101);
@@ -286,10 +241,13 @@ TEST_F(CSSLayoutFeatureRoundingTest, pixel_rounding_flex_basis_flex_shrink_row)
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child2));
CSSNodeFreeRecursive(root);
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false);
}
TEST(CSSLayoutTest, rounding_flex_basis_overrides_main_size) {
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true);
TEST_F(CSSLayoutFeatureRoundingTest, pixel_roundingflex_basis_overrides_main_size) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 113);
@@ -311,52 +269,232 @@ TEST_F(CSSLayoutFeatureRoundingTest, pixel_roundingflex_basis_overrides_main_siz
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root));
ASSERT_EQ(100, CSSNodeLayoutGetWidth(root));
ASSERT_EQ(113, CSSNodeLayoutGetHeight(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root));
ASSERT_FLOAT_EQ(113, CSSNodeLayoutGetHeight(root));
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
ASSERT_EQ(100, CSSNodeLayoutGetWidth(root_child0));
ASSERT_EQ(64, CSSNodeLayoutGetHeight(root_child0));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(64, CSSNodeLayoutGetHeight(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child1));
ASSERT_EQ(64, CSSNodeLayoutGetTop(root_child1));
ASSERT_EQ(100, CSSNodeLayoutGetWidth(root_child1));
ASSERT_EQ(25, CSSNodeLayoutGetHeight(root_child1));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child1));
ASSERT_FLOAT_EQ(64, CSSNodeLayoutGetTop(root_child1));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(25, CSSNodeLayoutGetHeight(root_child1));
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child2));
ASSERT_EQ(89, CSSNodeLayoutGetTop(root_child2));
ASSERT_EQ(100, CSSNodeLayoutGetWidth(root_child2));
ASSERT_EQ(24, CSSNodeLayoutGetHeight(root_child2));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child2));
ASSERT_FLOAT_EQ(89, CSSNodeLayoutGetTop(root_child2));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(24, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root));
ASSERT_EQ(100, CSSNodeLayoutGetWidth(root));
ASSERT_EQ(113, CSSNodeLayoutGetHeight(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root));
ASSERT_FLOAT_EQ(113, CSSNodeLayoutGetHeight(root));
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
ASSERT_EQ(100, CSSNodeLayoutGetWidth(root_child0));
ASSERT_EQ(64, CSSNodeLayoutGetHeight(root_child0));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(64, CSSNodeLayoutGetHeight(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child1));
ASSERT_EQ(64, CSSNodeLayoutGetTop(root_child1));
ASSERT_EQ(100, CSSNodeLayoutGetWidth(root_child1));
ASSERT_EQ(25, CSSNodeLayoutGetHeight(root_child1));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child1));
ASSERT_FLOAT_EQ(64, CSSNodeLayoutGetTop(root_child1));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(25, CSSNodeLayoutGetHeight(root_child1));
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child2));
ASSERT_EQ(89, CSSNodeLayoutGetTop(root_child2));
ASSERT_EQ(100, CSSNodeLayoutGetWidth(root_child2));
ASSERT_EQ(24, CSSNodeLayoutGetHeight(root_child2));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child2));
ASSERT_FLOAT_EQ(89, CSSNodeLayoutGetTop(root_child2));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(24, CSSNodeLayoutGetHeight(root_child2));
CSSNodeFreeRecursive(root);
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false);
}
TEST_F(CSSLayoutFeatureRoundingTest, flex_basis_overrides_main_size_1) {
TEST(CSSLayoutTest, rounding_total_fractial) {
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true);
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetWidth(root, 87.4f);
CSSNodeStyleSetHeight(root, 113.4f);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0, 0.7f);
CSSNodeStyleSetFlexBasis(root_child0, 50.3f);
CSSNodeStyleSetHeight(root_child0, 20.3f);
CSSNodeInsertChild(root, root_child0, 0);
const CSSNodeRef root_child1 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child1, 1.6f);
CSSNodeStyleSetHeight(root_child1, 10);
CSSNodeInsertChild(root, root_child1, 1);
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child2, 1.1f);
CSSNodeStyleSetHeight(root_child2, 10.7f);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root));
ASSERT_FLOAT_EQ(113, CSSNodeLayoutGetHeight(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(59, CSSNodeLayoutGetHeight(root_child0));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child1));
ASSERT_FLOAT_EQ(59, CSSNodeLayoutGetTop(root_child1));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetHeight(root_child1));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child2));
ASSERT_FLOAT_EQ(89, CSSNodeLayoutGetTop(root_child2));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(24, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root));
ASSERT_FLOAT_EQ(113, CSSNodeLayoutGetHeight(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(59, CSSNodeLayoutGetHeight(root_child0));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child1));
ASSERT_FLOAT_EQ(59, CSSNodeLayoutGetTop(root_child1));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetHeight(root_child1));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child2));
ASSERT_FLOAT_EQ(89, CSSNodeLayoutGetTop(root_child2));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(24, CSSNodeLayoutGetHeight(root_child2));
CSSNodeFreeRecursive(root);
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false);
}
TEST(CSSLayoutTest, rounding_total_fractial_nested) {
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true);
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetWidth(root, 87.4f);
CSSNodeStyleSetHeight(root, 113.4f);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0, 0.7f);
CSSNodeStyleSetFlexBasis(root_child0, 50.3f);
CSSNodeStyleSetHeight(root_child0, 20.3f);
CSSNodeInsertChild(root, root_child0, 0);
const CSSNodeRef root_child0_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0_child0, 1);
CSSNodeStyleSetFlexBasis(root_child0_child0, 0.3f);
CSSNodeStyleSetPosition(root_child0_child0, CSSEdgeBottom, 13.3f);
CSSNodeStyleSetHeight(root_child0_child0, 9.9f);
CSSNodeInsertChild(root_child0, root_child0_child0, 0);
const CSSNodeRef root_child0_child1 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0_child1, 4);
CSSNodeStyleSetFlexBasis(root_child0_child1, 0.3f);
CSSNodeStyleSetPosition(root_child0_child1, CSSEdgeTop, 13.3f);
CSSNodeStyleSetHeight(root_child0_child1, 1.1f);
CSSNodeInsertChild(root_child0, root_child0_child1, 1);
const CSSNodeRef root_child1 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child1, 1.6f);
CSSNodeStyleSetHeight(root_child1, 10);
CSSNodeInsertChild(root, root_child1, 1);
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child2, 1.1f);
CSSNodeStyleSetHeight(root_child2, 10.7f);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root));
ASSERT_FLOAT_EQ(113, CSSNodeLayoutGetHeight(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(59, CSSNodeLayoutGetHeight(root_child0));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child0_child0));
ASSERT_FLOAT_EQ(-13, CSSNodeLayoutGetTop(root_child0_child0));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child0_child0));
ASSERT_FLOAT_EQ(12, CSSNodeLayoutGetHeight(root_child0_child0));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child0_child1));
ASSERT_FLOAT_EQ(25, CSSNodeLayoutGetTop(root_child0_child1));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child0_child1));
ASSERT_FLOAT_EQ(47, CSSNodeLayoutGetHeight(root_child0_child1));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child1));
ASSERT_FLOAT_EQ(59, CSSNodeLayoutGetTop(root_child1));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetHeight(root_child1));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child2));
ASSERT_FLOAT_EQ(89, CSSNodeLayoutGetTop(root_child2));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(24, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root));
ASSERT_FLOAT_EQ(113, CSSNodeLayoutGetHeight(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(59, CSSNodeLayoutGetHeight(root_child0));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child0_child0));
ASSERT_FLOAT_EQ(-13, CSSNodeLayoutGetTop(root_child0_child0));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child0_child0));
ASSERT_FLOAT_EQ(12, CSSNodeLayoutGetHeight(root_child0_child0));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child0_child1));
ASSERT_FLOAT_EQ(25, CSSNodeLayoutGetTop(root_child0_child1));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child0_child1));
ASSERT_FLOAT_EQ(47, CSSNodeLayoutGetHeight(root_child0_child1));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child1));
ASSERT_FLOAT_EQ(59, CSSNodeLayoutGetTop(root_child1));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetHeight(root_child1));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child2));
ASSERT_FLOAT_EQ(89, CSSNodeLayoutGetTop(root_child2));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(24, CSSNodeLayoutGetHeight(root_child2));
CSSNodeFreeRecursive(root);
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false);
}
TEST(CSSLayoutTest, rounding_fractial_input_1) {
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true);
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 113.4f);
@@ -421,9 +559,13 @@ TEST_F(CSSLayoutFeatureRoundingTest, flex_basis_overrides_main_size_1) {
ASSERT_FLOAT_EQ(24, CSSNodeLayoutGetHeight(root_child2));
CSSNodeFreeRecursive(root);
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false);
}
TEST_F(CSSLayoutFeatureRoundingTest, flex_basis_overrides_main_size_2) {
TEST(CSSLayoutTest, rounding_fractial_input_2) {
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true);
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 113.6f);
@@ -488,9 +630,13 @@ TEST_F(CSSLayoutFeatureRoundingTest, flex_basis_overrides_main_size_2) {
ASSERT_FLOAT_EQ(25, CSSNodeLayoutGetHeight(root_child2));
CSSNodeFreeRecursive(root);
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false);
}
TEST_F(CSSLayoutFeatureRoundingTest, flex_basis_overrides_main_size_3) {
TEST(CSSLayoutTest, rounding_fractial_input_3) {
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true);
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetPosition(root, CSSEdgeTop, 0.3f);
CSSNodeStyleSetWidth(root, 100);
@@ -556,9 +702,13 @@ TEST_F(CSSLayoutFeatureRoundingTest, flex_basis_overrides_main_size_3) {
ASSERT_FLOAT_EQ(24, CSSNodeLayoutGetHeight(root_child2));
CSSNodeFreeRecursive(root);
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false);
}
TEST_F(CSSLayoutFeatureRoundingTest, flex_basis_overrides_main_size_4) {
TEST(CSSLayoutTest, rounding_fractial_input_4) {
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true);
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetPosition(root, CSSEdgeTop, 0.7f);
CSSNodeStyleSetWidth(root, 100);
@@ -624,229 +774,6 @@ TEST_F(CSSLayoutFeatureRoundingTest, flex_basis_overrides_main_size_4) {
ASSERT_FLOAT_EQ(24, CSSNodeLayoutGetHeight(root_child2));
CSSNodeFreeRecursive(root);
}
TEST_F(CSSLayoutFeatureRoundingTest, rounding_feature_total_fractial) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetWidth(root, 87.4f);
CSSNodeStyleSetHeight(root, 113.4f);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0, 0.7f);
CSSNodeStyleSetFlexBasis(root_child0, 50.3f);
CSSNodeStyleSetHeight(root_child0, 20.3f);
CSSNodeInsertChild(root, root_child0, 0);
const CSSNodeRef root_child1 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child1, 1.6f);
CSSNodeStyleSetHeight(root_child1, 10);
CSSNodeInsertChild(root, root_child1, 1);
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child2, 1.1f);
CSSNodeStyleSetHeight(root_child2, 10.7f);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root));
ASSERT_FLOAT_EQ(113, CSSNodeLayoutGetHeight(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(59, CSSNodeLayoutGetHeight(root_child0));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child1));
ASSERT_FLOAT_EQ(59, CSSNodeLayoutGetTop(root_child1));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetHeight(root_child1));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child2));
ASSERT_FLOAT_EQ(89, CSSNodeLayoutGetTop(root_child2));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(24, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root));
ASSERT_FLOAT_EQ(113, CSSNodeLayoutGetHeight(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(59, CSSNodeLayoutGetHeight(root_child0));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child1));
ASSERT_FLOAT_EQ(59, CSSNodeLayoutGetTop(root_child1));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetHeight(root_child1));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child2));
ASSERT_FLOAT_EQ(89, CSSNodeLayoutGetTop(root_child2));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(24, CSSNodeLayoutGetHeight(root_child2));
CSSNodeFreeRecursive(root);
}
TEST_F(CSSLayoutFeatureRoundingTest, rounding_feature_total_fractial_nested) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetWidth(root, 87.4f);
CSSNodeStyleSetHeight(root, 113.4f);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0, 0.7f);
CSSNodeStyleSetFlexBasis(root_child0, 50.3f);
CSSNodeStyleSetHeight(root_child0, 20.3f);
CSSNodeInsertChild(root, root_child0, 0);
const CSSNodeRef root_child0_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0_child0, 1.2f);
CSSNodeStyleSetFlexBasis(root_child0_child0, 0.3f);
CSSNodeStyleSetPosition(root_child0_child0, CSSEdgeBottom, 13.3f);
CSSNodeStyleSetHeight(root_child0_child0, 9.9f);
CSSNodeInsertChild(root_child0, root_child0_child0, 0);
const CSSNodeRef root_child0_child1 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0_child1, 4.2f);
CSSNodeStyleSetFlexBasis(root_child0_child1, 0.3f);
CSSNodeStyleSetPosition(root_child0_child1, CSSEdgeTop, 13.3f);
CSSNodeStyleSetHeight(root_child0_child1, 1.1f);
CSSNodeInsertChild(root_child0, root_child0_child1, 1);
const CSSNodeRef root_child1 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child1, 1.6f);
CSSNodeStyleSetHeight(root_child1, 10);
CSSNodeInsertChild(root, root_child1, 1);
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child2, 1.1f);
CSSNodeStyleSetHeight(root_child2, 10.7f);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root));
ASSERT_FLOAT_EQ(113, CSSNodeLayoutGetHeight(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(59, CSSNodeLayoutGetHeight(root_child0));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child0_child0));
ASSERT_FLOAT_EQ(-13, CSSNodeLayoutGetTop(root_child0_child0));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child0_child0));
ASSERT_FLOAT_EQ(13, CSSNodeLayoutGetHeight(root_child0_child0));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child0_child1));
ASSERT_FLOAT_EQ(27, CSSNodeLayoutGetTop(root_child0_child1));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child0_child1));
ASSERT_FLOAT_EQ(45, CSSNodeLayoutGetHeight(root_child0_child1));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child1));
ASSERT_FLOAT_EQ(59, CSSNodeLayoutGetTop(root_child1));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetHeight(root_child1));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child2));
ASSERT_FLOAT_EQ(89, CSSNodeLayoutGetTop(root_child2));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(24, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root));
ASSERT_FLOAT_EQ(113, CSSNodeLayoutGetHeight(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(59, CSSNodeLayoutGetHeight(root_child0));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child0_child0));
ASSERT_FLOAT_EQ(-13, CSSNodeLayoutGetTop(root_child0_child0));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child0_child0));
ASSERT_FLOAT_EQ(13, CSSNodeLayoutGetHeight(root_child0_child0));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child0_child1));
ASSERT_FLOAT_EQ(27, CSSNodeLayoutGetTop(root_child0_child1));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child0_child1));
ASSERT_FLOAT_EQ(45, CSSNodeLayoutGetHeight(root_child0_child1));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child1));
ASSERT_FLOAT_EQ(59, CSSNodeLayoutGetTop(root_child1));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetHeight(root_child1));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root_child2));
ASSERT_FLOAT_EQ(89, CSSNodeLayoutGetTop(root_child2));
ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(24, CSSNodeLayoutGetHeight(root_child2));
CSSNodeFreeRecursive(root);
}
static CSSSize _measureFloor(CSSNodeRef node,
float width,
CSSMeasureMode widthMode,
float height,
CSSMeasureMode heightMode) {
return CSSSize{
width = 10.2,
height = 10.2,
};
}
static CSSSize _measureCeil(CSSNodeRef node,
float width,
CSSMeasureMode widthMode,
float height,
CSSMeasureMode heightMode) {
return CSSSize{
width = 10.5,
height = 10.5,
};
}
TEST_F(CSSLayoutFeatureRoundingTest, rounding_feature_with_custom_measure_func_floor) {
const CSSNodeRef root = CSSNodeNew();
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeSetMeasureFunc(root_child0, _measureFloor);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeFreeRecursive(root);
}
TEST_F(CSSLayoutFeatureRoundingTest, rounding_feature_with_custom_measure_func_ceil) {
const CSSNodeRef root = CSSNodeNew();
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeSetMeasureFunc(root_child0, _measureCeil);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
ASSERT_FLOAT_EQ(11, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(11, CSSNodeLayoutGetHeight(root_child0));
CSSNodeFreeRecursive(root);
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false);
}