diff --git a/csharp/Facebook.CSSLayout/CSSNode.cs b/csharp/Facebook.CSSLayout/CSSNode.cs
index 32fcc4a9..4536f83b 100644
--- a/csharp/Facebook.CSSLayout/CSSNode.cs
+++ b/csharp/Facebook.CSSLayout/CSSNode.cs
@@ -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);
}
diff --git a/csharp/tests/Facebook.CSSLayout/CSSLayoutAbsolutePositionTest.cs b/csharp/tests/Facebook.CSSLayout/CSSLayoutAbsolutePositionTest.cs
index 08c75a6b..5458bbb2 100644
--- a/csharp/tests/Facebook.CSSLayout/CSSLayoutAbsolutePositionTest.cs
+++ b/csharp/tests/Facebook.CSSLayout/CSSLayoutAbsolutePositionTest.cs
@@ -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
- *
-
-
-
-
-
-
-
-
-
-
-
- *
- */
+ // @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);
}
}
diff --git a/csharp/tests/Facebook.CSSLayout/CSSLayoutAlignContentTest.cs b/csharp/tests/Facebook.CSSLayout/CSSLayoutAlignContentTest.cs
index 8542ca47..db761e6e 100644
--- a/csharp/tests/Facebook.CSSLayout/CSSLayoutAlignContentTest.cs
+++ b/csharp/tests/Facebook.CSSLayout/CSSLayoutAlignContentTest.cs
@@ -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
- *
-
-
-
-
-
-
-
- *
- */
+ // @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);
}
}
diff --git a/csharp/tests/Facebook.CSSLayout/CSSLayoutAlignItemsTest.cs b/csharp/tests/Facebook.CSSLayout/CSSLayoutAlignItemsTest.cs
index 852a497d..b3c9db2d 100644
--- a/csharp/tests/Facebook.CSSLayout/CSSLayoutAlignItemsTest.cs
+++ b/csharp/tests/Facebook.CSSLayout/CSSLayoutAlignItemsTest.cs
@@ -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
- *
-
-
-
-
-
-
-
- *
- */
+ // @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);
}
}
diff --git a/csharp/tests/Facebook.CSSLayout/CSSLayoutAlignSelfTest.cs b/csharp/tests/Facebook.CSSLayout/CSSLayoutAlignSelfTest.cs
index 6d65e321..c84b5213 100644
--- a/csharp/tests/Facebook.CSSLayout/CSSLayoutAlignSelfTest.cs
+++ b/csharp/tests/Facebook.CSSLayout/CSSLayoutAlignSelfTest.cs
@@ -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
- *
-
-
-
-
-
-
-
- *
- */
+ // @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);
}
}
diff --git a/csharp/tests/Facebook.CSSLayout/CSSLayoutBorderTest.cs b/csharp/tests/Facebook.CSSLayout/CSSLayoutBorderTest.cs
index e0c6a7f8..756344e0 100644
--- a/csharp/tests/Facebook.CSSLayout/CSSLayoutBorderTest.cs
+++ b/csharp/tests/Facebook.CSSLayout/CSSLayoutBorderTest.cs
@@ -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
- *
-
-
-
-
-
-
-
-
-
-
- *
- */
+ // @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);
}
}
diff --git a/csharp/tests/Facebook.CSSLayout/CSSLayoutFlexDirectionTest.cs b/csharp/tests/Facebook.CSSLayout/CSSLayoutFlexDirectionTest.cs
index 024641d6..a35c5810 100644
--- a/csharp/tests/Facebook.CSSLayout/CSSLayoutFlexDirectionTest.cs
+++ b/csharp/tests/Facebook.CSSLayout/CSSLayoutFlexDirectionTest.cs
@@ -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
- *
-
-
-
-
-
-
-
-
-
-
-
- *
- */
+ // @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);
}
}
diff --git a/csharp/tests/Facebook.CSSLayout/CSSLayoutFlexTest.cs b/csharp/tests/Facebook.CSSLayout/CSSLayoutFlexTest.cs
index 54c3e398..d6afed25 100644
--- a/csharp/tests/Facebook.CSSLayout/CSSLayoutFlexTest.cs
+++ b/csharp/tests/Facebook.CSSLayout/CSSLayoutFlexTest.cs
@@ -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
- *
-
-
-
-
-
-
-
-
-
-
-
-
-
- *
- */
+ // @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);
}
}
diff --git a/csharp/tests/Facebook.CSSLayout/CSSLayoutFlexWrapTest.cs b/csharp/tests/Facebook.CSSLayout/CSSLayoutFlexWrapTest.cs
index a22d2676..db476d02 100644
--- a/csharp/tests/Facebook.CSSLayout/CSSLayoutFlexWrapTest.cs
+++ b/csharp/tests/Facebook.CSSLayout/CSSLayoutFlexWrapTest.cs
@@ -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
- *
-
-
-
-
-
-
-
- *
- */
+ // @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);
}
}
diff --git a/csharp/tests/Facebook.CSSLayout/CSSLayoutJustifyContentTest.cs b/csharp/tests/Facebook.CSSLayout/CSSLayoutJustifyContentTest.cs
index 7055c3a5..87a90240 100644
--- a/csharp/tests/Facebook.CSSLayout/CSSLayoutJustifyContentTest.cs
+++ b/csharp/tests/Facebook.CSSLayout/CSSLayoutJustifyContentTest.cs
@@ -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
- *
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- *
- */
+ // @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutJustifyContentTest.html
using System;
using NUnit.Framework;
@@ -85,65 +22,65 @@ namespace Facebook.CSSLayout
{
CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row;
- root.StyleWidth = 102;
- root.StyleHeight = 102;
+ root.StyleWidth = 102f;
+ root.StyleHeight = 102f;
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(102, root.LayoutWidth);
- Assert.AreEqual(102, root.LayoutHeight);
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(102f, root.LayoutWidth);
+ Assert.AreEqual(102f, root.LayoutHeight);
- Assert.AreEqual(0, root_child0.LayoutX);
- Assert.AreEqual(0, root_child0.LayoutY);
- Assert.AreEqual(10, root_child0.LayoutWidth);
- Assert.AreEqual(102, root_child0.LayoutHeight);
+ Assert.AreEqual(0f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(10f, root_child0.LayoutWidth);
+ Assert.AreEqual(102f, root_child0.LayoutHeight);
- Assert.AreEqual(10, root_child1.LayoutX);
- Assert.AreEqual(0, root_child1.LayoutY);
- Assert.AreEqual(10, root_child1.LayoutWidth);
- Assert.AreEqual(102, root_child1.LayoutHeight);
+ Assert.AreEqual(10f, root_child1.LayoutX);
+ Assert.AreEqual(0f, root_child1.LayoutY);
+ Assert.AreEqual(10f, root_child1.LayoutWidth);
+ Assert.AreEqual(102f, root_child1.LayoutHeight);
- Assert.AreEqual(20, root_child2.LayoutX);
- Assert.AreEqual(0, root_child2.LayoutY);
- Assert.AreEqual(10, root_child2.LayoutWidth);
- Assert.AreEqual(102, root_child2.LayoutHeight);
+ Assert.AreEqual(20f, root_child2.LayoutX);
+ Assert.AreEqual(0f, root_child2.LayoutY);
+ Assert.AreEqual(10f, root_child2.LayoutWidth);
+ Assert.AreEqual(102f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
- Assert.AreEqual(0, root.LayoutX);
- Assert.AreEqual(0, root.LayoutY);
- Assert.AreEqual(102, root.LayoutWidth);
- Assert.AreEqual(102, root.LayoutHeight);
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(102f, root.LayoutWidth);
+ Assert.AreEqual(102f, root.LayoutHeight);
- Assert.AreEqual(92, root_child0.LayoutX);
- Assert.AreEqual(0, root_child0.LayoutY);
- Assert.AreEqual(10, root_child0.LayoutWidth);
- Assert.AreEqual(102, root_child0.LayoutHeight);
+ Assert.AreEqual(92f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(10f, root_child0.LayoutWidth);
+ Assert.AreEqual(102f, root_child0.LayoutHeight);
- Assert.AreEqual(82, root_child1.LayoutX);
- Assert.AreEqual(0, root_child1.LayoutY);
- Assert.AreEqual(10, root_child1.LayoutWidth);
- Assert.AreEqual(102, root_child1.LayoutHeight);
+ Assert.AreEqual(82f, root_child1.LayoutX);
+ Assert.AreEqual(0f, root_child1.LayoutY);
+ Assert.AreEqual(10f, root_child1.LayoutWidth);
+ Assert.AreEqual(102f, root_child1.LayoutHeight);
- Assert.AreEqual(72, root_child2.LayoutX);
- Assert.AreEqual(0, root_child2.LayoutY);
- Assert.AreEqual(10, root_child2.LayoutWidth);
- Assert.AreEqual(102, root_child2.LayoutHeight);
+ Assert.AreEqual(72f, root_child2.LayoutX);
+ Assert.AreEqual(0f, root_child2.LayoutY);
+ Assert.AreEqual(10f, root_child2.LayoutWidth);
+ Assert.AreEqual(102f, root_child2.LayoutHeight);
}
[Test]
@@ -152,65 +89,65 @@ namespace Facebook.CSSLayout
CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row;
root.JustifyContent = CSSJustify.FlexEnd;
- root.StyleWidth = 102;
- root.StyleHeight = 102;
+ root.StyleWidth = 102f;
+ root.StyleHeight = 102f;
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(102, root.LayoutWidth);
- Assert.AreEqual(102, root.LayoutHeight);
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(102f, root.LayoutWidth);
+ Assert.AreEqual(102f, root.LayoutHeight);
- Assert.AreEqual(72, root_child0.LayoutX);
- Assert.AreEqual(0, root_child0.LayoutY);
- Assert.AreEqual(10, root_child0.LayoutWidth);
- Assert.AreEqual(102, root_child0.LayoutHeight);
+ Assert.AreEqual(72f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(10f, root_child0.LayoutWidth);
+ Assert.AreEqual(102f, root_child0.LayoutHeight);
- Assert.AreEqual(82, root_child1.LayoutX);
- Assert.AreEqual(0, root_child1.LayoutY);
- Assert.AreEqual(10, root_child1.LayoutWidth);
- Assert.AreEqual(102, root_child1.LayoutHeight);
+ Assert.AreEqual(82f, root_child1.LayoutX);
+ Assert.AreEqual(0f, root_child1.LayoutY);
+ Assert.AreEqual(10f, root_child1.LayoutWidth);
+ Assert.AreEqual(102f, root_child1.LayoutHeight);
- Assert.AreEqual(92, root_child2.LayoutX);
- Assert.AreEqual(0, root_child2.LayoutY);
- Assert.AreEqual(10, root_child2.LayoutWidth);
- Assert.AreEqual(102, root_child2.LayoutHeight);
+ Assert.AreEqual(92f, root_child2.LayoutX);
+ Assert.AreEqual(0f, root_child2.LayoutY);
+ Assert.AreEqual(10f, root_child2.LayoutWidth);
+ Assert.AreEqual(102f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
- Assert.AreEqual(0, root.LayoutX);
- Assert.AreEqual(0, root.LayoutY);
- Assert.AreEqual(102, root.LayoutWidth);
- Assert.AreEqual(102, root.LayoutHeight);
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(102f, root.LayoutWidth);
+ Assert.AreEqual(102f, root.LayoutHeight);
- Assert.AreEqual(20, root_child0.LayoutX);
- Assert.AreEqual(0, root_child0.LayoutY);
- Assert.AreEqual(10, root_child0.LayoutWidth);
- Assert.AreEqual(102, root_child0.LayoutHeight);
+ Assert.AreEqual(20f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(10f, root_child0.LayoutWidth);
+ Assert.AreEqual(102f, root_child0.LayoutHeight);
- Assert.AreEqual(10, root_child1.LayoutX);
- Assert.AreEqual(0, root_child1.LayoutY);
- Assert.AreEqual(10, root_child1.LayoutWidth);
- Assert.AreEqual(102, root_child1.LayoutHeight);
+ Assert.AreEqual(10f, root_child1.LayoutX);
+ Assert.AreEqual(0f, root_child1.LayoutY);
+ Assert.AreEqual(10f, root_child1.LayoutWidth);
+ Assert.AreEqual(102f, root_child1.LayoutHeight);
- Assert.AreEqual(0, root_child2.LayoutX);
- Assert.AreEqual(0, root_child2.LayoutY);
- Assert.AreEqual(10, root_child2.LayoutWidth);
- Assert.AreEqual(102, root_child2.LayoutHeight);
+ Assert.AreEqual(0f, root_child2.LayoutX);
+ Assert.AreEqual(0f, root_child2.LayoutY);
+ Assert.AreEqual(10f, root_child2.LayoutWidth);
+ Assert.AreEqual(102f, root_child2.LayoutHeight);
}
[Test]
@@ -219,65 +156,65 @@ namespace Facebook.CSSLayout
CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row;
root.JustifyContent = CSSJustify.Center;
- root.StyleWidth = 102;
- root.StyleHeight = 102;
+ root.StyleWidth = 102f;
+ root.StyleHeight = 102f;
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(102, root.LayoutWidth);
- Assert.AreEqual(102, root.LayoutHeight);
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(102f, root.LayoutWidth);
+ Assert.AreEqual(102f, root.LayoutHeight);
- Assert.AreEqual(36, root_child0.LayoutX);
- Assert.AreEqual(0, root_child0.LayoutY);
- Assert.AreEqual(10, root_child0.LayoutWidth);
- Assert.AreEqual(102, root_child0.LayoutHeight);
+ Assert.AreEqual(36f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(10f, root_child0.LayoutWidth);
+ Assert.AreEqual(102f, root_child0.LayoutHeight);
- Assert.AreEqual(46, root_child1.LayoutX);
- Assert.AreEqual(0, root_child1.LayoutY);
- Assert.AreEqual(10, root_child1.LayoutWidth);
- Assert.AreEqual(102, root_child1.LayoutHeight);
+ Assert.AreEqual(46f, root_child1.LayoutX);
+ Assert.AreEqual(0f, root_child1.LayoutY);
+ Assert.AreEqual(10f, root_child1.LayoutWidth);
+ Assert.AreEqual(102f, root_child1.LayoutHeight);
- Assert.AreEqual(56, root_child2.LayoutX);
- Assert.AreEqual(0, root_child2.LayoutY);
- Assert.AreEqual(10, root_child2.LayoutWidth);
- Assert.AreEqual(102, root_child2.LayoutHeight);
+ Assert.AreEqual(56f, root_child2.LayoutX);
+ Assert.AreEqual(0f, root_child2.LayoutY);
+ Assert.AreEqual(10f, root_child2.LayoutWidth);
+ Assert.AreEqual(102f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
- Assert.AreEqual(0, root.LayoutX);
- Assert.AreEqual(0, root.LayoutY);
- Assert.AreEqual(102, root.LayoutWidth);
- Assert.AreEqual(102, root.LayoutHeight);
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(102f, root.LayoutWidth);
+ Assert.AreEqual(102f, root.LayoutHeight);
- Assert.AreEqual(56, root_child0.LayoutX);
- Assert.AreEqual(0, root_child0.LayoutY);
- Assert.AreEqual(10, root_child0.LayoutWidth);
- Assert.AreEqual(102, root_child0.LayoutHeight);
+ Assert.AreEqual(56f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(10f, root_child0.LayoutWidth);
+ Assert.AreEqual(102f, root_child0.LayoutHeight);
- Assert.AreEqual(46, root_child1.LayoutX);
- Assert.AreEqual(0, root_child1.LayoutY);
- Assert.AreEqual(10, root_child1.LayoutWidth);
- Assert.AreEqual(102, root_child1.LayoutHeight);
+ Assert.AreEqual(46f, root_child1.LayoutX);
+ Assert.AreEqual(0f, root_child1.LayoutY);
+ Assert.AreEqual(10f, root_child1.LayoutWidth);
+ Assert.AreEqual(102f, root_child1.LayoutHeight);
- Assert.AreEqual(36, root_child2.LayoutX);
- Assert.AreEqual(0, root_child2.LayoutY);
- Assert.AreEqual(10, root_child2.LayoutWidth);
- Assert.AreEqual(102, root_child2.LayoutHeight);
+ Assert.AreEqual(36f, root_child2.LayoutX);
+ Assert.AreEqual(0f, root_child2.LayoutY);
+ Assert.AreEqual(10f, root_child2.LayoutWidth);
+ Assert.AreEqual(102f, root_child2.LayoutHeight);
}
[Test]
@@ -286,65 +223,65 @@ namespace Facebook.CSSLayout
CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row;
root.JustifyContent = CSSJustify.SpaceBetween;
- root.StyleWidth = 102;
- root.StyleHeight = 102;
+ root.StyleWidth = 102f;
+ root.StyleHeight = 102f;
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(102, root.LayoutWidth);
- Assert.AreEqual(102, root.LayoutHeight);
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(102f, root.LayoutWidth);
+ Assert.AreEqual(102f, root.LayoutHeight);
- Assert.AreEqual(0, root_child0.LayoutX);
- Assert.AreEqual(0, root_child0.LayoutY);
- Assert.AreEqual(10, root_child0.LayoutWidth);
- Assert.AreEqual(102, root_child0.LayoutHeight);
+ Assert.AreEqual(0f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(10f, root_child0.LayoutWidth);
+ Assert.AreEqual(102f, root_child0.LayoutHeight);
- Assert.AreEqual(46, root_child1.LayoutX);
- Assert.AreEqual(0, root_child1.LayoutY);
- Assert.AreEqual(10, root_child1.LayoutWidth);
- Assert.AreEqual(102, root_child1.LayoutHeight);
+ Assert.AreEqual(46f, root_child1.LayoutX);
+ Assert.AreEqual(0f, root_child1.LayoutY);
+ Assert.AreEqual(10f, root_child1.LayoutWidth);
+ Assert.AreEqual(102f, root_child1.LayoutHeight);
- Assert.AreEqual(92, root_child2.LayoutX);
- Assert.AreEqual(0, root_child2.LayoutY);
- Assert.AreEqual(10, root_child2.LayoutWidth);
- Assert.AreEqual(102, root_child2.LayoutHeight);
+ Assert.AreEqual(92f, root_child2.LayoutX);
+ Assert.AreEqual(0f, root_child2.LayoutY);
+ Assert.AreEqual(10f, root_child2.LayoutWidth);
+ Assert.AreEqual(102f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
- Assert.AreEqual(0, root.LayoutX);
- Assert.AreEqual(0, root.LayoutY);
- Assert.AreEqual(102, root.LayoutWidth);
- Assert.AreEqual(102, root.LayoutHeight);
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(102f, root.LayoutWidth);
+ Assert.AreEqual(102f, root.LayoutHeight);
- Assert.AreEqual(92, root_child0.LayoutX);
- Assert.AreEqual(0, root_child0.LayoutY);
- Assert.AreEqual(10, root_child0.LayoutWidth);
- Assert.AreEqual(102, root_child0.LayoutHeight);
+ Assert.AreEqual(92f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(10f, root_child0.LayoutWidth);
+ Assert.AreEqual(102f, root_child0.LayoutHeight);
- Assert.AreEqual(46, root_child1.LayoutX);
- Assert.AreEqual(0, root_child1.LayoutY);
- Assert.AreEqual(10, root_child1.LayoutWidth);
- Assert.AreEqual(102, root_child1.LayoutHeight);
+ Assert.AreEqual(46f, root_child1.LayoutX);
+ Assert.AreEqual(0f, root_child1.LayoutY);
+ Assert.AreEqual(10f, root_child1.LayoutWidth);
+ Assert.AreEqual(102f, root_child1.LayoutHeight);
- Assert.AreEqual(0, root_child2.LayoutX);
- Assert.AreEqual(0, root_child2.LayoutY);
- Assert.AreEqual(10, root_child2.LayoutWidth);
- Assert.AreEqual(102, root_child2.LayoutHeight);
+ Assert.AreEqual(0f, root_child2.LayoutX);
+ Assert.AreEqual(0f, root_child2.LayoutY);
+ Assert.AreEqual(10f, root_child2.LayoutWidth);
+ Assert.AreEqual(102f, root_child2.LayoutHeight);
}
[Test]
@@ -353,129 +290,129 @@ namespace Facebook.CSSLayout
CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row;
root.JustifyContent = CSSJustify.SpaceAround;
- root.StyleWidth = 102;
- root.StyleHeight = 102;
+ root.StyleWidth = 102f;
+ root.StyleHeight = 102f;
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(102, root.LayoutWidth);
- Assert.AreEqual(102, root.LayoutHeight);
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(102f, root.LayoutWidth);
+ Assert.AreEqual(102f, root.LayoutHeight);
- Assert.AreEqual(12, root_child0.LayoutX);
- Assert.AreEqual(0, root_child0.LayoutY);
- Assert.AreEqual(10, root_child0.LayoutWidth);
- Assert.AreEqual(102, root_child0.LayoutHeight);
+ Assert.AreEqual(12f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(10f, root_child0.LayoutWidth);
+ Assert.AreEqual(102f, root_child0.LayoutHeight);
- Assert.AreEqual(46, root_child1.LayoutX);
- Assert.AreEqual(0, root_child1.LayoutY);
- Assert.AreEqual(10, root_child1.LayoutWidth);
- Assert.AreEqual(102, root_child1.LayoutHeight);
+ Assert.AreEqual(46f, root_child1.LayoutX);
+ Assert.AreEqual(0f, root_child1.LayoutY);
+ Assert.AreEqual(10f, root_child1.LayoutWidth);
+ Assert.AreEqual(102f, root_child1.LayoutHeight);
- Assert.AreEqual(80, root_child2.LayoutX);
- Assert.AreEqual(0, root_child2.LayoutY);
- Assert.AreEqual(10, root_child2.LayoutWidth);
- Assert.AreEqual(102, root_child2.LayoutHeight);
+ Assert.AreEqual(80f, root_child2.LayoutX);
+ Assert.AreEqual(0f, root_child2.LayoutY);
+ Assert.AreEqual(10f, root_child2.LayoutWidth);
+ Assert.AreEqual(102f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL;
root.CalculateLayout();
- Assert.AreEqual(0, root.LayoutX);
- Assert.AreEqual(0, root.LayoutY);
- Assert.AreEqual(102, root.LayoutWidth);
- Assert.AreEqual(102, root.LayoutHeight);
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(102f, root.LayoutWidth);
+ Assert.AreEqual(102f, root.LayoutHeight);
- Assert.AreEqual(80, root_child0.LayoutX);
- Assert.AreEqual(0, root_child0.LayoutY);
- Assert.AreEqual(10, root_child0.LayoutWidth);
- Assert.AreEqual(102, root_child0.LayoutHeight);
+ Assert.AreEqual(80f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(10f, root_child0.LayoutWidth);
+ Assert.AreEqual(102f, root_child0.LayoutHeight);
- Assert.AreEqual(46, root_child1.LayoutX);
- Assert.AreEqual(0, root_child1.LayoutY);
- Assert.AreEqual(10, root_child1.LayoutWidth);
- Assert.AreEqual(102, root_child1.LayoutHeight);
+ Assert.AreEqual(46f, root_child1.LayoutX);
+ Assert.AreEqual(0f, root_child1.LayoutY);
+ Assert.AreEqual(10f, root_child1.LayoutWidth);
+ Assert.AreEqual(102f, root_child1.LayoutHeight);
- Assert.AreEqual(12, root_child2.LayoutX);
- Assert.AreEqual(0, root_child2.LayoutY);
- Assert.AreEqual(10, root_child2.LayoutWidth);
- Assert.AreEqual(102, root_child2.LayoutHeight);
+ Assert.AreEqual(12f, root_child2.LayoutX);
+ Assert.AreEqual(0f, root_child2.LayoutY);
+ Assert.AreEqual(10f, root_child2.LayoutWidth);
+ Assert.AreEqual(102f, root_child2.LayoutHeight);
}
[Test]
public void Test_justify_content_column_flex_start()
{
CSSNode root = new CSSNode();
- root.StyleWidth = 102;
- root.StyleHeight = 102;
+ root.StyleWidth = 102f;
+ root.StyleHeight = 102f;
CSSNode root_child0 = new CSSNode();
- root_child0.StyleHeight = 10;
+ root_child0.StyleHeight = 10f;
root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode();
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(102, root.LayoutWidth);
- Assert.AreEqual(102, root.LayoutHeight);
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(102f, root.LayoutWidth);
+ Assert.AreEqual(102f, root.LayoutHeight);
- Assert.AreEqual(0, root_child0.LayoutX);
- Assert.AreEqual(0, root_child0.LayoutY);
- Assert.AreEqual(102, root_child0.LayoutWidth);
- Assert.AreEqual(10, root_child0.LayoutHeight);
+ Assert.AreEqual(0f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(102f, root_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child0.LayoutHeight);
- Assert.AreEqual(0, root_child1.LayoutX);
- Assert.AreEqual(10, root_child1.LayoutY);
- Assert.AreEqual(102, root_child1.LayoutWidth);
- Assert.AreEqual(0, root_child1.LayoutHeight);
+ Assert.AreEqual(0f, root_child1.LayoutX);
+ Assert.AreEqual(10f, root_child1.LayoutY);
+ Assert.AreEqual(102f, root_child1.LayoutWidth);
+ Assert.AreEqual(0f, root_child1.LayoutHeight);
- Assert.AreEqual(0, root_child2.LayoutX);
- Assert.AreEqual(10, root_child2.LayoutY);
- Assert.AreEqual(102, root_child2.LayoutWidth);
- Assert.AreEqual(10, root_child2.LayoutHeight);
+ Assert.AreEqual(0f, root_child2.LayoutX);
+ Assert.AreEqual(10f, root_child2.LayoutY);
+ Assert.AreEqual(102f, 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(102, root.LayoutWidth);
- Assert.AreEqual(102, root.LayoutHeight);
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(102f, root.LayoutWidth);
+ Assert.AreEqual(102f, root.LayoutHeight);
- Assert.AreEqual(0, root_child0.LayoutX);
- Assert.AreEqual(0, root_child0.LayoutY);
- Assert.AreEqual(102, root_child0.LayoutWidth);
- Assert.AreEqual(10, root_child0.LayoutHeight);
+ Assert.AreEqual(0f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(102f, root_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child0.LayoutHeight);
- Assert.AreEqual(0, root_child1.LayoutX);
- Assert.AreEqual(10, root_child1.LayoutY);
- Assert.AreEqual(102, root_child1.LayoutWidth);
- Assert.AreEqual(0, root_child1.LayoutHeight);
+ Assert.AreEqual(0f, root_child1.LayoutX);
+ Assert.AreEqual(10f, root_child1.LayoutY);
+ Assert.AreEqual(102f, root_child1.LayoutWidth);
+ Assert.AreEqual(0f, root_child1.LayoutHeight);
- Assert.AreEqual(0, root_child2.LayoutX);
- Assert.AreEqual(10, root_child2.LayoutY);
- Assert.AreEqual(102, root_child2.LayoutWidth);
- Assert.AreEqual(10, root_child2.LayoutHeight);
+ Assert.AreEqual(0f, root_child2.LayoutX);
+ Assert.AreEqual(10f, root_child2.LayoutY);
+ Assert.AreEqual(102f, root_child2.LayoutWidth);
+ Assert.AreEqual(10f, root_child2.LayoutHeight);
}
[Test]
@@ -483,65 +420,65 @@ namespace Facebook.CSSLayout
{
CSSNode root = new CSSNode();
root.JustifyContent = CSSJustify.FlexEnd;
- root.StyleWidth = 102;
- root.StyleHeight = 102;
+ root.StyleWidth = 102f;
+ root.StyleHeight = 102f;
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(102, root.LayoutWidth);
- Assert.AreEqual(102, root.LayoutHeight);
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(102f, root.LayoutWidth);
+ Assert.AreEqual(102f, root.LayoutHeight);
- Assert.AreEqual(0, root_child0.LayoutX);
- Assert.AreEqual(72, root_child0.LayoutY);
- Assert.AreEqual(102, root_child0.LayoutWidth);
- Assert.AreEqual(10, root_child0.LayoutHeight);
+ Assert.AreEqual(0f, root_child0.LayoutX);
+ Assert.AreEqual(72f, root_child0.LayoutY);
+ Assert.AreEqual(102f, root_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child0.LayoutHeight);
- Assert.AreEqual(0, root_child1.LayoutX);
- Assert.AreEqual(82, root_child1.LayoutY);
- Assert.AreEqual(102, root_child1.LayoutWidth);
- Assert.AreEqual(10, root_child1.LayoutHeight);
+ Assert.AreEqual(0f, root_child1.LayoutX);
+ Assert.AreEqual(82f, root_child1.LayoutY);
+ Assert.AreEqual(102f, root_child1.LayoutWidth);
+ Assert.AreEqual(10f, root_child1.LayoutHeight);
- Assert.AreEqual(0, root_child2.LayoutX);
- Assert.AreEqual(92, root_child2.LayoutY);
- Assert.AreEqual(102, root_child2.LayoutWidth);
- Assert.AreEqual(10, root_child2.LayoutHeight);
+ Assert.AreEqual(0f, root_child2.LayoutX);
+ Assert.AreEqual(92f, root_child2.LayoutY);
+ Assert.AreEqual(102f, 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(102, root.LayoutWidth);
- Assert.AreEqual(102, root.LayoutHeight);
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(102f, root.LayoutWidth);
+ Assert.AreEqual(102f, root.LayoutHeight);
- Assert.AreEqual(0, root_child0.LayoutX);
- Assert.AreEqual(72, root_child0.LayoutY);
- Assert.AreEqual(102, root_child0.LayoutWidth);
- Assert.AreEqual(10, root_child0.LayoutHeight);
+ Assert.AreEqual(0f, root_child0.LayoutX);
+ Assert.AreEqual(72f, root_child0.LayoutY);
+ Assert.AreEqual(102f, root_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child0.LayoutHeight);
- Assert.AreEqual(0, root_child1.LayoutX);
- Assert.AreEqual(82, root_child1.LayoutY);
- Assert.AreEqual(102, root_child1.LayoutWidth);
- Assert.AreEqual(10, root_child1.LayoutHeight);
+ Assert.AreEqual(0f, root_child1.LayoutX);
+ Assert.AreEqual(82f, root_child1.LayoutY);
+ Assert.AreEqual(102f, root_child1.LayoutWidth);
+ Assert.AreEqual(10f, root_child1.LayoutHeight);
- Assert.AreEqual(0, root_child2.LayoutX);
- Assert.AreEqual(92, root_child2.LayoutY);
- Assert.AreEqual(102, root_child2.LayoutWidth);
- Assert.AreEqual(10, root_child2.LayoutHeight);
+ Assert.AreEqual(0f, root_child2.LayoutX);
+ Assert.AreEqual(92f, root_child2.LayoutY);
+ Assert.AreEqual(102f, root_child2.LayoutWidth);
+ Assert.AreEqual(10f, root_child2.LayoutHeight);
}
[Test]
@@ -549,65 +486,65 @@ namespace Facebook.CSSLayout
{
CSSNode root = new CSSNode();
root.JustifyContent = CSSJustify.Center;
- root.StyleWidth = 102;
- root.StyleHeight = 102;
+ root.StyleWidth = 102f;
+ root.StyleHeight = 102f;
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(102, root.LayoutWidth);
- Assert.AreEqual(102, root.LayoutHeight);
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(102f, root.LayoutWidth);
+ Assert.AreEqual(102f, root.LayoutHeight);
- Assert.AreEqual(0, root_child0.LayoutX);
- Assert.AreEqual(36, root_child0.LayoutY);
- Assert.AreEqual(102, root_child0.LayoutWidth);
- Assert.AreEqual(10, root_child0.LayoutHeight);
+ Assert.AreEqual(0f, root_child0.LayoutX);
+ Assert.AreEqual(36f, root_child0.LayoutY);
+ Assert.AreEqual(102f, root_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child0.LayoutHeight);
- Assert.AreEqual(0, root_child1.LayoutX);
- Assert.AreEqual(46, root_child1.LayoutY);
- Assert.AreEqual(102, root_child1.LayoutWidth);
- Assert.AreEqual(10, root_child1.LayoutHeight);
+ Assert.AreEqual(0f, root_child1.LayoutX);
+ Assert.AreEqual(46f, root_child1.LayoutY);
+ Assert.AreEqual(102f, root_child1.LayoutWidth);
+ Assert.AreEqual(10f, root_child1.LayoutHeight);
- Assert.AreEqual(0, root_child2.LayoutX);
- Assert.AreEqual(56, root_child2.LayoutY);
- Assert.AreEqual(102, root_child2.LayoutWidth);
- Assert.AreEqual(10, root_child2.LayoutHeight);
+ Assert.AreEqual(0f, root_child2.LayoutX);
+ Assert.AreEqual(56f, root_child2.LayoutY);
+ Assert.AreEqual(102f, 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(102, root.LayoutWidth);
- Assert.AreEqual(102, root.LayoutHeight);
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(102f, root.LayoutWidth);
+ Assert.AreEqual(102f, root.LayoutHeight);
- Assert.AreEqual(0, root_child0.LayoutX);
- Assert.AreEqual(36, root_child0.LayoutY);
- Assert.AreEqual(102, root_child0.LayoutWidth);
- Assert.AreEqual(10, root_child0.LayoutHeight);
+ Assert.AreEqual(0f, root_child0.LayoutX);
+ Assert.AreEqual(36f, root_child0.LayoutY);
+ Assert.AreEqual(102f, root_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child0.LayoutHeight);
- Assert.AreEqual(0, root_child1.LayoutX);
- Assert.AreEqual(46, root_child1.LayoutY);
- Assert.AreEqual(102, root_child1.LayoutWidth);
- Assert.AreEqual(10, root_child1.LayoutHeight);
+ Assert.AreEqual(0f, root_child1.LayoutX);
+ Assert.AreEqual(46f, root_child1.LayoutY);
+ Assert.AreEqual(102f, root_child1.LayoutWidth);
+ Assert.AreEqual(10f, root_child1.LayoutHeight);
- Assert.AreEqual(0, root_child2.LayoutX);
- Assert.AreEqual(56, root_child2.LayoutY);
- Assert.AreEqual(102, root_child2.LayoutWidth);
- Assert.AreEqual(10, root_child2.LayoutHeight);
+ Assert.AreEqual(0f, root_child2.LayoutX);
+ Assert.AreEqual(56f, root_child2.LayoutY);
+ Assert.AreEqual(102f, root_child2.LayoutWidth);
+ Assert.AreEqual(10f, root_child2.LayoutHeight);
}
[Test]
@@ -615,65 +552,65 @@ namespace Facebook.CSSLayout
{
CSSNode root = new CSSNode();
root.JustifyContent = CSSJustify.SpaceBetween;
- root.StyleWidth = 102;
- root.StyleHeight = 102;
+ root.StyleWidth = 102f;
+ root.StyleHeight = 102f;
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(102, root.LayoutWidth);
- Assert.AreEqual(102, root.LayoutHeight);
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(102f, root.LayoutWidth);
+ Assert.AreEqual(102f, root.LayoutHeight);
- Assert.AreEqual(0, root_child0.LayoutX);
- Assert.AreEqual(0, root_child0.LayoutY);
- Assert.AreEqual(102, root_child0.LayoutWidth);
- Assert.AreEqual(10, root_child0.LayoutHeight);
+ Assert.AreEqual(0f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(102f, root_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child0.LayoutHeight);
- Assert.AreEqual(0, root_child1.LayoutX);
- Assert.AreEqual(46, root_child1.LayoutY);
- Assert.AreEqual(102, root_child1.LayoutWidth);
- Assert.AreEqual(10, root_child1.LayoutHeight);
+ Assert.AreEqual(0f, root_child1.LayoutX);
+ Assert.AreEqual(46f, root_child1.LayoutY);
+ Assert.AreEqual(102f, root_child1.LayoutWidth);
+ Assert.AreEqual(10f, root_child1.LayoutHeight);
- Assert.AreEqual(0, root_child2.LayoutX);
- Assert.AreEqual(92, root_child2.LayoutY);
- Assert.AreEqual(102, root_child2.LayoutWidth);
- Assert.AreEqual(10, root_child2.LayoutHeight);
+ Assert.AreEqual(0f, root_child2.LayoutX);
+ Assert.AreEqual(92f, root_child2.LayoutY);
+ Assert.AreEqual(102f, 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(102, root.LayoutWidth);
- Assert.AreEqual(102, root.LayoutHeight);
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(102f, root.LayoutWidth);
+ Assert.AreEqual(102f, root.LayoutHeight);
- Assert.AreEqual(0, root_child0.LayoutX);
- Assert.AreEqual(0, root_child0.LayoutY);
- Assert.AreEqual(102, root_child0.LayoutWidth);
- Assert.AreEqual(10, root_child0.LayoutHeight);
+ Assert.AreEqual(0f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(102f, root_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child0.LayoutHeight);
- Assert.AreEqual(0, root_child1.LayoutX);
- Assert.AreEqual(46, root_child1.LayoutY);
- Assert.AreEqual(102, root_child1.LayoutWidth);
- Assert.AreEqual(10, root_child1.LayoutHeight);
+ Assert.AreEqual(0f, root_child1.LayoutX);
+ Assert.AreEqual(46f, root_child1.LayoutY);
+ Assert.AreEqual(102f, root_child1.LayoutWidth);
+ Assert.AreEqual(10f, root_child1.LayoutHeight);
- Assert.AreEqual(0, root_child2.LayoutX);
- Assert.AreEqual(92, root_child2.LayoutY);
- Assert.AreEqual(102, root_child2.LayoutWidth);
- Assert.AreEqual(10, root_child2.LayoutHeight);
+ Assert.AreEqual(0f, root_child2.LayoutX);
+ Assert.AreEqual(92f, root_child2.LayoutY);
+ Assert.AreEqual(102f, root_child2.LayoutWidth);
+ Assert.AreEqual(10f, root_child2.LayoutHeight);
}
[Test]
@@ -681,65 +618,65 @@ namespace Facebook.CSSLayout
{
CSSNode root = new CSSNode();
root.JustifyContent = CSSJustify.SpaceAround;
- root.StyleWidth = 102;
- root.StyleHeight = 102;
+ root.StyleWidth = 102f;
+ root.StyleHeight = 102f;
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(102, root.LayoutWidth);
- Assert.AreEqual(102, root.LayoutHeight);
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(102f, root.LayoutWidth);
+ Assert.AreEqual(102f, root.LayoutHeight);
- Assert.AreEqual(0, root_child0.LayoutX);
- Assert.AreEqual(12, root_child0.LayoutY);
- Assert.AreEqual(102, root_child0.LayoutWidth);
- Assert.AreEqual(10, root_child0.LayoutHeight);
+ Assert.AreEqual(0f, root_child0.LayoutX);
+ Assert.AreEqual(12f, root_child0.LayoutY);
+ Assert.AreEqual(102f, root_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child0.LayoutHeight);
- Assert.AreEqual(0, root_child1.LayoutX);
- Assert.AreEqual(46, root_child1.LayoutY);
- Assert.AreEqual(102, root_child1.LayoutWidth);
- Assert.AreEqual(10, root_child1.LayoutHeight);
+ Assert.AreEqual(0f, root_child1.LayoutX);
+ Assert.AreEqual(46f, root_child1.LayoutY);
+ Assert.AreEqual(102f, root_child1.LayoutWidth);
+ Assert.AreEqual(10f, root_child1.LayoutHeight);
- Assert.AreEqual(0, root_child2.LayoutX);
- Assert.AreEqual(80, root_child2.LayoutY);
- Assert.AreEqual(102, root_child2.LayoutWidth);
- Assert.AreEqual(10, root_child2.LayoutHeight);
+ Assert.AreEqual(0f, root_child2.LayoutX);
+ Assert.AreEqual(80f, root_child2.LayoutY);
+ Assert.AreEqual(102f, 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(102, root.LayoutWidth);
- Assert.AreEqual(102, root.LayoutHeight);
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(102f, root.LayoutWidth);
+ Assert.AreEqual(102f, root.LayoutHeight);
- Assert.AreEqual(0, root_child0.LayoutX);
- Assert.AreEqual(12, root_child0.LayoutY);
- Assert.AreEqual(102, root_child0.LayoutWidth);
- Assert.AreEqual(10, root_child0.LayoutHeight);
+ Assert.AreEqual(0f, root_child0.LayoutX);
+ Assert.AreEqual(12f, root_child0.LayoutY);
+ Assert.AreEqual(102f, root_child0.LayoutWidth);
+ Assert.AreEqual(10f, root_child0.LayoutHeight);
- Assert.AreEqual(0, root_child1.LayoutX);
- Assert.AreEqual(46, root_child1.LayoutY);
- Assert.AreEqual(102, root_child1.LayoutWidth);
- Assert.AreEqual(10, root_child1.LayoutHeight);
+ Assert.AreEqual(0f, root_child1.LayoutX);
+ Assert.AreEqual(46f, root_child1.LayoutY);
+ Assert.AreEqual(102f, root_child1.LayoutWidth);
+ Assert.AreEqual(10f, root_child1.LayoutHeight);
- Assert.AreEqual(0, root_child2.LayoutX);
- Assert.AreEqual(80, root_child2.LayoutY);
- Assert.AreEqual(102, root_child2.LayoutWidth);
- Assert.AreEqual(10, root_child2.LayoutHeight);
+ Assert.AreEqual(0f, root_child2.LayoutX);
+ Assert.AreEqual(80f, root_child2.LayoutY);
+ Assert.AreEqual(102f, root_child2.LayoutWidth);
+ Assert.AreEqual(10f, root_child2.LayoutHeight);
}
}
diff --git a/csharp/tests/Facebook.CSSLayout/CSSLayoutMarginTest.cs b/csharp/tests/Facebook.CSSLayout/CSSLayoutMarginTest.cs
index 7501c59d..0d5e1bee 100644
--- a/csharp/tests/Facebook.CSSLayout/CSSLayoutMarginTest.cs
+++ b/csharp/tests/Facebook.CSSLayout/CSSLayoutMarginTest.cs
@@ -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
- *
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- *
- */
+ // @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);
}
}
diff --git a/csharp/tests/Facebook.CSSLayout/CSSLayoutMinMaxDimensionTest.cs b/csharp/tests/Facebook.CSSLayout/CSSLayoutMinMaxDimensionTest.cs
index 69d8996f..4d3d1c13 100644
--- a/csharp/tests/Facebook.CSSLayout/CSSLayoutMinMaxDimensionTest.cs
+++ b/csharp/tests/Facebook.CSSLayout/CSSLayoutMinMaxDimensionTest.cs
@@ -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
- *
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- *
- */
+ // @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);
}
}
diff --git a/csharp/tests/Facebook.CSSLayout/CSSLayoutPaddingTest.cs b/csharp/tests/Facebook.CSSLayout/CSSLayoutPaddingTest.cs
index 576cacec..6d95bb17 100644
--- a/csharp/tests/Facebook.CSSLayout/CSSLayoutPaddingTest.cs
+++ b/csharp/tests/Facebook.CSSLayout/CSSLayoutPaddingTest.cs
@@ -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
- *
-
-
-
-
-
-
-
-
-
-
- *
- */
+ // @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);
}
}
diff --git a/csharp/tests/Facebook.CSSLayout/CSSLayoutRoundingTest.cs b/csharp/tests/Facebook.CSSLayout/CSSLayoutRoundingTest.cs
new file mode 100644
index 00000000..5f1e2a12
--- /dev/null
+++ b/csharp/tests/Facebook.CSSLayout/CSSLayoutRoundingTest.cs
@@ -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);
+ }
+
+ }
+}
diff --git a/gentest/fixtures/CSSLayoutRoundingTest.html b/gentest/fixtures/CSSLayoutRoundingTest.html
new file mode 100644
index 00000000..c66e6b16
--- /dev/null
+++ b/gentest/fixtures/CSSLayoutRoundingTest.html
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/gentest/gentest-cpp.js b/gentest/gentest-cpp.js
index 2a5e8d24..fe655a7c 100644
--- a/gentest/gentest-cpp.js
+++ b/gentest/gentest-cpp.js
@@ -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) {
diff --git a/gentest/gentest-cs.js b/gentest/gentest-cs.js
index f96d557f..a50774bb 100644
--- a/gentest/gentest-cs.js
+++ b/gentest/gentest-cs.js
@@ -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;');
}},
});
diff --git a/gentest/gentest-java.js b/gentest/gentest-java.js
index 853bf658..793c964d 100644
--- a/gentest/gentest-java.js
+++ b/gentest/gentest-java.js
@@ -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);');
}},
});
diff --git a/gentest/gentest.js b/gentest/gentest.js
index 26204c35..02f44609 100755
--- a/gentest/gentest.js
+++ b/gentest/gentest.js
@@ -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 !== '';
- }).map(function(line) {
- var result;
- if (line.indexOf('{"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
diff --git a/gentest/test-template.html b/gentest/test-template.html
index 9e0364c3..0b4102f7 100644
--- a/gentest/test-template.html
+++ b/gentest/test-template.html
@@ -2,7 +2,7 @@
- test page
+ %s
diff --git a/java/tests/com/facebook/csslayout/CSSLayoutAbsolutePositionTest.java b/java/tests/com/facebook/csslayout/CSSLayoutAbsolutePositionTest.java
index e4ced9fc..f7fd50cb 100644
--- a/java/tests/com/facebook/csslayout/CSSLayoutAbsolutePositionTest.java
+++ b/java/tests/com/facebook/csslayout/CSSLayoutAbsolutePositionTest.java
@@ -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
- *
-
-
-
-
-
-
-
-
-
-
-
- *
- */
+ // @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);
}
}
diff --git a/java/tests/com/facebook/csslayout/CSSLayoutAlignContentTest.java b/java/tests/com/facebook/csslayout/CSSLayoutAlignContentTest.java
index c8ae2f98..e48d4ee3 100644
--- a/java/tests/com/facebook/csslayout/CSSLayoutAlignContentTest.java
+++ b/java/tests/com/facebook/csslayout/CSSLayoutAlignContentTest.java
@@ -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
- *
-
-
-
-
-
-
-
- *
- */
+ // @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);
}
}
diff --git a/java/tests/com/facebook/csslayout/CSSLayoutAlignItemsTest.java b/java/tests/com/facebook/csslayout/CSSLayoutAlignItemsTest.java
index 49689901..cca9b555 100644
--- a/java/tests/com/facebook/csslayout/CSSLayoutAlignItemsTest.java
+++ b/java/tests/com/facebook/csslayout/CSSLayoutAlignItemsTest.java
@@ -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
- *
-
-
-
-
-
-
-
- *
- */
+ // @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);
}
}
diff --git a/java/tests/com/facebook/csslayout/CSSLayoutAlignSelfTest.java b/java/tests/com/facebook/csslayout/CSSLayoutAlignSelfTest.java
index 999972de..d6236541 100644
--- a/java/tests/com/facebook/csslayout/CSSLayoutAlignSelfTest.java
+++ b/java/tests/com/facebook/csslayout/CSSLayoutAlignSelfTest.java
@@ -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
- *
-
-
-
-
-
-
-
- *
- */
+ // @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);
}
}
diff --git a/java/tests/com/facebook/csslayout/CSSLayoutBorderTest.java b/java/tests/com/facebook/csslayout/CSSLayoutBorderTest.java
index ee7505e4..f382f73b 100644
--- a/java/tests/com/facebook/csslayout/CSSLayoutBorderTest.java
+++ b/java/tests/com/facebook/csslayout/CSSLayoutBorderTest.java
@@ -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
- *
-
-
-
-
-
-
-
-
-
-
- *
- */
+ // @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);
}
}
diff --git a/java/tests/com/facebook/csslayout/CSSLayoutFlexDirectionTest.java b/java/tests/com/facebook/csslayout/CSSLayoutFlexDirectionTest.java
index 7d741b7c..75b1fe70 100644
--- a/java/tests/com/facebook/csslayout/CSSLayoutFlexDirectionTest.java
+++ b/java/tests/com/facebook/csslayout/CSSLayoutFlexDirectionTest.java
@@ -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
- *
-
-
-
-
-
-
-
-
-
-
-
- *
- */
+ // @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);
}
}
diff --git a/java/tests/com/facebook/csslayout/CSSLayoutFlexTest.java b/java/tests/com/facebook/csslayout/CSSLayoutFlexTest.java
index ccc641c6..f675cbbf 100644
--- a/java/tests/com/facebook/csslayout/CSSLayoutFlexTest.java
+++ b/java/tests/com/facebook/csslayout/CSSLayoutFlexTest.java
@@ -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
- *
-
-
-
-
-
-
-
-
-
-
-
-
-
- *
- */
+ // @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);
}
}
diff --git a/java/tests/com/facebook/csslayout/CSSLayoutFlexWrapTest.java b/java/tests/com/facebook/csslayout/CSSLayoutFlexWrapTest.java
index bd4b506d..71ba2541 100644
--- a/java/tests/com/facebook/csslayout/CSSLayoutFlexWrapTest.java
+++ b/java/tests/com/facebook/csslayout/CSSLayoutFlexWrapTest.java
@@ -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
- *
-
-
-
-
-
-
-
- *
- */
+ // @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);
}
}
diff --git a/java/tests/com/facebook/csslayout/CSSLayoutJustifyContentTest.java b/java/tests/com/facebook/csslayout/CSSLayoutJustifyContentTest.java
index cef3690a..1c7488de 100644
--- a/java/tests/com/facebook/csslayout/CSSLayoutJustifyContentTest.java
+++ b/java/tests/com/facebook/csslayout/CSSLayoutJustifyContentTest.java
@@ -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
- *
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- *
- */
+ // @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutJustifyContentTest.html
package com.facebook.csslayout;
@@ -83,65 +20,65 @@ public class CSSLayoutJustifyContentTest {
public void test_justify_content_row_flex_start() {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
- root.setStyleWidth(102);
- root.setStyleHeight(102);
+ root.setStyleWidth(102f);
+ root.setStyleHeight(102f);
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(102, root.getLayoutWidth(), 0.0f);
- assertEquals(102, root.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(102f, root.getLayoutWidth(), 0.0f);
+ assertEquals(102f, 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(102, 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(102f, 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(102, 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(102f, 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(102, 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(102f, 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(102, root.getLayoutWidth(), 0.0f);
- assertEquals(102, root.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(102f, root.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root.getLayoutHeight(), 0.0f);
- assertEquals(92, root_child0.getLayoutX(), 0.0f);
- assertEquals(0, root_child0.getLayoutY(), 0.0f);
- assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(102, root_child0.getLayoutHeight(), 0.0f);
+ assertEquals(92f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
- assertEquals(82, root_child1.getLayoutX(), 0.0f);
- assertEquals(0, root_child1.getLayoutY(), 0.0f);
- assertEquals(10, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(102, root_child1.getLayoutHeight(), 0.0f);
+ assertEquals(82f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
- assertEquals(72, root_child2.getLayoutX(), 0.0f);
- assertEquals(0, root_child2.getLayoutY(), 0.0f);
- assertEquals(10, root_child2.getLayoutWidth(), 0.0f);
- assertEquals(102, root_child2.getLayoutHeight(), 0.0f);
+ assertEquals(72f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
}
@Test
@@ -149,65 +86,65 @@ public class CSSLayoutJustifyContentTest {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setJustifyContent(CSSJustify.FLEX_END);
- root.setStyleWidth(102);
- root.setStyleHeight(102);
+ root.setStyleWidth(102f);
+ root.setStyleHeight(102f);
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(102, root.getLayoutWidth(), 0.0f);
- assertEquals(102, root.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(102f, root.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root.getLayoutHeight(), 0.0f);
- assertEquals(72, root_child0.getLayoutX(), 0.0f);
- assertEquals(0, root_child0.getLayoutY(), 0.0f);
- assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(102, root_child0.getLayoutHeight(), 0.0f);
+ assertEquals(72f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
- assertEquals(82, root_child1.getLayoutX(), 0.0f);
- assertEquals(0, root_child1.getLayoutY(), 0.0f);
- assertEquals(10, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(102, root_child1.getLayoutHeight(), 0.0f);
+ assertEquals(82f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
- assertEquals(92, root_child2.getLayoutX(), 0.0f);
- assertEquals(0, root_child2.getLayoutY(), 0.0f);
- assertEquals(10, root_child2.getLayoutWidth(), 0.0f);
- assertEquals(102, root_child2.getLayoutHeight(), 0.0f);
+ assertEquals(92f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(102f, 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(102, root.getLayoutWidth(), 0.0f);
- assertEquals(102, root.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(102f, root.getLayoutWidth(), 0.0f);
+ assertEquals(102f, 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(102, 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(102f, 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(102, 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(102f, 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(102, 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(102f, root_child2.getLayoutHeight(), 0.0f);
}
@Test
@@ -215,65 +152,65 @@ public class CSSLayoutJustifyContentTest {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setJustifyContent(CSSJustify.CENTER);
- root.setStyleWidth(102);
- root.setStyleHeight(102);
+ root.setStyleWidth(102f);
+ root.setStyleHeight(102f);
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(102, root.getLayoutWidth(), 0.0f);
- assertEquals(102, root.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(102f, root.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root.getLayoutHeight(), 0.0f);
- assertEquals(36, root_child0.getLayoutX(), 0.0f);
- assertEquals(0, root_child0.getLayoutY(), 0.0f);
- assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(102, root_child0.getLayoutHeight(), 0.0f);
+ assertEquals(36f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
- assertEquals(46, root_child1.getLayoutX(), 0.0f);
- assertEquals(0, root_child1.getLayoutY(), 0.0f);
- assertEquals(10, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(102, root_child1.getLayoutHeight(), 0.0f);
+ assertEquals(46f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
- assertEquals(56, root_child2.getLayoutX(), 0.0f);
- assertEquals(0, root_child2.getLayoutY(), 0.0f);
- assertEquals(10, root_child2.getLayoutWidth(), 0.0f);
- assertEquals(102, root_child2.getLayoutHeight(), 0.0f);
+ assertEquals(56f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(102f, 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(102, root.getLayoutWidth(), 0.0f);
- assertEquals(102, root.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(102f, root.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root.getLayoutHeight(), 0.0f);
- assertEquals(56, root_child0.getLayoutX(), 0.0f);
- assertEquals(0, root_child0.getLayoutY(), 0.0f);
- assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(102, root_child0.getLayoutHeight(), 0.0f);
+ assertEquals(56f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
- assertEquals(46, root_child1.getLayoutX(), 0.0f);
- assertEquals(0, root_child1.getLayoutY(), 0.0f);
- assertEquals(10, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(102, root_child1.getLayoutHeight(), 0.0f);
+ assertEquals(46f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
- assertEquals(36, root_child2.getLayoutX(), 0.0f);
- assertEquals(0, root_child2.getLayoutY(), 0.0f);
- assertEquals(10, root_child2.getLayoutWidth(), 0.0f);
- assertEquals(102, root_child2.getLayoutHeight(), 0.0f);
+ assertEquals(36f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
}
@Test
@@ -281,65 +218,65 @@ public class CSSLayoutJustifyContentTest {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setJustifyContent(CSSJustify.SPACE_BETWEEN);
- root.setStyleWidth(102);
- root.setStyleHeight(102);
+ root.setStyleWidth(102f);
+ root.setStyleHeight(102f);
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(102, root.getLayoutWidth(), 0.0f);
- assertEquals(102, root.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(102f, root.getLayoutWidth(), 0.0f);
+ assertEquals(102f, 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(102, 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(102f, root_child0.getLayoutHeight(), 0.0f);
- assertEquals(46, root_child1.getLayoutX(), 0.0f);
- assertEquals(0, root_child1.getLayoutY(), 0.0f);
- assertEquals(10, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(102, root_child1.getLayoutHeight(), 0.0f);
+ assertEquals(46f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
- assertEquals(92, root_child2.getLayoutX(), 0.0f);
- assertEquals(0, root_child2.getLayoutY(), 0.0f);
- assertEquals(10, root_child2.getLayoutWidth(), 0.0f);
- assertEquals(102, root_child2.getLayoutHeight(), 0.0f);
+ assertEquals(92f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(102f, 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(102, root.getLayoutWidth(), 0.0f);
- assertEquals(102, root.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(102f, root.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root.getLayoutHeight(), 0.0f);
- assertEquals(92, root_child0.getLayoutX(), 0.0f);
- assertEquals(0, root_child0.getLayoutY(), 0.0f);
- assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(102, root_child0.getLayoutHeight(), 0.0f);
+ assertEquals(92f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
- assertEquals(46, root_child1.getLayoutX(), 0.0f);
- assertEquals(0, root_child1.getLayoutY(), 0.0f);
- assertEquals(10, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(102, root_child1.getLayoutHeight(), 0.0f);
+ assertEquals(46f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(102f, 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(102, 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(102f, root_child2.getLayoutHeight(), 0.0f);
}
@Test
@@ -347,388 +284,388 @@ public class CSSLayoutJustifyContentTest {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setJustifyContent(CSSJustify.SPACE_AROUND);
- root.setStyleWidth(102);
- root.setStyleHeight(102);
+ root.setStyleWidth(102f);
+ root.setStyleHeight(102f);
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(102, root.getLayoutWidth(), 0.0f);
- assertEquals(102, root.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(102f, root.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root.getLayoutHeight(), 0.0f);
- assertEquals(12, root_child0.getLayoutX(), 0.0f);
- assertEquals(0, root_child0.getLayoutY(), 0.0f);
- assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(102, root_child0.getLayoutHeight(), 0.0f);
+ assertEquals(12f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
- assertEquals(46, root_child1.getLayoutX(), 0.0f);
- assertEquals(0, root_child1.getLayoutY(), 0.0f);
- assertEquals(10, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(102, root_child1.getLayoutHeight(), 0.0f);
+ assertEquals(46f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
- assertEquals(80, root_child2.getLayoutX(), 0.0f);
- assertEquals(0, root_child2.getLayoutY(), 0.0f);
- assertEquals(10, root_child2.getLayoutWidth(), 0.0f);
- assertEquals(102, root_child2.getLayoutHeight(), 0.0f);
+ assertEquals(80f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(102f, 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(102, root.getLayoutWidth(), 0.0f);
- assertEquals(102, root.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(102f, root.getLayoutWidth(), 0.0f);
+ assertEquals(102f, 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(102, 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(102f, root_child0.getLayoutHeight(), 0.0f);
- assertEquals(46, root_child1.getLayoutX(), 0.0f);
- assertEquals(0, root_child1.getLayoutY(), 0.0f);
- assertEquals(10, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(102, root_child1.getLayoutHeight(), 0.0f);
+ assertEquals(46f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
- assertEquals(12, root_child2.getLayoutX(), 0.0f);
- assertEquals(0, root_child2.getLayoutY(), 0.0f);
- assertEquals(10, root_child2.getLayoutWidth(), 0.0f);
- assertEquals(102, root_child2.getLayoutHeight(), 0.0f);
+ assertEquals(12f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
}
@Test
public void test_justify_content_column_flex_start() {
final CSSNode root = new CSSNode();
- root.setStyleWidth(102);
- root.setStyleHeight(102);
+ root.setStyleWidth(102f);
+ root.setStyleHeight(102f);
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.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(102, root.getLayoutWidth(), 0.0f);
- assertEquals(102, root.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(102f, root.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root.getLayoutHeight(), 0.0f);
- assertEquals(0, root_child0.getLayoutX(), 0.0f);
- assertEquals(0, root_child0.getLayoutY(), 0.0f);
- assertEquals(102, 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(102f, 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(102, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(0, root_child1.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(10f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(102f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
- assertEquals(0, root_child2.getLayoutX(), 0.0f);
- assertEquals(10, root_child2.getLayoutY(), 0.0f);
- assertEquals(102, root_child2.getLayoutWidth(), 0.0f);
- assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(10f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(102f, 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(102, root.getLayoutWidth(), 0.0f);
- assertEquals(102, root.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(102f, root.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root.getLayoutHeight(), 0.0f);
- assertEquals(0, root_child0.getLayoutX(), 0.0f);
- assertEquals(0, root_child0.getLayoutY(), 0.0f);
- assertEquals(102, 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(102f, 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(102, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(0, root_child1.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(10f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(102f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
- assertEquals(0, root_child2.getLayoutX(), 0.0f);
- assertEquals(10, root_child2.getLayoutY(), 0.0f);
- assertEquals(102, root_child2.getLayoutWidth(), 0.0f);
- assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(10f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(102f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
}
@Test
public void test_justify_content_column_flex_end() {
final CSSNode root = new CSSNode();
root.setJustifyContent(CSSJustify.FLEX_END);
- root.setStyleWidth(102);
- root.setStyleHeight(102);
+ root.setStyleWidth(102f);
+ root.setStyleHeight(102f);
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(102, root.getLayoutWidth(), 0.0f);
- assertEquals(102, root.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(102f, root.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root.getLayoutHeight(), 0.0f);
- assertEquals(0, root_child0.getLayoutX(), 0.0f);
- assertEquals(72, root_child0.getLayoutY(), 0.0f);
- assertEquals(102, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(72f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(102f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
- assertEquals(0, root_child1.getLayoutX(), 0.0f);
- assertEquals(82, root_child1.getLayoutY(), 0.0f);
- assertEquals(102, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(82f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(102f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
- assertEquals(0, root_child2.getLayoutX(), 0.0f);
- assertEquals(92, root_child2.getLayoutY(), 0.0f);
- assertEquals(102, root_child2.getLayoutWidth(), 0.0f);
- assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(92f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(102f, 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(102, root.getLayoutWidth(), 0.0f);
- assertEquals(102, root.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(102f, root.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root.getLayoutHeight(), 0.0f);
- assertEquals(0, root_child0.getLayoutX(), 0.0f);
- assertEquals(72, root_child0.getLayoutY(), 0.0f);
- assertEquals(102, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(72f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(102f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
- assertEquals(0, root_child1.getLayoutX(), 0.0f);
- assertEquals(82, root_child1.getLayoutY(), 0.0f);
- assertEquals(102, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(82f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(102f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
- assertEquals(0, root_child2.getLayoutX(), 0.0f);
- assertEquals(92, root_child2.getLayoutY(), 0.0f);
- assertEquals(102, root_child2.getLayoutWidth(), 0.0f);
- assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(92f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(102f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
}
@Test
public void test_justify_content_column_center() {
final CSSNode root = new CSSNode();
root.setJustifyContent(CSSJustify.CENTER);
- root.setStyleWidth(102);
- root.setStyleHeight(102);
+ root.setStyleWidth(102f);
+ root.setStyleHeight(102f);
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(102, root.getLayoutWidth(), 0.0f);
- assertEquals(102, root.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(102f, root.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root.getLayoutHeight(), 0.0f);
- assertEquals(0, root_child0.getLayoutX(), 0.0f);
- assertEquals(36, root_child0.getLayoutY(), 0.0f);
- assertEquals(102, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(36f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(102f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
- assertEquals(0, root_child1.getLayoutX(), 0.0f);
- assertEquals(46, root_child1.getLayoutY(), 0.0f);
- assertEquals(102, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(46f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(102f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
- assertEquals(0, root_child2.getLayoutX(), 0.0f);
- assertEquals(56, root_child2.getLayoutY(), 0.0f);
- assertEquals(102, root_child2.getLayoutWidth(), 0.0f);
- assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(56f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(102f, 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(102, root.getLayoutWidth(), 0.0f);
- assertEquals(102, root.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(102f, root.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root.getLayoutHeight(), 0.0f);
- assertEquals(0, root_child0.getLayoutX(), 0.0f);
- assertEquals(36, root_child0.getLayoutY(), 0.0f);
- assertEquals(102, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(36f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(102f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
- assertEquals(0, root_child1.getLayoutX(), 0.0f);
- assertEquals(46, root_child1.getLayoutY(), 0.0f);
- assertEquals(102, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(46f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(102f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
- assertEquals(0, root_child2.getLayoutX(), 0.0f);
- assertEquals(56, root_child2.getLayoutY(), 0.0f);
- assertEquals(102, root_child2.getLayoutWidth(), 0.0f);
- assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(56f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(102f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
}
@Test
public void test_justify_content_column_space_between() {
final CSSNode root = new CSSNode();
root.setJustifyContent(CSSJustify.SPACE_BETWEEN);
- root.setStyleWidth(102);
- root.setStyleHeight(102);
+ root.setStyleWidth(102f);
+ root.setStyleHeight(102f);
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(102, root.getLayoutWidth(), 0.0f);
- assertEquals(102, root.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(102f, root.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root.getLayoutHeight(), 0.0f);
- assertEquals(0, root_child0.getLayoutX(), 0.0f);
- assertEquals(0, root_child0.getLayoutY(), 0.0f);
- assertEquals(102, 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(102f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
- assertEquals(0, root_child1.getLayoutX(), 0.0f);
- assertEquals(46, root_child1.getLayoutY(), 0.0f);
- assertEquals(102, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(46f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(102f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
- assertEquals(0, root_child2.getLayoutX(), 0.0f);
- assertEquals(92, root_child2.getLayoutY(), 0.0f);
- assertEquals(102, root_child2.getLayoutWidth(), 0.0f);
- assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(92f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(102f, 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(102, root.getLayoutWidth(), 0.0f);
- assertEquals(102, root.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(102f, root.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root.getLayoutHeight(), 0.0f);
- assertEquals(0, root_child0.getLayoutX(), 0.0f);
- assertEquals(0, root_child0.getLayoutY(), 0.0f);
- assertEquals(102, 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(102f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
- assertEquals(0, root_child1.getLayoutX(), 0.0f);
- assertEquals(46, root_child1.getLayoutY(), 0.0f);
- assertEquals(102, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(46f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(102f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
- assertEquals(0, root_child2.getLayoutX(), 0.0f);
- assertEquals(92, root_child2.getLayoutY(), 0.0f);
- assertEquals(102, root_child2.getLayoutWidth(), 0.0f);
- assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(92f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(102f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
}
@Test
public void test_justify_content_column_space_around() {
final CSSNode root = new CSSNode();
root.setJustifyContent(CSSJustify.SPACE_AROUND);
- root.setStyleWidth(102);
- root.setStyleHeight(102);
+ root.setStyleWidth(102f);
+ root.setStyleHeight(102f);
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(102, root.getLayoutWidth(), 0.0f);
- assertEquals(102, root.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(102f, root.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root.getLayoutHeight(), 0.0f);
- assertEquals(0, root_child0.getLayoutX(), 0.0f);
- assertEquals(12, root_child0.getLayoutY(), 0.0f);
- assertEquals(102, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(12f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(102f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
- assertEquals(0, root_child1.getLayoutX(), 0.0f);
- assertEquals(46, root_child1.getLayoutY(), 0.0f);
- assertEquals(102, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(46f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(102f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
- assertEquals(0, root_child2.getLayoutX(), 0.0f);
- assertEquals(80, root_child2.getLayoutY(), 0.0f);
- assertEquals(102, root_child2.getLayoutWidth(), 0.0f);
- assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(80f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(102f, 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(102, root.getLayoutWidth(), 0.0f);
- assertEquals(102, root.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(102f, root.getLayoutWidth(), 0.0f);
+ assertEquals(102f, root.getLayoutHeight(), 0.0f);
- assertEquals(0, root_child0.getLayoutX(), 0.0f);
- assertEquals(12, root_child0.getLayoutY(), 0.0f);
- assertEquals(102, root_child0.getLayoutWidth(), 0.0f);
- assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(12f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(102f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
- assertEquals(0, root_child1.getLayoutX(), 0.0f);
- assertEquals(46, root_child1.getLayoutY(), 0.0f);
- assertEquals(102, root_child1.getLayoutWidth(), 0.0f);
- assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(46f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(102f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
- assertEquals(0, root_child2.getLayoutX(), 0.0f);
- assertEquals(80, root_child2.getLayoutY(), 0.0f);
- assertEquals(102, root_child2.getLayoutWidth(), 0.0f);
- assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(80f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(102f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
}
}
diff --git a/java/tests/com/facebook/csslayout/CSSLayoutMarginTest.java b/java/tests/com/facebook/csslayout/CSSLayoutMarginTest.java
index f85ce54d..94f0f0ad 100644
--- a/java/tests/com/facebook/csslayout/CSSLayoutMarginTest.java
+++ b/java/tests/com/facebook/csslayout/CSSLayoutMarginTest.java
@@ -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
- *
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- *
- */
+ // @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);
}
}
diff --git a/java/tests/com/facebook/csslayout/CSSLayoutMinMaxDimensionTest.java b/java/tests/com/facebook/csslayout/CSSLayoutMinMaxDimensionTest.java
index d513f5e4..24ff93ab 100644
--- a/java/tests/com/facebook/csslayout/CSSLayoutMinMaxDimensionTest.java
+++ b/java/tests/com/facebook/csslayout/CSSLayoutMinMaxDimensionTest.java
@@ -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
- *
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- *
- */
+ // @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);
}
}
diff --git a/java/tests/com/facebook/csslayout/CSSLayoutPaddingTest.java b/java/tests/com/facebook/csslayout/CSSLayoutPaddingTest.java
index e8bd8671..41750c20 100644
--- a/java/tests/com/facebook/csslayout/CSSLayoutPaddingTest.java
+++ b/java/tests/com/facebook/csslayout/CSSLayoutPaddingTest.java
@@ -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
- *
-
-
-
-
-
-
-
-
-
-
- *
- */
+ // @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);
}
}
diff --git a/java/tests/com/facebook/csslayout/CSSLayoutRoundingTest.java b/java/tests/com/facebook/csslayout/CSSLayoutRoundingTest.java
new file mode 100644
index 00000000..3ecec462
--- /dev/null
+++ b/java/tests/com/facebook/csslayout/CSSLayoutRoundingTest.java
@@ -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);
+ }
+
+}
diff --git a/tests/CSSLayoutAbsolutePositionTest.cpp b/tests/CSSLayoutAbsolutePositionTest.cpp
index 2692f05e..a0bedbe5 100644
--- a/tests/CSSLayoutAbsolutePositionTest.cpp
+++ b/tests/CSSLayoutAbsolutePositionTest.cpp
@@ -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
- *
-
-
-
-
-
-
-
-
-
-
-
- *
- */
+ // @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutAbsolutePositionTest.html
#include
#include
diff --git a/tests/CSSLayoutAlignContentTest.cpp b/tests/CSSLayoutAlignContentTest.cpp
index 64523b8e..d3078098 100644
--- a/tests/CSSLayoutAlignContentTest.cpp
+++ b/tests/CSSLayoutAlignContentTest.cpp
@@ -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
- *
-
-
-
-
-
-
-
- *
- */
+ // @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutAlignContentTest.html
#include
#include
diff --git a/tests/CSSLayoutAlignItemsTest.cpp b/tests/CSSLayoutAlignItemsTest.cpp
index 0047dfc5..c72acc7a 100644
--- a/tests/CSSLayoutAlignItemsTest.cpp
+++ b/tests/CSSLayoutAlignItemsTest.cpp
@@ -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
- *
-
-
-
-
-
-
-
- *
- */
+ // @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutAlignItemsTest.html
#include
#include
diff --git a/tests/CSSLayoutAlignSelfTest.cpp b/tests/CSSLayoutAlignSelfTest.cpp
index 28eee5bb..6e090730 100644
--- a/tests/CSSLayoutAlignSelfTest.cpp
+++ b/tests/CSSLayoutAlignSelfTest.cpp
@@ -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
- *
-
-
-
-
-
-
-
- *
- */
+ // @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutAlignSelfTest.html
#include
#include
diff --git a/tests/CSSLayoutBorderTest.cpp b/tests/CSSLayoutBorderTest.cpp
index 7e818ba9..56dac071 100644
--- a/tests/CSSLayoutBorderTest.cpp
+++ b/tests/CSSLayoutBorderTest.cpp
@@ -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
- *
-
-
-
-
-
-
-
-
-
-
- *
- */
+ // @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutBorderTest.html
#include
#include
diff --git a/tests/CSSLayoutFlexDirectionTest.cpp b/tests/CSSLayoutFlexDirectionTest.cpp
index 14a1b181..9b319d0d 100644
--- a/tests/CSSLayoutFlexDirectionTest.cpp
+++ b/tests/CSSLayoutFlexDirectionTest.cpp
@@ -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
- *
-
-
-
-
-
-
-
-
-
-
-
- *
- */
+ // @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutFlexDirectionTest.html
#include
#include
diff --git a/tests/CSSLayoutFlexTest.cpp b/tests/CSSLayoutFlexTest.cpp
index a769e9e8..3ccef380 100644
--- a/tests/CSSLayoutFlexTest.cpp
+++ b/tests/CSSLayoutFlexTest.cpp
@@ -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
- *
-
-
-
-
-
-
-
-
-
-
-
-
-
- *
- */
+ // @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutFlexTest.html
#include
#include
diff --git a/tests/CSSLayoutFlexWrapTest.cpp b/tests/CSSLayoutFlexWrapTest.cpp
index a3a16d4e..ae5113c4 100644
--- a/tests/CSSLayoutFlexWrapTest.cpp
+++ b/tests/CSSLayoutFlexWrapTest.cpp
@@ -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
- *
-
-
-
-
-
-
-
- *
- */
+ // @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutFlexWrapTest.html
#include
#include
diff --git a/tests/CSSLayoutJustifyContentTest.cpp b/tests/CSSLayoutJustifyContentTest.cpp
index 17e5e16a..6ac22334 100644
--- a/tests/CSSLayoutJustifyContentTest.cpp
+++ b/tests/CSSLayoutJustifyContentTest.cpp
@@ -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
- *
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- *
- */
+ // @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutJustifyContentTest.html
#include
#include
diff --git a/tests/CSSLayoutMarginTest.cpp b/tests/CSSLayoutMarginTest.cpp
index 75d87d7a..091ef4d0 100644
--- a/tests/CSSLayoutMarginTest.cpp
+++ b/tests/CSSLayoutMarginTest.cpp
@@ -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
- *
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- *
- */
+ // @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutMarginTest.html
#include
#include
diff --git a/tests/CSSLayoutMinMaxDimensionTest.cpp b/tests/CSSLayoutMinMaxDimensionTest.cpp
index b5f162a9..aaf2710a 100644
--- a/tests/CSSLayoutMinMaxDimensionTest.cpp
+++ b/tests/CSSLayoutMinMaxDimensionTest.cpp
@@ -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
- *
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- *
- */
+ // @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutMinMaxDimensionTest.html
#include
#include
diff --git a/tests/CSSLayoutPaddingTest.cpp b/tests/CSSLayoutPaddingTest.cpp
index e802b890..808d8186 100644
--- a/tests/CSSLayoutPaddingTest.cpp
+++ b/tests/CSSLayoutPaddingTest.cpp
@@ -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
- *
-
-
-
-
-
-
-
-
-
-
- *
- */
+ // @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutPaddingTest.html
#include
#include
diff --git a/tests/CSSLayoutRelayoutTest.cpp b/tests/CSSLayoutRelayoutTest.cpp
index fa5226b4..ee4adb36 100644
--- a/tests/CSSLayoutRelayoutTest.cpp
+++ b/tests/CSSLayoutRelayoutTest.cpp
@@ -10,19 +10,9 @@
#include
#include
-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);
}
diff --git a/tests/CSSLayoutRoundingMeasureFuncTest.cpp b/tests/CSSLayoutRoundingMeasureFuncTest.cpp
new file mode 100644
index 00000000..85acd10e
--- /dev/null
+++ b/tests/CSSLayoutRoundingMeasureFuncTest.cpp
@@ -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
+#include
+
+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);
+}
diff --git a/tests/CSSLayoutPixelRoundingTest.cpp b/tests/CSSLayoutRoundingTest.cpp
similarity index 81%
rename from tests/CSSLayoutPixelRoundingTest.cpp
rename to tests/CSSLayoutRoundingTest.cpp
index 8fb3c73a..9991dbaa 100644
--- a/tests/CSSLayoutPixelRoundingTest.cpp
+++ b/tests/CSSLayoutRoundingTest.cpp
@@ -7,67 +7,14 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
-/*
-*
-
-
-
-
-
-
-
-
-
-
-
- *
- */
+ // @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutRoundingTest.html
#include
#include
-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);
}