Add feature to use percentage as value unit
Summary: Adds the feature to use percentage as a value unit. You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience. I did some benchmarks: ``` Without Percentage Feature - Release x86: Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms Nested flex: median: 0.000000 ms, stddev: 0.490101 ms Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms Nested flex: median: 0.000000 ms, stddev: 0.477791 ms Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms With Percentage Feature - Release x86: Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms Nested flex: median: 0.000000 ms, stddev: 0.489570 ms Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms Closes https://github.com/facebook/yoga/pull/258 Reviewed By: dshahidehpour Differential Revision: D4361945 Pulled By: emilsjolander fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
This commit is contained in:
committed by
Facebook Github Bot
parent
6f462a72bf
commit
a85bd4ad2a
@@ -21,15 +21,15 @@ namespace Facebook.Yoga
|
||||
public void Test_absolute_layout_width_height_start_top()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.PositionType = YogaPositionType.Absolute;
|
||||
root_child0.SetPosition(YogaEdge.Start, 10f);
|
||||
root_child0.SetPosition(YogaEdge.Top, 10f);
|
||||
root_child0.Width = 10f;
|
||||
root_child0.Height = 10f;
|
||||
root_child0.SetPosition(YogaEdge.Start, 10);
|
||||
root_child0.SetPosition(YogaEdge.Top, 10);
|
||||
root_child0.Width = 10;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -62,15 +62,15 @@ namespace Facebook.Yoga
|
||||
public void Test_absolute_layout_width_height_end_bottom()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.PositionType = YogaPositionType.Absolute;
|
||||
root_child0.SetPosition(YogaEdge.End, 10f);
|
||||
root_child0.SetPosition(YogaEdge.Bottom, 10f);
|
||||
root_child0.Width = 10f;
|
||||
root_child0.Height = 10f;
|
||||
root_child0.SetPosition(YogaEdge.End, 10);
|
||||
root_child0.SetPosition(YogaEdge.Bottom, 10);
|
||||
root_child0.Width = 10;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -103,15 +103,15 @@ namespace Facebook.Yoga
|
||||
public void Test_absolute_layout_start_top_end_bottom()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.PositionType = YogaPositionType.Absolute;
|
||||
root_child0.SetPosition(YogaEdge.Start, 10f);
|
||||
root_child0.SetPosition(YogaEdge.Top, 10f);
|
||||
root_child0.SetPosition(YogaEdge.End, 10f);
|
||||
root_child0.SetPosition(YogaEdge.Bottom, 10f);
|
||||
root_child0.SetPosition(YogaEdge.Start, 10);
|
||||
root_child0.SetPosition(YogaEdge.Top, 10);
|
||||
root_child0.SetPosition(YogaEdge.End, 10);
|
||||
root_child0.SetPosition(YogaEdge.Bottom, 10);
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -144,17 +144,17 @@ namespace Facebook.Yoga
|
||||
public void Test_absolute_layout_width_height_start_top_end_bottom()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.PositionType = YogaPositionType.Absolute;
|
||||
root_child0.SetPosition(YogaEdge.Start, 10f);
|
||||
root_child0.SetPosition(YogaEdge.Top, 10f);
|
||||
root_child0.SetPosition(YogaEdge.End, 10f);
|
||||
root_child0.SetPosition(YogaEdge.Bottom, 10f);
|
||||
root_child0.Width = 10f;
|
||||
root_child0.Height = 10f;
|
||||
root_child0.SetPosition(YogaEdge.Start, 10);
|
||||
root_child0.SetPosition(YogaEdge.Top, 10);
|
||||
root_child0.SetPosition(YogaEdge.End, 10);
|
||||
root_child0.SetPosition(YogaEdge.Bottom, 10);
|
||||
root_child0.Width = 10;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -189,18 +189,18 @@ namespace Facebook.Yoga
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.Overflow = YogaOverflow.Hidden;
|
||||
root.Width = 50f;
|
||||
root.Height = 50f;
|
||||
root.Width = 50;
|
||||
root.Height = 50;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.PositionType = YogaPositionType.Absolute;
|
||||
root_child0.SetPosition(YogaEdge.Start, 0f);
|
||||
root_child0.SetPosition(YogaEdge.Top, 0f);
|
||||
root_child0.SetPosition(YogaEdge.Start, 0);
|
||||
root_child0.SetPosition(YogaEdge.Top, 0);
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child0_child0 = new YogaNode();
|
||||
root_child0_child0.Width = 100f;
|
||||
root_child0_child0.Height = 100f;
|
||||
root_child0_child0.Width = 100;
|
||||
root_child0_child0.Height = 100;
|
||||
root_child0.Insert(0, root_child0_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -243,35 +243,35 @@ namespace Facebook.Yoga
|
||||
public void Test_absolute_layout_within_border()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.SetMargin(YogaEdge.Left, 10f);
|
||||
root.SetMargin(YogaEdge.Top, 10f);
|
||||
root.SetMargin(YogaEdge.Right, 10f);
|
||||
root.SetMargin(YogaEdge.Bottom, 10f);
|
||||
root.SetPadding(YogaEdge.Left, 10f);
|
||||
root.SetPadding(YogaEdge.Top, 10f);
|
||||
root.SetPadding(YogaEdge.Right, 10f);
|
||||
root.SetPadding(YogaEdge.Bottom, 10f);
|
||||
root.SetBorder(YogaEdge.Left, 10f);
|
||||
root.SetBorder(YogaEdge.Top, 10f);
|
||||
root.SetBorder(YogaEdge.Right, 10f);
|
||||
root.SetBorder(YogaEdge.Bottom, 10f);
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.SetMargin(YogaEdge.Left, 10);
|
||||
root.SetMargin(YogaEdge.Top, 10);
|
||||
root.SetMargin(YogaEdge.Right, 10);
|
||||
root.SetMargin(YogaEdge.Bottom, 10);
|
||||
root.SetPadding(YogaEdge.Left, 10);
|
||||
root.SetPadding(YogaEdge.Top, 10);
|
||||
root.SetPadding(YogaEdge.Right, 10);
|
||||
root.SetPadding(YogaEdge.Bottom, 10);
|
||||
root.SetBorder(YogaEdge.Left, 10);
|
||||
root.SetBorder(YogaEdge.Top, 10);
|
||||
root.SetBorder(YogaEdge.Right, 10);
|
||||
root.SetBorder(YogaEdge.Bottom, 10);
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.PositionType = YogaPositionType.Absolute;
|
||||
root_child0.SetPosition(YogaEdge.Left, 0f);
|
||||
root_child0.SetPosition(YogaEdge.Top, 0f);
|
||||
root_child0.Width = 50f;
|
||||
root_child0.Height = 50f;
|
||||
root_child0.SetPosition(YogaEdge.Left, 0);
|
||||
root_child0.SetPosition(YogaEdge.Top, 0);
|
||||
root_child0.Width = 50;
|
||||
root_child0.Height = 50;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.PositionType = YogaPositionType.Absolute;
|
||||
root_child1.SetPosition(YogaEdge.Right, 0f);
|
||||
root_child1.SetPosition(YogaEdge.Bottom, 0f);
|
||||
root_child1.Width = 50f;
|
||||
root_child1.Height = 50f;
|
||||
root_child1.SetPosition(YogaEdge.Right, 0);
|
||||
root_child1.SetPosition(YogaEdge.Bottom, 0);
|
||||
root_child1.Width = 50;
|
||||
root_child1.Height = 50;
|
||||
root.Insert(1, root_child1);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
@@ -22,32 +22,32 @@ namespace Facebook.Yoga
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.Wrap = YogaWrap.Wrap;
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 50f;
|
||||
root_child0.Height = 10f;
|
||||
root_child0.Width = 50;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.Width = 50f;
|
||||
root_child1.Height = 10f;
|
||||
root_child1.Width = 50;
|
||||
root_child1.Height = 10;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.Width = 50f;
|
||||
root_child2.Height = 10f;
|
||||
root_child2.Width = 50;
|
||||
root_child2.Height = 10;
|
||||
root.Insert(2, root_child2);
|
||||
|
||||
YogaNode root_child3 = new YogaNode();
|
||||
root_child3.Width = 50f;
|
||||
root_child3.Height = 10f;
|
||||
root_child3.Width = 50;
|
||||
root_child3.Height = 10;
|
||||
root.Insert(3, root_child3);
|
||||
|
||||
YogaNode root_child4 = new YogaNode();
|
||||
root_child4.Width = 50f;
|
||||
root_child4.Height = 10f;
|
||||
root_child4.Width = 50;
|
||||
root_child4.Height = 10;
|
||||
root.Insert(4, root_child4);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -122,32 +122,32 @@ namespace Facebook.Yoga
|
||||
YogaNode root = new YogaNode();
|
||||
root.AlignContent = YogaAlign.FlexEnd;
|
||||
root.Wrap = YogaWrap.Wrap;
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 50f;
|
||||
root_child0.Height = 10f;
|
||||
root_child0.Width = 50;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.Width = 50f;
|
||||
root_child1.Height = 10f;
|
||||
root_child1.Width = 50;
|
||||
root_child1.Height = 10;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.Width = 50f;
|
||||
root_child2.Height = 10f;
|
||||
root_child2.Width = 50;
|
||||
root_child2.Height = 10;
|
||||
root.Insert(2, root_child2);
|
||||
|
||||
YogaNode root_child3 = new YogaNode();
|
||||
root_child3.Width = 50f;
|
||||
root_child3.Height = 10f;
|
||||
root_child3.Width = 50;
|
||||
root_child3.Height = 10;
|
||||
root.Insert(3, root_child3);
|
||||
|
||||
YogaNode root_child4 = new YogaNode();
|
||||
root_child4.Width = 50f;
|
||||
root_child4.Height = 10f;
|
||||
root_child4.Width = 50;
|
||||
root_child4.Height = 10;
|
||||
root.Insert(4, root_child4);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -222,32 +222,32 @@ namespace Facebook.Yoga
|
||||
YogaNode root = new YogaNode();
|
||||
root.AlignContent = YogaAlign.Center;
|
||||
root.Wrap = YogaWrap.Wrap;
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 50f;
|
||||
root_child0.Height = 10f;
|
||||
root_child0.Width = 50;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.Width = 50f;
|
||||
root_child1.Height = 10f;
|
||||
root_child1.Width = 50;
|
||||
root_child1.Height = 10;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.Width = 50f;
|
||||
root_child2.Height = 10f;
|
||||
root_child2.Width = 50;
|
||||
root_child2.Height = 10;
|
||||
root.Insert(2, root_child2);
|
||||
|
||||
YogaNode root_child3 = new YogaNode();
|
||||
root_child3.Width = 50f;
|
||||
root_child3.Height = 10f;
|
||||
root_child3.Width = 50;
|
||||
root_child3.Height = 10;
|
||||
root.Insert(3, root_child3);
|
||||
|
||||
YogaNode root_child4 = new YogaNode();
|
||||
root_child4.Width = 50f;
|
||||
root_child4.Height = 10f;
|
||||
root_child4.Width = 50;
|
||||
root_child4.Height = 10;
|
||||
root.Insert(4, root_child4);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -322,27 +322,27 @@ namespace Facebook.Yoga
|
||||
YogaNode root = new YogaNode();
|
||||
root.AlignContent = YogaAlign.Stretch;
|
||||
root.Wrap = YogaWrap.Wrap;
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 50f;
|
||||
root_child0.Width = 50;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.Width = 50f;
|
||||
root_child1.Width = 50;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.Width = 50f;
|
||||
root_child2.Width = 50;
|
||||
root.Insert(2, root_child2);
|
||||
|
||||
YogaNode root_child3 = new YogaNode();
|
||||
root_child3.Width = 50f;
|
||||
root_child3.Width = 50;
|
||||
root.Insert(3, root_child3);
|
||||
|
||||
YogaNode root_child4 = new YogaNode();
|
||||
root_child4.Width = 50f;
|
||||
root_child4.Width = 50;
|
||||
root.Insert(4, root_child4);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
@@ -21,11 +21,11 @@ namespace Facebook.Yoga
|
||||
public void Test_align_items_stretch()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Height = 10f;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -59,12 +59,12 @@ namespace Facebook.Yoga
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.AlignItems = YogaAlign.Center;
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 10f;
|
||||
root_child0.Height = 10f;
|
||||
root_child0.Width = 10;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -98,12 +98,12 @@ namespace Facebook.Yoga
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.AlignItems = YogaAlign.FlexStart;
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 10f;
|
||||
root_child0.Height = 10f;
|
||||
root_child0.Width = 10;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -137,12 +137,12 @@ namespace Facebook.Yoga
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.AlignItems = YogaAlign.FlexEnd;
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 10f;
|
||||
root_child0.Height = 10f;
|
||||
root_child0.Width = 10;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
@@ -21,13 +21,13 @@ namespace Facebook.Yoga
|
||||
public void Test_align_self_center()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.AlignSelf = YogaAlign.Center;
|
||||
root_child0.Width = 10f;
|
||||
root_child0.Height = 10f;
|
||||
root_child0.Width = 10;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -60,13 +60,13 @@ namespace Facebook.Yoga
|
||||
public void Test_align_self_flex_end()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.AlignSelf = YogaAlign.FlexEnd;
|
||||
root_child0.Width = 10f;
|
||||
root_child0.Height = 10f;
|
||||
root_child0.Width = 10;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -99,13 +99,13 @@ namespace Facebook.Yoga
|
||||
public void Test_align_self_flex_start()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.AlignSelf = YogaAlign.FlexStart;
|
||||
root_child0.Width = 10f;
|
||||
root_child0.Height = 10f;
|
||||
root_child0.Width = 10;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -139,13 +139,13 @@ namespace Facebook.Yoga
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.AlignItems = YogaAlign.FlexStart;
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.AlignSelf = YogaAlign.FlexEnd;
|
||||
root_child0.Width = 10f;
|
||||
root_child0.Height = 10f;
|
||||
root_child0.Width = 10;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
@@ -21,10 +21,10 @@ namespace Facebook.Yoga
|
||||
public void Test_border_no_size()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.SetBorder(YogaEdge.Left, 10f);
|
||||
root.SetBorder(YogaEdge.Top, 10f);
|
||||
root.SetBorder(YogaEdge.Right, 10f);
|
||||
root.SetBorder(YogaEdge.Bottom, 10f);
|
||||
root.SetBorder(YogaEdge.Left, 10);
|
||||
root.SetBorder(YogaEdge.Top, 10);
|
||||
root.SetBorder(YogaEdge.Right, 10);
|
||||
root.SetBorder(YogaEdge.Bottom, 10);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
||||
@@ -46,14 +46,14 @@ namespace Facebook.Yoga
|
||||
public void Test_border_container_match_child()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.SetBorder(YogaEdge.Left, 10f);
|
||||
root.SetBorder(YogaEdge.Top, 10f);
|
||||
root.SetBorder(YogaEdge.Right, 10f);
|
||||
root.SetBorder(YogaEdge.Bottom, 10f);
|
||||
root.SetBorder(YogaEdge.Left, 10);
|
||||
root.SetBorder(YogaEdge.Top, 10);
|
||||
root.SetBorder(YogaEdge.Right, 10);
|
||||
root.SetBorder(YogaEdge.Bottom, 10);
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 10f;
|
||||
root_child0.Height = 10f;
|
||||
root_child0.Width = 10;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -86,16 +86,16 @@ namespace Facebook.Yoga
|
||||
public void Test_border_flex_child()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.SetBorder(YogaEdge.Left, 10f);
|
||||
root.SetBorder(YogaEdge.Top, 10f);
|
||||
root.SetBorder(YogaEdge.Right, 10f);
|
||||
root.SetBorder(YogaEdge.Bottom, 10f);
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.SetBorder(YogaEdge.Left, 10);
|
||||
root.SetBorder(YogaEdge.Top, 10);
|
||||
root.SetBorder(YogaEdge.Right, 10);
|
||||
root.SetBorder(YogaEdge.Bottom, 10);
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1f;
|
||||
root_child0.Width = 10f;
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.Width = 10;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -128,15 +128,15 @@ namespace Facebook.Yoga
|
||||
public void Test_border_stretch_child()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.SetBorder(YogaEdge.Left, 10f);
|
||||
root.SetBorder(YogaEdge.Top, 10f);
|
||||
root.SetBorder(YogaEdge.Right, 10f);
|
||||
root.SetBorder(YogaEdge.Bottom, 10f);
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.SetBorder(YogaEdge.Left, 10);
|
||||
root.SetBorder(YogaEdge.Top, 10);
|
||||
root.SetBorder(YogaEdge.Right, 10);
|
||||
root.SetBorder(YogaEdge.Bottom, 10);
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Height = 10f;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -171,15 +171,15 @@ namespace Facebook.Yoga
|
||||
YogaNode root = new YogaNode();
|
||||
root.JustifyContent = YogaJustify.Center;
|
||||
root.AlignItems = YogaAlign.Center;
|
||||
root.SetBorder(YogaEdge.Start, 10f);
|
||||
root.SetBorder(YogaEdge.End, 20f);
|
||||
root.SetBorder(YogaEdge.Bottom, 20f);
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.SetBorder(YogaEdge.Start, 10);
|
||||
root.SetBorder(YogaEdge.End, 20);
|
||||
root.SetBorder(YogaEdge.Bottom, 20);
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 10f;
|
||||
root_child0.Height = 10f;
|
||||
root_child0.Width = 10;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
@@ -21,18 +21,18 @@ namespace Facebook.Yoga
|
||||
public void Test_flex_direction_column_no_height()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 100f;
|
||||
root.Width = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Height = 10f;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.Height = 10f;
|
||||
root_child1.Height = 10;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.Height = 10f;
|
||||
root_child2.Height = 10;
|
||||
root.Insert(2, root_child2);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -86,18 +86,18 @@ namespace Facebook.Yoga
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.Height = 100f;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 10f;
|
||||
root_child0.Width = 10;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.Width = 10f;
|
||||
root_child1.Width = 10;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.Width = 10f;
|
||||
root_child2.Width = 10;
|
||||
root.Insert(2, root_child2);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -150,19 +150,19 @@ namespace Facebook.Yoga
|
||||
public void Test_flex_direction_column()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Height = 10f;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.Height = 10f;
|
||||
root_child1.Height = 10;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.Height = 10f;
|
||||
root_child2.Height = 10;
|
||||
root.Insert(2, root_child2);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -216,19 +216,19 @@ namespace Facebook.Yoga
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 10f;
|
||||
root_child0.Width = 10;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.Width = 10f;
|
||||
root_child1.Width = 10;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.Width = 10f;
|
||||
root_child2.Width = 10;
|
||||
root.Insert(2, root_child2);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -282,19 +282,19 @@ namespace Facebook.Yoga
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.ColumnReverse;
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Height = 10f;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.Height = 10f;
|
||||
root_child1.Height = 10;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.Height = 10f;
|
||||
root_child2.Height = 10;
|
||||
root.Insert(2, root_child2);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -348,19 +348,19 @@ namespace Facebook.Yoga
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.RowReverse;
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 10f;
|
||||
root_child0.Width = 10;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.Width = 10f;
|
||||
root_child1.Width = 10;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.Width = 10f;
|
||||
root_child2.Width = 10;
|
||||
root.Insert(2, root_child2);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
@@ -21,16 +21,16 @@ namespace Facebook.Yoga
|
||||
public void Test_flex_basis_flex_grow_column()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1f;
|
||||
root_child0.FlexBasis = 50f;
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.FlexBasis = 50;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.FlexGrow = 1f;
|
||||
root_child1.FlexGrow = 1;
|
||||
root.Insert(1, root_child1);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -74,16 +74,16 @@ namespace Facebook.Yoga
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1f;
|
||||
root_child0.FlexBasis = 50f;
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.FlexBasis = 50;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.FlexGrow = 1f;
|
||||
root_child1.FlexGrow = 1;
|
||||
root.Insert(1, root_child1);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -126,16 +126,16 @@ namespace Facebook.Yoga
|
||||
public void Test_flex_basis_flex_shrink_column()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexShrink = 1f;
|
||||
root_child0.FlexBasis = 100f;
|
||||
root_child0.FlexShrink = 1;
|
||||
root_child0.FlexBasis = 100;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.FlexBasis = 50f;
|
||||
root_child1.FlexBasis = 50;
|
||||
root.Insert(1, root_child1);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -179,16 +179,16 @@ namespace Facebook.Yoga
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexShrink = 1f;
|
||||
root_child0.FlexBasis = 100f;
|
||||
root_child0.FlexShrink = 1;
|
||||
root_child0.FlexBasis = 100;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.FlexBasis = 50f;
|
||||
root_child1.FlexBasis = 50;
|
||||
root.Insert(1, root_child1);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -231,22 +231,22 @@ namespace Facebook.Yoga
|
||||
public void Test_flex_shrink_to_zero()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.Height = 75f;
|
||||
root.Height = 75;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 50f;
|
||||
root_child0.Height = 50f;
|
||||
root_child0.Width = 50;
|
||||
root_child0.Height = 50;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.FlexShrink = 1f;
|
||||
root_child1.Width = 50f;
|
||||
root_child1.Height = 50f;
|
||||
root_child1.FlexShrink = 1;
|
||||
root_child1.Width = 50;
|
||||
root_child1.Height = 50;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.Width = 50f;
|
||||
root_child2.Height = 50f;
|
||||
root_child2.Width = 50;
|
||||
root_child2.Height = 50;
|
||||
root.Insert(2, root_child2);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -299,23 +299,23 @@ namespace Facebook.Yoga
|
||||
public void Test_flex_basis_overrides_main_size()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1f;
|
||||
root_child0.FlexBasis = 50f;
|
||||
root_child0.Height = 20f;
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.FlexBasis = 50;
|
||||
root_child0.Height = 20;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.FlexGrow = 1f;
|
||||
root_child1.Height = 10f;
|
||||
root_child1.FlexGrow = 1;
|
||||
root_child1.Height = 10;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.FlexGrow = 1f;
|
||||
root_child2.Height = 10f;
|
||||
root_child2.FlexGrow = 1;
|
||||
root_child2.Height = 10;
|
||||
root.Insert(2, root_child2);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -368,15 +368,15 @@ namespace Facebook.Yoga
|
||||
public void Test_flex_grow_shrink_at_most()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child0_child0 = new YogaNode();
|
||||
root_child0_child0.FlexGrow = 1f;
|
||||
root_child0_child0.FlexShrink = 1f;
|
||||
root_child0_child0.FlexGrow = 1;
|
||||
root_child0_child0.FlexShrink = 1;
|
||||
root_child0.Insert(0, root_child0_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
@@ -22,26 +22,26 @@ namespace Facebook.Yoga
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.Wrap = YogaWrap.Wrap;
|
||||
root.Height = 100f;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 30f;
|
||||
root_child0.Height = 30f;
|
||||
root_child0.Width = 30;
|
||||
root_child0.Height = 30;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.Width = 30f;
|
||||
root_child1.Height = 30f;
|
||||
root_child1.Width = 30;
|
||||
root_child1.Height = 30;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.Width = 30f;
|
||||
root_child2.Height = 30f;
|
||||
root_child2.Width = 30;
|
||||
root_child2.Height = 30;
|
||||
root.Insert(2, root_child2);
|
||||
|
||||
YogaNode root_child3 = new YogaNode();
|
||||
root_child3.Width = 30f;
|
||||
root_child3.Height = 30f;
|
||||
root_child3.Width = 30;
|
||||
root_child3.Height = 30;
|
||||
root.Insert(3, root_child3);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -106,26 +106,26 @@ namespace Facebook.Yoga
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.Wrap = YogaWrap.Wrap;
|
||||
root.Width = 100f;
|
||||
root.Width = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 30f;
|
||||
root_child0.Height = 30f;
|
||||
root_child0.Width = 30;
|
||||
root_child0.Height = 30;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.Width = 30f;
|
||||
root_child1.Height = 30f;
|
||||
root_child1.Width = 30;
|
||||
root_child1.Height = 30;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.Width = 30f;
|
||||
root_child2.Height = 30f;
|
||||
root_child2.Width = 30;
|
||||
root_child2.Height = 30;
|
||||
root.Insert(2, root_child2);
|
||||
|
||||
YogaNode root_child3 = new YogaNode();
|
||||
root_child3.Width = 30f;
|
||||
root_child3.Height = 30f;
|
||||
root_child3.Width = 30;
|
||||
root_child3.Height = 30;
|
||||
root.Insert(3, root_child3);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -191,26 +191,26 @@ namespace Facebook.Yoga
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.AlignItems = YogaAlign.FlexEnd;
|
||||
root.Wrap = YogaWrap.Wrap;
|
||||
root.Width = 100f;
|
||||
root.Width = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 30f;
|
||||
root_child0.Height = 10f;
|
||||
root_child0.Width = 30;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.Width = 30f;
|
||||
root_child1.Height = 20f;
|
||||
root_child1.Width = 30;
|
||||
root_child1.Height = 20;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.Width = 30f;
|
||||
root_child2.Height = 30f;
|
||||
root_child2.Width = 30;
|
||||
root_child2.Height = 30;
|
||||
root.Insert(2, root_child2);
|
||||
|
||||
YogaNode root_child3 = new YogaNode();
|
||||
root_child3.Width = 30f;
|
||||
root_child3.Height = 30f;
|
||||
root_child3.Width = 30;
|
||||
root_child3.Height = 30;
|
||||
root.Insert(3, root_child3);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -276,26 +276,26 @@ namespace Facebook.Yoga
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.AlignItems = YogaAlign.Center;
|
||||
root.Wrap = YogaWrap.Wrap;
|
||||
root.Width = 100f;
|
||||
root.Width = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 30f;
|
||||
root_child0.Height = 10f;
|
||||
root_child0.Width = 30;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.Width = 30f;
|
||||
root_child1.Height = 20f;
|
||||
root_child1.Width = 30;
|
||||
root_child1.Height = 20;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.Width = 30f;
|
||||
root_child2.Height = 30f;
|
||||
root_child2.Width = 30;
|
||||
root_child2.Height = 30;
|
||||
root.Insert(2, root_child2);
|
||||
|
||||
YogaNode root_child3 = new YogaNode();
|
||||
root_child3.Width = 30f;
|
||||
root_child3.Height = 30f;
|
||||
root_child3.Width = 30;
|
||||
root_child3.Height = 30;
|
||||
root.Insert(3, root_child3);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
@@ -22,19 +22,19 @@ namespace Facebook.Yoga
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.Width = 102f;
|
||||
root.Height = 102f;
|
||||
root.Width = 102;
|
||||
root.Height = 102;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 10f;
|
||||
root_child0.Width = 10;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.Width = 10f;
|
||||
root_child1.Width = 10;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.Width = 10f;
|
||||
root_child2.Width = 10;
|
||||
root.Insert(2, root_child2);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -89,19 +89,19 @@ namespace Facebook.Yoga
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.JustifyContent = YogaJustify.FlexEnd;
|
||||
root.Width = 102f;
|
||||
root.Height = 102f;
|
||||
root.Width = 102;
|
||||
root.Height = 102;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 10f;
|
||||
root_child0.Width = 10;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.Width = 10f;
|
||||
root_child1.Width = 10;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.Width = 10f;
|
||||
root_child2.Width = 10;
|
||||
root.Insert(2, root_child2);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -156,19 +156,19 @@ namespace Facebook.Yoga
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.JustifyContent = YogaJustify.Center;
|
||||
root.Width = 102f;
|
||||
root.Height = 102f;
|
||||
root.Width = 102;
|
||||
root.Height = 102;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 10f;
|
||||
root_child0.Width = 10;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.Width = 10f;
|
||||
root_child1.Width = 10;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.Width = 10f;
|
||||
root_child2.Width = 10;
|
||||
root.Insert(2, root_child2);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -223,19 +223,19 @@ namespace Facebook.Yoga
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.JustifyContent = YogaJustify.SpaceBetween;
|
||||
root.Width = 102f;
|
||||
root.Height = 102f;
|
||||
root.Width = 102;
|
||||
root.Height = 102;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 10f;
|
||||
root_child0.Width = 10;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.Width = 10f;
|
||||
root_child1.Width = 10;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.Width = 10f;
|
||||
root_child2.Width = 10;
|
||||
root.Insert(2, root_child2);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -290,19 +290,19 @@ namespace Facebook.Yoga
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.JustifyContent = YogaJustify.SpaceAround;
|
||||
root.Width = 102f;
|
||||
root.Height = 102f;
|
||||
root.Width = 102;
|
||||
root.Height = 102;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 10f;
|
||||
root_child0.Width = 10;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.Width = 10f;
|
||||
root_child1.Width = 10;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.Width = 10f;
|
||||
root_child2.Width = 10;
|
||||
root.Insert(2, root_child2);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -355,18 +355,18 @@ namespace Facebook.Yoga
|
||||
public void Test_justify_content_column_flex_start()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 102f;
|
||||
root.Height = 102f;
|
||||
root.Width = 102;
|
||||
root.Height = 102;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Height = 10f;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.Height = 10f;
|
||||
root_child2.Height = 10;
|
||||
root.Insert(2, root_child2);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -420,19 +420,19 @@ namespace Facebook.Yoga
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.JustifyContent = YogaJustify.FlexEnd;
|
||||
root.Width = 102f;
|
||||
root.Height = 102f;
|
||||
root.Width = 102;
|
||||
root.Height = 102;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Height = 10f;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.Height = 10f;
|
||||
root_child1.Height = 10;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.Height = 10f;
|
||||
root_child2.Height = 10;
|
||||
root.Insert(2, root_child2);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -486,19 +486,19 @@ namespace Facebook.Yoga
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.JustifyContent = YogaJustify.Center;
|
||||
root.Width = 102f;
|
||||
root.Height = 102f;
|
||||
root.Width = 102;
|
||||
root.Height = 102;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Height = 10f;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.Height = 10f;
|
||||
root_child1.Height = 10;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.Height = 10f;
|
||||
root_child2.Height = 10;
|
||||
root.Insert(2, root_child2);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -552,19 +552,19 @@ namespace Facebook.Yoga
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.JustifyContent = YogaJustify.SpaceBetween;
|
||||
root.Width = 102f;
|
||||
root.Height = 102f;
|
||||
root.Width = 102;
|
||||
root.Height = 102;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Height = 10f;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.Height = 10f;
|
||||
root_child1.Height = 10;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.Height = 10f;
|
||||
root_child2.Height = 10;
|
||||
root.Insert(2, root_child2);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -618,19 +618,19 @@ namespace Facebook.Yoga
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.JustifyContent = YogaJustify.SpaceAround;
|
||||
root.Width = 102f;
|
||||
root.Height = 102f;
|
||||
root.Width = 102;
|
||||
root.Height = 102;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Height = 10f;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.Height = 10f;
|
||||
root_child1.Height = 10;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.Height = 10f;
|
||||
root_child2.Height = 10;
|
||||
root.Insert(2, root_child2);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
@@ -22,12 +22,12 @@ namespace Facebook.Yoga
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.SetMargin(YogaEdge.Start, 10f);
|
||||
root_child0.Width = 10f;
|
||||
root_child0.SetMargin(YogaEdge.Start, 10);
|
||||
root_child0.Width = 10;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -60,12 +60,12 @@ namespace Facebook.Yoga
|
||||
public void Test_margin_top()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.SetMargin(YogaEdge.Top, 10f);
|
||||
root_child0.Height = 10f;
|
||||
root_child0.SetMargin(YogaEdge.Top, 10);
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -100,12 +100,12 @@ namespace Facebook.Yoga
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.JustifyContent = YogaJustify.FlexEnd;
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.SetMargin(YogaEdge.End, 10f);
|
||||
root_child0.Width = 10f;
|
||||
root_child0.SetMargin(YogaEdge.End, 10);
|
||||
root_child0.Width = 10;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -139,12 +139,12 @@ namespace Facebook.Yoga
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.JustifyContent = YogaJustify.FlexEnd;
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.SetMargin(YogaEdge.Bottom, 10f);
|
||||
root_child0.Height = 10f;
|
||||
root_child0.SetMargin(YogaEdge.Bottom, 10);
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -178,12 +178,12 @@ namespace Facebook.Yoga
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1f;
|
||||
root_child0.SetMargin(YogaEdge.Start, 10f);
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.SetMargin(YogaEdge.Start, 10);
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -216,12 +216,12 @@ namespace Facebook.Yoga
|
||||
public void Test_margin_and_flex_column()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1f;
|
||||
root_child0.SetMargin(YogaEdge.Top, 10f);
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.SetMargin(YogaEdge.Top, 10);
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -255,12 +255,12 @@ namespace Facebook.Yoga
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1f;
|
||||
root_child0.SetMargin(YogaEdge.Top, 10f);
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.SetMargin(YogaEdge.Top, 10);
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -293,12 +293,12 @@ namespace Facebook.Yoga
|
||||
public void Test_margin_and_stretch_column()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1f;
|
||||
root_child0.SetMargin(YogaEdge.Start, 10f);
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.SetMargin(YogaEdge.Start, 10);
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -332,15 +332,15 @@ namespace Facebook.Yoga
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1f;
|
||||
root_child0.FlexGrow = 1;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.FlexGrow = 1f;
|
||||
root_child1.FlexGrow = 1;
|
||||
root.Insert(1, root_child1);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -383,15 +383,15 @@ namespace Facebook.Yoga
|
||||
public void Test_margin_with_sibling_column()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1f;
|
||||
root_child0.FlexGrow = 1;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.FlexGrow = 1f;
|
||||
root_child1.FlexGrow = 1;
|
||||
root.Insert(1, root_child1);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
@@ -21,12 +21,12 @@ namespace Facebook.Yoga
|
||||
public void Test_max_width()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.MaxWidth = 50f;
|
||||
root_child0.Height = 10f;
|
||||
root_child0.MaxWidth = 50;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -60,12 +60,12 @@ namespace Facebook.Yoga
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 10f;
|
||||
root_child0.MaxHeight = 50f;
|
||||
root_child0.Width = 10;
|
||||
root_child0.MaxHeight = 50;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -98,16 +98,16 @@ namespace Facebook.Yoga
|
||||
public void Test_min_height()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1f;
|
||||
root_child0.MinHeight = 60f;
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.MinHeight = 60;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.FlexGrow = 1f;
|
||||
root_child1.FlexGrow = 1;
|
||||
root.Insert(1, root_child1);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -151,16 +151,16 @@ namespace Facebook.Yoga
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1f;
|
||||
root_child0.MinWidth = 60f;
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.MinWidth = 60;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.FlexGrow = 1f;
|
||||
root_child1.FlexGrow = 1;
|
||||
root.Insert(1, root_child1);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -204,13 +204,13 @@ namespace Facebook.Yoga
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.JustifyContent = YogaJustify.Center;
|
||||
root.Width = 100f;
|
||||
root.MinHeight = 100f;
|
||||
root.MaxHeight = 200f;
|
||||
root.Width = 100;
|
||||
root.MinHeight = 100;
|
||||
root.MaxHeight = 200;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 60f;
|
||||
root_child0.Height = 60f;
|
||||
root_child0.Width = 60;
|
||||
root_child0.Height = 60;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -244,13 +244,13 @@ namespace Facebook.Yoga
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.AlignItems = YogaAlign.Center;
|
||||
root.MinWidth = 100f;
|
||||
root.MaxWidth = 200f;
|
||||
root.Height = 100f;
|
||||
root.MinWidth = 100;
|
||||
root.MaxWidth = 200;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 60f;
|
||||
root_child0.Height = 60f;
|
||||
root_child0.Width = 60;
|
||||
root_child0.Height = 60;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -284,22 +284,22 @@ namespace Facebook.Yoga
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.JustifyContent = YogaJustify.Center;
|
||||
root.MinHeight = 100f;
|
||||
root.MaxHeight = 110f;
|
||||
root.MinHeight = 100;
|
||||
root.MaxHeight = 110;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 50f;
|
||||
root_child0.Height = 50f;
|
||||
root_child0.Width = 50;
|
||||
root_child0.Height = 50;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.Width = 50f;
|
||||
root_child1.Height = 50f;
|
||||
root_child1.Width = 50;
|
||||
root_child1.Height = 50;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.Width = 50f;
|
||||
root_child2.Height = 50f;
|
||||
root_child2.Width = 50;
|
||||
root_child2.Height = 50;
|
||||
root.Insert(2, root_child2);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -352,17 +352,17 @@ namespace Facebook.Yoga
|
||||
public void Test_flex_grow_within_max_width()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 200f;
|
||||
root.Height = 100f;
|
||||
root.Width = 200;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexDirection = YogaFlexDirection.Row;
|
||||
root_child0.MaxWidth = 100f;
|
||||
root_child0.MaxWidth = 100;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child0_child0 = new YogaNode();
|
||||
root_child0_child0.FlexGrow = 1f;
|
||||
root_child0_child0.Height = 20f;
|
||||
root_child0_child0.FlexGrow = 1;
|
||||
root_child0_child0.Height = 20;
|
||||
root_child0.Insert(0, root_child0_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -405,17 +405,17 @@ namespace Facebook.Yoga
|
||||
public void Test_flex_grow_within_constrained_max_width()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 200f;
|
||||
root.Height = 100f;
|
||||
root.Width = 200;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexDirection = YogaFlexDirection.Row;
|
||||
root_child0.MaxWidth = 300f;
|
||||
root_child0.MaxWidth = 300;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child0_child0 = new YogaNode();
|
||||
root_child0_child0.FlexGrow = 1f;
|
||||
root_child0_child0.Height = 20f;
|
||||
root_child0_child0.FlexGrow = 1;
|
||||
root_child0_child0.Height = 20;
|
||||
root_child0.Insert(0, root_child0_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -459,15 +459,15 @@ namespace Facebook.Yoga
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.MinWidth = 100f;
|
||||
root.Height = 100f;
|
||||
root.MinWidth = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1f;
|
||||
root_child0.FlexGrow = 1;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.Width = 50f;
|
||||
root_child1.Width = 50;
|
||||
root.Insert(1, root_child1);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -510,14 +510,14 @@ namespace Facebook.Yoga
|
||||
public void Test_flex_grow_within_constrained_min_column()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.MinHeight = 100f;
|
||||
root.MinHeight = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1f;
|
||||
root_child0.FlexGrow = 1;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.Height = 50f;
|
||||
root_child1.Height = 50;
|
||||
root.Insert(1, root_child1);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -560,21 +560,21 @@ namespace Facebook.Yoga
|
||||
public void Test_flex_grow_within_constrained_max_row()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 200f;
|
||||
root.Width = 200;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexDirection = YogaFlexDirection.Row;
|
||||
root_child0.MaxWidth = 100f;
|
||||
root_child0.Height = 100f;
|
||||
root_child0.MaxWidth = 100;
|
||||
root_child0.Height = 100;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child0_child0 = new YogaNode();
|
||||
root_child0_child0.FlexShrink = 1f;
|
||||
root_child0_child0.FlexBasis = 100f;
|
||||
root_child0_child0.FlexShrink = 1;
|
||||
root_child0_child0.FlexBasis = 100;
|
||||
root_child0.Insert(0, root_child0_child0);
|
||||
|
||||
YogaNode root_child0_child1 = new YogaNode();
|
||||
root_child0_child1.Width = 50f;
|
||||
root_child0_child1.Width = 50;
|
||||
root_child0.Insert(1, root_child0_child1);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -627,16 +627,16 @@ namespace Facebook.Yoga
|
||||
public void Test_flex_grow_within_constrained_max_column()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 100f;
|
||||
root.MaxHeight = 100f;
|
||||
root.Width = 100;
|
||||
root.MaxHeight = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexShrink = 1f;
|
||||
root_child0.FlexBasis = 100f;
|
||||
root_child0.FlexShrink = 1;
|
||||
root_child0.FlexBasis = 100;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.Height = 50f;
|
||||
root_child1.Height = 50;
|
||||
root.Insert(1, root_child1);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
@@ -21,10 +21,10 @@ namespace Facebook.Yoga
|
||||
public void Test_padding_no_size()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.SetPadding(YogaEdge.Left, 10f);
|
||||
root.SetPadding(YogaEdge.Top, 10f);
|
||||
root.SetPadding(YogaEdge.Right, 10f);
|
||||
root.SetPadding(YogaEdge.Bottom, 10f);
|
||||
root.SetPadding(YogaEdge.Left, 10);
|
||||
root.SetPadding(YogaEdge.Top, 10);
|
||||
root.SetPadding(YogaEdge.Right, 10);
|
||||
root.SetPadding(YogaEdge.Bottom, 10);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
||||
@@ -46,14 +46,14 @@ namespace Facebook.Yoga
|
||||
public void Test_padding_container_match_child()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.SetPadding(YogaEdge.Left, 10f);
|
||||
root.SetPadding(YogaEdge.Top, 10f);
|
||||
root.SetPadding(YogaEdge.Right, 10f);
|
||||
root.SetPadding(YogaEdge.Bottom, 10f);
|
||||
root.SetPadding(YogaEdge.Left, 10);
|
||||
root.SetPadding(YogaEdge.Top, 10);
|
||||
root.SetPadding(YogaEdge.Right, 10);
|
||||
root.SetPadding(YogaEdge.Bottom, 10);
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 10f;
|
||||
root_child0.Height = 10f;
|
||||
root_child0.Width = 10;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -86,16 +86,16 @@ namespace Facebook.Yoga
|
||||
public void Test_padding_flex_child()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.SetPadding(YogaEdge.Left, 10f);
|
||||
root.SetPadding(YogaEdge.Top, 10f);
|
||||
root.SetPadding(YogaEdge.Right, 10f);
|
||||
root.SetPadding(YogaEdge.Bottom, 10f);
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.SetPadding(YogaEdge.Left, 10);
|
||||
root.SetPadding(YogaEdge.Top, 10);
|
||||
root.SetPadding(YogaEdge.Right, 10);
|
||||
root.SetPadding(YogaEdge.Bottom, 10);
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1f;
|
||||
root_child0.Width = 10f;
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.Width = 10;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -128,15 +128,15 @@ namespace Facebook.Yoga
|
||||
public void Test_padding_stretch_child()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.SetPadding(YogaEdge.Left, 10f);
|
||||
root.SetPadding(YogaEdge.Top, 10f);
|
||||
root.SetPadding(YogaEdge.Right, 10f);
|
||||
root.SetPadding(YogaEdge.Bottom, 10f);
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.SetPadding(YogaEdge.Left, 10);
|
||||
root.SetPadding(YogaEdge.Top, 10);
|
||||
root.SetPadding(YogaEdge.Right, 10);
|
||||
root.SetPadding(YogaEdge.Bottom, 10);
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Height = 10f;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -171,15 +171,15 @@ namespace Facebook.Yoga
|
||||
YogaNode root = new YogaNode();
|
||||
root.JustifyContent = YogaJustify.Center;
|
||||
root.AlignItems = YogaAlign.Center;
|
||||
root.SetPadding(YogaEdge.Start, 10f);
|
||||
root.SetPadding(YogaEdge.End, 20f);
|
||||
root.SetPadding(YogaEdge.Bottom, 20f);
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.SetPadding(YogaEdge.Start, 10);
|
||||
root.SetPadding(YogaEdge.End, 20);
|
||||
root.SetPadding(YogaEdge.Bottom, 20);
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 10f;
|
||||
root_child0.Height = 10f;
|
||||
root_child0.Width = 10;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -214,16 +214,16 @@ namespace Facebook.Yoga
|
||||
YogaNode root = new YogaNode();
|
||||
root.JustifyContent = YogaJustify.FlexEnd;
|
||||
root.AlignItems = YogaAlign.FlexEnd;
|
||||
root.Width = 200f;
|
||||
root.Height = 200f;
|
||||
root.Width = 200;
|
||||
root.Height = 200;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.SetPadding(YogaEdge.Left, 20f);
|
||||
root_child0.SetPadding(YogaEdge.Top, 20f);
|
||||
root_child0.SetPadding(YogaEdge.Right, 20f);
|
||||
root_child0.SetPadding(YogaEdge.Bottom, 20f);
|
||||
root_child0.Width = 100f;
|
||||
root_child0.Height = 100f;
|
||||
root_child0.SetPadding(YogaEdge.Left, 20);
|
||||
root_child0.SetPadding(YogaEdge.Top, 20);
|
||||
root_child0.SetPadding(YogaEdge.Right, 20);
|
||||
root_child0.SetPadding(YogaEdge.Bottom, 20);
|
||||
root_child0.Width = 100;
|
||||
root_child0.Height = 100;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
959
csharp/tests/Facebook.Yoga/YGPercentageTest.cs
Normal file
959
csharp/tests/Facebook.Yoga/YGPercentageTest.cs
Normal file
@@ -0,0 +1,959 @@
|
||||
/**
|
||||
* 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/YGPercentageTest.html
|
||||
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
[TestFixture]
|
||||
public class YGPercentageTest
|
||||
{
|
||||
[Test]
|
||||
public void Test_percentage_width_height()
|
||||
{
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
|
||||
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.Width = 200;
|
||||
root.Height = 200;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 30.Percent();
|
||||
root_child0.Height = 30.Percent();
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(200f, root.LayoutWidth);
|
||||
Assert.AreEqual(200f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(60f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(60f, root_child0.LayoutHeight);
|
||||
|
||||
root.StyleDirection = YogaDirection.RTL;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(200f, root.LayoutWidth);
|
||||
Assert.AreEqual(200f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(140f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(60f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(60f, root_child0.LayoutHeight);
|
||||
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_percentage_position_left_top()
|
||||
{
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
|
||||
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.Width = 400;
|
||||
root.Height = 400;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.SetPosition(YogaEdge.Left, 10.Percent());
|
||||
root_child0.SetPosition(YogaEdge.Top, 20.Percent());
|
||||
root_child0.Width = 45.Percent();
|
||||
root_child0.Height = 55.Percent();
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(400f, root.LayoutWidth);
|
||||
Assert.AreEqual(400f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(40f, root_child0.LayoutX);
|
||||
Assert.AreEqual(80f, root_child0.LayoutY);
|
||||
Assert.AreEqual(180f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(220f, root_child0.LayoutHeight);
|
||||
|
||||
root.StyleDirection = YogaDirection.RTL;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(400f, root.LayoutWidth);
|
||||
Assert.AreEqual(400f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(260f, root_child0.LayoutX);
|
||||
Assert.AreEqual(80f, root_child0.LayoutY);
|
||||
Assert.AreEqual(180f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(220f, root_child0.LayoutHeight);
|
||||
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_percentage_position_bottom_right()
|
||||
{
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
|
||||
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.Width = 500;
|
||||
root.Height = 500;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.SetPosition(YogaEdge.Right, 20.Percent());
|
||||
root_child0.SetPosition(YogaEdge.Bottom, 10.Percent());
|
||||
root_child0.Width = 55.Percent();
|
||||
root_child0.Height = 15.Percent();
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(500f, root.LayoutWidth);
|
||||
Assert.AreEqual(500f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(-100f, root_child0.LayoutX);
|
||||
Assert.AreEqual(-50f, root_child0.LayoutY);
|
||||
Assert.AreEqual(275f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(75f, root_child0.LayoutHeight);
|
||||
|
||||
root.StyleDirection = YogaDirection.RTL;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(500f, root.LayoutWidth);
|
||||
Assert.AreEqual(500f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(125f, root_child0.LayoutX);
|
||||
Assert.AreEqual(-50f, root_child0.LayoutY);
|
||||
Assert.AreEqual(275f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(75f, root_child0.LayoutHeight);
|
||||
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_percentage_flex_basis()
|
||||
{
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
|
||||
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.Width = 200;
|
||||
root.Height = 200;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.FlexBasis = 50.Percent();
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.FlexGrow = 1;
|
||||
root_child1.FlexBasis = 25.Percent();
|
||||
root.Insert(1, root_child1);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(200f, root.LayoutWidth);
|
||||
Assert.AreEqual(200f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(125f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(200f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(125f, root_child1.LayoutX);
|
||||
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||
Assert.AreEqual(75f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(200f, root_child1.LayoutHeight);
|
||||
|
||||
root.StyleDirection = YogaDirection.RTL;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(200f, root.LayoutWidth);
|
||||
Assert.AreEqual(200f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(75f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(125f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(200f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||
Assert.AreEqual(75f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(200f, root_child1.LayoutHeight);
|
||||
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_percentage_flex_basis_cross()
|
||||
{
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
|
||||
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 200;
|
||||
root.Height = 200;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.FlexBasis = 50.Percent();
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.FlexGrow = 1;
|
||||
root_child1.FlexBasis = 25.Percent();
|
||||
root.Insert(1, root_child1);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(200f, root.LayoutWidth);
|
||||
Assert.AreEqual(200f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(200f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(125f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||
Assert.AreEqual(125f, root_child1.LayoutY);
|
||||
Assert.AreEqual(200f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(75f, root_child1.LayoutHeight);
|
||||
|
||||
root.StyleDirection = YogaDirection.RTL;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(200f, root.LayoutWidth);
|
||||
Assert.AreEqual(200f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(200f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(125f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||
Assert.AreEqual(125f, root_child1.LayoutY);
|
||||
Assert.AreEqual(200f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(75f, root_child1.LayoutHeight);
|
||||
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_percentage_flex_basis_cross_min_height()
|
||||
{
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
|
||||
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 200;
|
||||
root.Height = 200;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.MinHeight = 60.Percent();
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.FlexGrow = 2;
|
||||
root_child1.MinHeight = 10.Percent();
|
||||
root.Insert(1, root_child1);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(200f, root.LayoutWidth);
|
||||
Assert.AreEqual(200f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(200f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(140f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||
Assert.AreEqual(140f, root_child1.LayoutY);
|
||||
Assert.AreEqual(200f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(60f, root_child1.LayoutHeight);
|
||||
|
||||
root.StyleDirection = YogaDirection.RTL;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(200f, root.LayoutWidth);
|
||||
Assert.AreEqual(200f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(200f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(140f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||
Assert.AreEqual(140f, root_child1.LayoutY);
|
||||
Assert.AreEqual(200f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(60f, root_child1.LayoutHeight);
|
||||
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_percentage_flex_basis_main_max_height()
|
||||
{
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
|
||||
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.Width = 200;
|
||||
root.Height = 200;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.FlexBasis = 10.Percent();
|
||||
root_child0.MaxHeight = 60.Percent();
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.FlexGrow = 4;
|
||||
root_child1.FlexBasis = 10.Percent();
|
||||
root_child1.MaxHeight = 20.Percent();
|
||||
root.Insert(1, root_child1);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(200f, root.LayoutWidth);
|
||||
Assert.AreEqual(200f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(52f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(120f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(52f, root_child1.LayoutX);
|
||||
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||
Assert.AreEqual(148f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(40f, root_child1.LayoutHeight);
|
||||
|
||||
root.StyleDirection = YogaDirection.RTL;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(200f, root.LayoutWidth);
|
||||
Assert.AreEqual(200f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(148f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(52f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(120f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||
Assert.AreEqual(148f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(40f, root_child1.LayoutHeight);
|
||||
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_percentage_flex_basis_cross_max_height()
|
||||
{
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
|
||||
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 200;
|
||||
root.Height = 200;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.FlexBasis = 10.Percent();
|
||||
root_child0.MaxHeight = 60.Percent();
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.FlexGrow = 4;
|
||||
root_child1.FlexBasis = 10.Percent();
|
||||
root_child1.MaxHeight = 20.Percent();
|
||||
root.Insert(1, root_child1);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(200f, root.LayoutWidth);
|
||||
Assert.AreEqual(200f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(200f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(120f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||
Assert.AreEqual(120f, root_child1.LayoutY);
|
||||
Assert.AreEqual(200f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(40f, root_child1.LayoutHeight);
|
||||
|
||||
root.StyleDirection = YogaDirection.RTL;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(200f, root.LayoutWidth);
|
||||
Assert.AreEqual(200f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(200f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(120f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||
Assert.AreEqual(120f, root_child1.LayoutY);
|
||||
Assert.AreEqual(200f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(40f, root_child1.LayoutHeight);
|
||||
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_percentage_flex_basis_main_max_width()
|
||||
{
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
|
||||
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.Width = 200;
|
||||
root.Height = 200;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.FlexBasis = 15.Percent();
|
||||
root_child0.MaxWidth = 60.Percent();
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.FlexGrow = 4;
|
||||
root_child1.FlexBasis = 10.Percent();
|
||||
root_child1.MaxWidth = 20.Percent();
|
||||
root.Insert(1, root_child1);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(200f, root.LayoutWidth);
|
||||
Assert.AreEqual(200f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(120f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(200f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(120f, root_child1.LayoutX);
|
||||
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||
Assert.AreEqual(40f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(200f, root_child1.LayoutHeight);
|
||||
|
||||
root.StyleDirection = YogaDirection.RTL;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(200f, root.LayoutWidth);
|
||||
Assert.AreEqual(200f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(80f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(120f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(200f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(40f, root_child1.LayoutX);
|
||||
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||
Assert.AreEqual(40f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(200f, root_child1.LayoutHeight);
|
||||
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_percentage_flex_basis_cross_max_width()
|
||||
{
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
|
||||
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 200;
|
||||
root.Height = 200;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.FlexBasis = 10.Percent();
|
||||
root_child0.MaxWidth = 60.Percent();
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.FlexGrow = 4;
|
||||
root_child1.FlexBasis = 15.Percent();
|
||||
root_child1.MaxWidth = 20.Percent();
|
||||
root.Insert(1, root_child1);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(200f, root.LayoutWidth);
|
||||
Assert.AreEqual(200f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(120f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(50f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||
Assert.AreEqual(50f, root_child1.LayoutY);
|
||||
Assert.AreEqual(40f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(150f, root_child1.LayoutHeight);
|
||||
|
||||
root.StyleDirection = YogaDirection.RTL;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(200f, root.LayoutWidth);
|
||||
Assert.AreEqual(200f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(80f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(120f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(50f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(160f, root_child1.LayoutX);
|
||||
Assert.AreEqual(50f, root_child1.LayoutY);
|
||||
Assert.AreEqual(40f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(150f, root_child1.LayoutHeight);
|
||||
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_percentage_flex_basis_main_min_width()
|
||||
{
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
|
||||
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.Width = 200;
|
||||
root.Height = 200;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.FlexBasis = 15.Percent();
|
||||
root_child0.MinWidth = 60.Percent();
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.FlexGrow = 4;
|
||||
root_child1.FlexBasis = 10.Percent();
|
||||
root_child1.MinWidth = 20.Percent();
|
||||
root.Insert(1, root_child1);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(200f, root.LayoutWidth);
|
||||
Assert.AreEqual(200f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(120f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(200f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(120f, root_child1.LayoutX);
|
||||
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||
Assert.AreEqual(80f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(200f, root_child1.LayoutHeight);
|
||||
|
||||
root.StyleDirection = YogaDirection.RTL;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(200f, root.LayoutWidth);
|
||||
Assert.AreEqual(200f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(80f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(120f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(200f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||
Assert.AreEqual(80f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(200f, root_child1.LayoutHeight);
|
||||
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_percentage_flex_basis_cross_min_width()
|
||||
{
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
|
||||
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 200;
|
||||
root.Height = 200;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.FlexBasis = 10.Percent();
|
||||
root_child0.MinWidth = 60.Percent();
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.FlexGrow = 4;
|
||||
root_child1.FlexBasis = 15.Percent();
|
||||
root_child1.MinWidth = 20.Percent();
|
||||
root.Insert(1, root_child1);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(200f, root.LayoutWidth);
|
||||
Assert.AreEqual(200f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(200f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(50f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||
Assert.AreEqual(50f, root_child1.LayoutY);
|
||||
Assert.AreEqual(200f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(150f, root_child1.LayoutHeight);
|
||||
|
||||
root.StyleDirection = YogaDirection.RTL;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(200f, root.LayoutWidth);
|
||||
Assert.AreEqual(200f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(200f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(50f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||
Assert.AreEqual(50f, root_child1.LayoutY);
|
||||
Assert.AreEqual(200f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(150f, root_child1.LayoutHeight);
|
||||
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_percentage_multiple_nested_with_padding_margin_and_percentage_values()
|
||||
{
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
|
||||
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 200;
|
||||
root.Height = 200;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.FlexBasis = 10.Percent();
|
||||
root_child0.SetMargin(YogaEdge.Left, 5);
|
||||
root_child0.SetMargin(YogaEdge.Top, 5);
|
||||
root_child0.SetMargin(YogaEdge.Right, 5);
|
||||
root_child0.SetMargin(YogaEdge.Bottom, 5);
|
||||
root_child0.SetPadding(YogaEdge.Left, 3);
|
||||
root_child0.SetPadding(YogaEdge.Top, 3);
|
||||
root_child0.SetPadding(YogaEdge.Right, 3);
|
||||
root_child0.SetPadding(YogaEdge.Bottom, 3);
|
||||
root_child0.MinWidth = 60.Percent();
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child0_child0 = new YogaNode();
|
||||
root_child0_child0.SetMargin(YogaEdge.Left, 5);
|
||||
root_child0_child0.SetMargin(YogaEdge.Top, 5);
|
||||
root_child0_child0.SetMargin(YogaEdge.Right, 5);
|
||||
root_child0_child0.SetMargin(YogaEdge.Bottom, 5);
|
||||
root_child0_child0.SetPadding(YogaEdge.Left, 3.Percent());
|
||||
root_child0_child0.SetPadding(YogaEdge.Top, 3.Percent());
|
||||
root_child0_child0.SetPadding(YogaEdge.Right, 3.Percent());
|
||||
root_child0_child0.SetPadding(YogaEdge.Bottom, 3.Percent());
|
||||
root_child0_child0.Width = 50.Percent();
|
||||
root_child0.Insert(0, root_child0_child0);
|
||||
|
||||
YogaNode root_child0_child0_child0 = new YogaNode();
|
||||
root_child0_child0_child0.SetMargin(YogaEdge.Left, 5.Percent());
|
||||
root_child0_child0_child0.SetMargin(YogaEdge.Top, 5.Percent());
|
||||
root_child0_child0_child0.SetMargin(YogaEdge.Right, 5.Percent());
|
||||
root_child0_child0_child0.SetMargin(YogaEdge.Bottom, 5.Percent());
|
||||
root_child0_child0_child0.SetPadding(YogaEdge.Left, 3);
|
||||
root_child0_child0_child0.SetPadding(YogaEdge.Top, 3);
|
||||
root_child0_child0_child0.SetPadding(YogaEdge.Right, 3);
|
||||
root_child0_child0_child0.SetPadding(YogaEdge.Bottom, 3);
|
||||
root_child0_child0_child0.Width = 45.Percent();
|
||||
root_child0_child0.Insert(0, root_child0_child0_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.FlexGrow = 4;
|
||||
root_child1.FlexBasis = 15.Percent();
|
||||
root_child1.MinWidth = 20.Percent();
|
||||
root.Insert(1, root_child1);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(200f, root.LayoutWidth);
|
||||
Assert.AreEqual(200f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(5f, root_child0.LayoutX);
|
||||
Assert.AreEqual(5f, root_child0.LayoutY);
|
||||
Assert.AreEqual(190f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(48f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(8f, root_child0_child0.LayoutX);
|
||||
Assert.AreEqual(8f, root_child0_child0.LayoutY);
|
||||
Assert.AreEqual(92f, root_child0_child0.LayoutWidth);
|
||||
Assert.AreEqual(25f, root_child0_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(10f, root_child0_child0_child0.LayoutX);
|
||||
Assert.AreEqual(10f, root_child0_child0_child0.LayoutY);
|
||||
Assert.AreEqual(36f, root_child0_child0_child0.LayoutWidth);
|
||||
Assert.AreEqual(6f, root_child0_child0_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||
Assert.AreEqual(58f, root_child1.LayoutY);
|
||||
Assert.AreEqual(200f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(142f, root_child1.LayoutHeight);
|
||||
|
||||
root.StyleDirection = YogaDirection.RTL;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(200f, root.LayoutWidth);
|
||||
Assert.AreEqual(200f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(5f, root_child0.LayoutX);
|
||||
Assert.AreEqual(5f, root_child0.LayoutY);
|
||||
Assert.AreEqual(190f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(48f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(90f, root_child0_child0.LayoutX);
|
||||
Assert.AreEqual(8f, root_child0_child0.LayoutY);
|
||||
Assert.AreEqual(92f, root_child0_child0.LayoutWidth);
|
||||
Assert.AreEqual(25f, root_child0_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(46f, root_child0_child0_child0.LayoutX);
|
||||
Assert.AreEqual(10f, root_child0_child0_child0.LayoutY);
|
||||
Assert.AreEqual(36f, root_child0_child0_child0.LayoutWidth);
|
||||
Assert.AreEqual(6f, root_child0_child0_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||
Assert.AreEqual(58f, root_child1.LayoutY);
|
||||
Assert.AreEqual(200f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(142f, root_child1.LayoutHeight);
|
||||
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_percentage_margin_should_calculate_based_only_on_width()
|
||||
{
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
|
||||
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 200;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.SetMargin(YogaEdge.Left, 10.Percent());
|
||||
root_child0.SetMargin(YogaEdge.Top, 10.Percent());
|
||||
root_child0.SetMargin(YogaEdge.Right, 10.Percent());
|
||||
root_child0.SetMargin(YogaEdge.Bottom, 10.Percent());
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child0_child0 = new YogaNode();
|
||||
root_child0_child0.Width = 10;
|
||||
root_child0_child0.Height = 10;
|
||||
root_child0.Insert(0, root_child0_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(200f, root.LayoutWidth);
|
||||
Assert.AreEqual(100f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(20f, root_child0.LayoutX);
|
||||
Assert.AreEqual(20f, root_child0.LayoutY);
|
||||
Assert.AreEqual(160f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(60f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0_child0.LayoutY);
|
||||
Assert.AreEqual(10f, root_child0_child0.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child0_child0.LayoutHeight);
|
||||
|
||||
root.StyleDirection = YogaDirection.RTL;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(200f, root.LayoutWidth);
|
||||
Assert.AreEqual(100f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(20f, root_child0.LayoutX);
|
||||
Assert.AreEqual(20f, root_child0.LayoutY);
|
||||
Assert.AreEqual(160f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(60f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(150f, root_child0_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0_child0.LayoutY);
|
||||
Assert.AreEqual(10f, root_child0_child0.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child0_child0.LayoutHeight);
|
||||
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_percentage_padding_should_calculate_based_only_on_width()
|
||||
{
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
|
||||
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 200;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.SetPadding(YogaEdge.Left, 10.Percent());
|
||||
root_child0.SetPadding(YogaEdge.Top, 10.Percent());
|
||||
root_child0.SetPadding(YogaEdge.Right, 10.Percent());
|
||||
root_child0.SetPadding(YogaEdge.Bottom, 10.Percent());
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child0_child0 = new YogaNode();
|
||||
root_child0_child0.Width = 10;
|
||||
root_child0_child0.Height = 10;
|
||||
root_child0.Insert(0, root_child0_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(200f, root.LayoutWidth);
|
||||
Assert.AreEqual(100f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(200f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(20f, root_child0_child0.LayoutX);
|
||||
Assert.AreEqual(20f, root_child0_child0.LayoutY);
|
||||
Assert.AreEqual(10f, root_child0_child0.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child0_child0.LayoutHeight);
|
||||
|
||||
root.StyleDirection = YogaDirection.RTL;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(200f, root.LayoutWidth);
|
||||
Assert.AreEqual(100f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(200f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(170f, root_child0_child0.LayoutX);
|
||||
Assert.AreEqual(20f, root_child0_child0.LayoutY);
|
||||
Assert.AreEqual(10f, root_child0_child0.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child0_child0.LayoutHeight);
|
||||
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_percentage_absolute_position()
|
||||
{
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
|
||||
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 200;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.PositionType = YogaPositionType.Absolute;
|
||||
root_child0.SetPosition(YogaEdge.Left, 30.Percent());
|
||||
root_child0.SetPosition(YogaEdge.Top, 10.Percent());
|
||||
root_child0.Width = 10;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(200f, root.LayoutWidth);
|
||||
Assert.AreEqual(100f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(60f, root_child0.LayoutX);
|
||||
Assert.AreEqual(10f, root_child0.LayoutY);
|
||||
Assert.AreEqual(10f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child0.LayoutHeight);
|
||||
|
||||
root.StyleDirection = YogaDirection.RTL;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(200f, root.LayoutWidth);
|
||||
Assert.AreEqual(100f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(60f, root_child0.LayoutX);
|
||||
Assert.AreEqual(10f, root_child0.LayoutY);
|
||||
Assert.AreEqual(10f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child0.LayoutHeight);
|
||||
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -24,19 +24,19 @@ namespace Facebook.Yoga
|
||||
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.Width = 100f;
|
||||
root.Height = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1f;
|
||||
root_child0.FlexGrow = 1;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.FlexGrow = 1f;
|
||||
root_child1.FlexGrow = 1;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.FlexGrow = 1f;
|
||||
root_child2.FlexGrow = 1;
|
||||
root.Insert(2, root_child2);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -94,27 +94,27 @@ namespace Facebook.Yoga
|
||||
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.Width = 113f;
|
||||
root.Height = 100f;
|
||||
root.Width = 113;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1f;
|
||||
root_child0.FlexGrow = 1;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.FlexGrow = 1f;
|
||||
root_child1.FlexGrow = 1;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.FlexGrow = 1f;
|
||||
root_child2.FlexGrow = 1;
|
||||
root.Insert(2, root_child2);
|
||||
|
||||
YogaNode root_child3 = new YogaNode();
|
||||
root_child3.FlexGrow = 1f;
|
||||
root_child3.FlexGrow = 1;
|
||||
root.Insert(3, root_child3);
|
||||
|
||||
YogaNode root_child4 = new YogaNode();
|
||||
root_child4.FlexGrow = 1f;
|
||||
root_child4.FlexGrow = 1;
|
||||
root.Insert(4, root_child4);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -192,20 +192,20 @@ namespace Facebook.Yoga
|
||||
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.Width = 101f;
|
||||
root.Height = 100f;
|
||||
root.Width = 101;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexShrink = 1f;
|
||||
root_child0.FlexBasis = 100f;
|
||||
root_child0.FlexShrink = 1;
|
||||
root_child0.FlexBasis = 100;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.FlexBasis = 25f;
|
||||
root_child1.FlexBasis = 25;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.FlexBasis = 25f;
|
||||
root_child2.FlexBasis = 25;
|
||||
root.Insert(2, root_child2);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -262,23 +262,23 @@ namespace Facebook.Yoga
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
|
||||
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 100f;
|
||||
root.Height = 113f;
|
||||
root.Width = 100;
|
||||
root.Height = 113;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1f;
|
||||
root_child0.FlexBasis = 50f;
|
||||
root_child0.Height = 20f;
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.FlexBasis = 50;
|
||||
root_child0.Height = 20;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.FlexGrow = 1f;
|
||||
root_child1.Height = 10f;
|
||||
root_child1.FlexGrow = 1;
|
||||
root_child1.Height = 10;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.FlexGrow = 1f;
|
||||
root_child2.Height = 10f;
|
||||
root_child2.FlexGrow = 1;
|
||||
root_child2.Height = 10;
|
||||
root.Insert(2, root_child2);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -346,7 +346,7 @@ namespace Facebook.Yoga
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.FlexGrow = 1.6f;
|
||||
root_child1.Height = 10f;
|
||||
root_child1.Height = 10;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
@@ -418,14 +418,14 @@ namespace Facebook.Yoga
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child0_child0 = new YogaNode();
|
||||
root_child0_child0.FlexGrow = 1f;
|
||||
root_child0_child0.FlexGrow = 1;
|
||||
root_child0_child0.FlexBasis = 0.3f;
|
||||
root_child0_child0.SetPosition(YogaEdge.Bottom, 13.3f);
|
||||
root_child0_child0.Height = 9.9f;
|
||||
root_child0.Insert(0, root_child0_child0);
|
||||
|
||||
YogaNode root_child0_child1 = new YogaNode();
|
||||
root_child0_child1.FlexGrow = 4f;
|
||||
root_child0_child1.FlexGrow = 4;
|
||||
root_child0_child1.FlexBasis = 0.3f;
|
||||
root_child0_child1.SetPosition(YogaEdge.Top, 13.3f);
|
||||
root_child0_child1.Height = 1.1f;
|
||||
@@ -433,7 +433,7 @@ namespace Facebook.Yoga
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.FlexGrow = 1.6f;
|
||||
root_child1.Height = 10f;
|
||||
root_child1.Height = 10;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
@@ -515,23 +515,23 @@ namespace Facebook.Yoga
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
|
||||
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 113.4f;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1f;
|
||||
root_child0.FlexBasis = 50f;
|
||||
root_child0.Height = 20f;
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.FlexBasis = 50;
|
||||
root_child0.Height = 20;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.FlexGrow = 1f;
|
||||
root_child1.Height = 10f;
|
||||
root_child1.FlexGrow = 1;
|
||||
root_child1.Height = 10;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.FlexGrow = 1f;
|
||||
root_child2.Height = 10f;
|
||||
root_child2.FlexGrow = 1;
|
||||
root_child2.Height = 10;
|
||||
root.Insert(2, root_child2);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -588,23 +588,23 @@ namespace Facebook.Yoga
|
||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
|
||||
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 113.6f;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1f;
|
||||
root_child0.FlexBasis = 50f;
|
||||
root_child0.Height = 20f;
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.FlexBasis = 50;
|
||||
root_child0.Height = 20;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.FlexGrow = 1f;
|
||||
root_child1.Height = 10f;
|
||||
root_child1.FlexGrow = 1;
|
||||
root_child1.Height = 10;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.FlexGrow = 1f;
|
||||
root_child2.Height = 10f;
|
||||
root_child2.FlexGrow = 1;
|
||||
root_child2.Height = 10;
|
||||
root.Insert(2, root_child2);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -662,23 +662,23 @@ namespace Facebook.Yoga
|
||||
|
||||
YogaNode root = new YogaNode();
|
||||
root.SetPosition(YogaEdge.Top, 0.3f);
|
||||
root.Width = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 113.4f;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1f;
|
||||
root_child0.FlexBasis = 50f;
|
||||
root_child0.Height = 20f;
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.FlexBasis = 50;
|
||||
root_child0.Height = 20;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.FlexGrow = 1f;
|
||||
root_child1.Height = 10f;
|
||||
root_child1.FlexGrow = 1;
|
||||
root_child1.Height = 10;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.FlexGrow = 1f;
|
||||
root_child2.Height = 10f;
|
||||
root_child2.FlexGrow = 1;
|
||||
root_child2.Height = 10;
|
||||
root.Insert(2, root_child2);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -736,23 +736,23 @@ namespace Facebook.Yoga
|
||||
|
||||
YogaNode root = new YogaNode();
|
||||
root.SetPosition(YogaEdge.Top, 0.7f);
|
||||
root.Width = 100f;
|
||||
root.Width = 100;
|
||||
root.Height = 113.4f;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1f;
|
||||
root_child0.FlexBasis = 50f;
|
||||
root_child0.Height = 20f;
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.FlexBasis = 50;
|
||||
root_child0.Height = 20;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.FlexGrow = 1f;
|
||||
root_child1.Height = 10f;
|
||||
root_child1.FlexGrow = 1;
|
||||
root_child1.Height = 10;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.FlexGrow = 1f;
|
||||
root_child2.Height = 10f;
|
||||
root_child2.FlexGrow = 1;
|
||||
root_child2.Height = 10;
|
||||
root.Insert(2, root_child2);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
@@ -51,14 +51,14 @@ namespace Facebook.Yoga
|
||||
Assert.AreEqual(YogaFlexDirection.Column, node.FlexDirection);
|
||||
Assert.AreEqual(YogaPositionType.Absolute, node.PositionType);
|
||||
Assert.AreEqual(YogaWrap.Wrap, node.Wrap);
|
||||
Assert.AreEqual(6, node.GetPosition(YogaEdge.Top));
|
||||
Assert.AreEqual(6.Px(), node.GetPosition(YogaEdge.Top));
|
||||
Assert.IsTrue(YogaConstants.IsUndefined(node.GetPosition(YogaEdge.Bottom)));
|
||||
Assert.AreEqual(4, node.GetPosition(YogaEdge.Right));
|
||||
Assert.AreEqual(4.Px(), node.GetPosition(YogaEdge.Right));
|
||||
Assert.IsTrue(YogaConstants.IsUndefined(node.GetPosition(YogaEdge.Left)));
|
||||
Assert.AreEqual(0, node.GetMargin(YogaEdge.Top));
|
||||
Assert.AreEqual(5, node.GetMargin(YogaEdge.Bottom));
|
||||
Assert.AreEqual(3, node.GetMargin(YogaEdge.Left));
|
||||
Assert.AreEqual(0, node.GetMargin(YogaEdge.Right));
|
||||
Assert.AreEqual(0.Px(), node.GetMargin(YogaEdge.Top));
|
||||
Assert.AreEqual(5.Px(), node.GetMargin(YogaEdge.Bottom));
|
||||
Assert.AreEqual(3.Px(), node.GetMargin(YogaEdge.Left));
|
||||
Assert.AreEqual(0.Px(), node.GetMargin(YogaEdge.Right));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -85,7 +85,7 @@ namespace Facebook.Yoga
|
||||
position: new Spacing(top: 5, bottom: 6, left: 7, right: 8),
|
||||
margin: new Spacing(top: 9, bottom: 10, left: 11, right: 12),
|
||||
padding: new Spacing(top: 13, bottom: 14, left: 15, right: 16),
|
||||
border: new Spacing(top: 17, bottom: 18, left: 19, right: 20),
|
||||
border: new Border(top: 17, bottom: 18, left: 19, right: 20),
|
||||
|
||||
width: 21,
|
||||
height: 22,
|
||||
@@ -108,36 +108,36 @@ namespace Facebook.Yoga
|
||||
|
||||
Assert.AreEqual(2, node.FlexGrow);
|
||||
Assert.AreEqual(3, node.FlexShrink);
|
||||
Assert.AreEqual(4, node.FlexBasis);
|
||||
Assert.AreEqual(4.Px(), node.FlexBasis);
|
||||
node.FlexGrow = YogaConstants.Undefined;
|
||||
Assert.AreEqual(1, node.FlexGrow);
|
||||
|
||||
Assert.AreEqual(5, node.GetPosition(YogaEdge.Top));
|
||||
Assert.AreEqual(6, node.GetPosition(YogaEdge.Bottom));
|
||||
Assert.AreEqual(7, node.GetPosition(YogaEdge.Left));
|
||||
Assert.AreEqual(8, node.GetPosition(YogaEdge.Right));
|
||||
Assert.AreEqual(5.Px(), node.GetPosition(YogaEdge.Top));
|
||||
Assert.AreEqual(6.Px(), node.GetPosition(YogaEdge.Bottom));
|
||||
Assert.AreEqual(7.Px(), node.GetPosition(YogaEdge.Left));
|
||||
Assert.AreEqual(8.Px(), node.GetPosition(YogaEdge.Right));
|
||||
|
||||
Assert.AreEqual(9, node.GetMargin(YogaEdge.Top));
|
||||
Assert.AreEqual(10, node.GetMargin(YogaEdge.Bottom));
|
||||
Assert.AreEqual(11, node.GetMargin(YogaEdge.Left));
|
||||
Assert.AreEqual(12, node.GetMargin(YogaEdge.Right));
|
||||
Assert.AreEqual(9.Px(), node.GetMargin(YogaEdge.Top));
|
||||
Assert.AreEqual(10.Px(), node.GetMargin(YogaEdge.Bottom));
|
||||
Assert.AreEqual(11.Px(), node.GetMargin(YogaEdge.Left));
|
||||
Assert.AreEqual(12.Px(), node.GetMargin(YogaEdge.Right));
|
||||
|
||||
Assert.AreEqual(13, node.GetPadding(YogaEdge.Top));
|
||||
Assert.AreEqual(14, node.GetPadding(YogaEdge.Bottom));
|
||||
Assert.AreEqual(15, node.GetPadding(YogaEdge.Left));
|
||||
Assert.AreEqual(16, node.GetPadding(YogaEdge.Right));
|
||||
Assert.AreEqual(13.Px(), node.GetPadding(YogaEdge.Top));
|
||||
Assert.AreEqual(14.Px(), node.GetPadding(YogaEdge.Bottom));
|
||||
Assert.AreEqual(15.Px(), node.GetPadding(YogaEdge.Left));
|
||||
Assert.AreEqual(16.Px(), node.GetPadding(YogaEdge.Right));
|
||||
|
||||
Assert.AreEqual(17, node.GetBorder(YogaEdge.Top));
|
||||
Assert.AreEqual(18, node.GetBorder(YogaEdge.Bottom));
|
||||
Assert.AreEqual(19, node.GetBorder(YogaEdge.Left));
|
||||
Assert.AreEqual(20, node.GetBorder(YogaEdge.Right));
|
||||
|
||||
Assert.AreEqual(21, node.Width);
|
||||
Assert.AreEqual(22, node.Height);
|
||||
Assert.AreEqual(23, node.MinWidth);
|
||||
Assert.AreEqual(24, node.MinHeight);
|
||||
Assert.AreEqual(25, node.MaxWidth);
|
||||
Assert.AreEqual(26, node.MaxHeight);
|
||||
Assert.AreEqual(21.Px(), node.Width);
|
||||
Assert.AreEqual(22.Px(), node.Height);
|
||||
Assert.AreEqual(23.Px(), node.MinWidth);
|
||||
Assert.AreEqual(24.Px(), node.MinHeight);
|
||||
Assert.AreEqual(25.Px(), node.MaxWidth);
|
||||
Assert.AreEqual(26.Px(), node.MaxHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -212,7 +212,7 @@ namespace Facebook.Yoga
|
||||
parent.Insert(0, child0);
|
||||
parent.Insert(0, child1);
|
||||
parent.CalculateLayout();
|
||||
Assert.AreEqual(parent.Print(), "{layout: {width: 100, height: 120, top: 0, left: 0}, flexDirection: 'column', alignItems: 'stretch', flexGrow: 0, flexShrink: 0, overflow: 'visible', width: 100, height: 120, children: [\n {layout: {width: 35, height: 45, top: 0, left: 0}, flexDirection: 'column', alignItems: 'stretch', flexGrow: 0, flexShrink: 0, overflow: 'visible', width: 35, height: 45, },\n {layout: {width: 30, height: 40, top: 45, left: 0}, flexDirection: 'column', alignItems: 'stretch', flexGrow: 0, flexShrink: 0, overflow: 'visible', width: 30, height: 40, },\n]},\n");
|
||||
Assert.AreEqual("{layout: {width: 100, height: 120, top: 0, left: 0}, flexDirection: 'column', alignItems: 'stretch', flexGrow: 0, flexShrink: 0, overflow: 'visible', width: 100px, height: 120px, children: [\n {layout: {width: 35, height: 45, top: 0, left: 0}, flexDirection: 'column', alignItems: 'stretch', flexGrow: 0, flexShrink: 0, overflow: 'visible', width: 35px, height: 45px, },\n {layout: {width: 30, height: 40, top: 45, left: 0}, flexDirection: 'column', alignItems: 'stretch', flexGrow: 0, flexShrink: 0, overflow: 'visible', width: 30px, height: 40px, },\n]},\n", parent.Print());
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -225,7 +225,7 @@ namespace Facebook.Yoga
|
||||
node1.MaxHeight = 100;
|
||||
|
||||
node0.CopyStyle(node1);
|
||||
Assert.AreEqual(100, node0.MaxHeight);
|
||||
Assert.AreEqual(100.Px(), node0.MaxHeight);
|
||||
}
|
||||
|
||||
private void ForceGC()
|
||||
|
Reference in New Issue
Block a user