Add feature to use percentage as value unit #258

Closed
woehrl01 wants to merge 43 commits from percentage-feature into master
80 changed files with 5167 additions and 3111 deletions
Showing only changes of commit e2c586490a - Show all commits

View File

@@ -0,0 +1,31 @@
/**
* 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.
*/
namespace Facebook.Yoga
{
public class Border
{
public float? Top;
public float? Bottom;
public float? Left;
public float? Right;
public Border(
float? top = null,
float? bottom = null,
float? left = null,
float? right = null)
{
Top = top;
Bottom = bottom;
Left = left;
Right = right;
}
}
}

View File

@@ -181,46 +181,46 @@ namespace Facebook.Yoga
public static extern float YGNodeStyleGetFlexShrink(IntPtr node);
[DllImport(DllName)]
public static extern void YGNodeStyleSetFlexBasis(IntPtr node, float flexBasis);
public static extern void YGNodeStyleSetFlexBasis(IntPtr node, YogaValue flexBasis);
[DllImport(DllName)]
public static extern float YGNodeStyleGetFlexBasis(IntPtr node);
public static extern YogaValue YGNodeStyleGetFlexBasis(IntPtr node);
[DllImport(DllName)]
public static extern void YGNodeStyleSetWidth(IntPtr node, float width);
public static extern void YGNodeStyleSetWidth(IntPtr node, YogaValue width);
[DllImport(DllName)]
public static extern float YGNodeStyleGetWidth(IntPtr node);
public static extern YogaValue YGNodeStyleGetWidth(IntPtr node);
[DllImport(DllName)]
public static extern void YGNodeStyleSetHeight(IntPtr node, float height);
public static extern void YGNodeStyleSetHeight(IntPtr node, YogaValue height);
[DllImport(DllName)]
public static extern float YGNodeStyleGetHeight(IntPtr node);
public static extern YogaValue YGNodeStyleGetHeight(IntPtr node);
[DllImport(DllName)]
public static extern void YGNodeStyleSetMinWidth(IntPtr node, float minWidth);
public static extern void YGNodeStyleSetMinWidth(IntPtr node, YogaValue minWidth);
[DllImport(DllName)]
public static extern float YGNodeStyleGetMinWidth(IntPtr node);
public static extern YogaValue YGNodeStyleGetMinWidth(IntPtr node);
[DllImport(DllName)]
public static extern void YGNodeStyleSetMinHeight(IntPtr node, float minHeight);
public static extern void YGNodeStyleSetMinHeight(IntPtr node, YogaValue minHeight);
[DllImport(DllName)]
public static extern float YGNodeStyleGetMinHeight(IntPtr node);
public static extern YogaValue YGNodeStyleGetMinHeight(IntPtr node);
[DllImport(DllName)]
public static extern void YGNodeStyleSetMaxWidth(IntPtr node, float maxWidth);
public static extern void YGNodeStyleSetMaxWidth(IntPtr node, YogaValue maxWidth);
[DllImport(DllName)]
public static extern float YGNodeStyleGetMaxWidth(IntPtr node);
public static extern YogaValue YGNodeStyleGetMaxWidth(IntPtr node);
[DllImport(DllName)]
public static extern void YGNodeStyleSetMaxHeight(IntPtr node, float maxHeight);
public static extern void YGNodeStyleSetMaxHeight(IntPtr node, YogaValue maxHeight);
[DllImport(DllName)]
public static extern float YGNodeStyleGetMaxHeight(IntPtr node);
public static extern YogaValue YGNodeStyleGetMaxHeight(IntPtr node);
[DllImport(DllName)]
public static extern void YGNodeStyleSetAspectRatio(IntPtr node, float aspectRatio);
@@ -233,22 +233,22 @@ namespace Facebook.Yoga
#region YG_NODE_STYLE_EDGE_PROPERTY
[DllImport(DllName)]
public static extern void YGNodeStyleSetPosition(IntPtr node, YogaEdge edge, float position);
public static extern void YGNodeStyleSetPosition(IntPtr node, YogaEdge edge, YogaValue position);
[DllImport(DllName)]
public static extern float YGNodeStyleGetPosition(IntPtr node, YogaEdge edge);
public static extern YogaValue YGNodeStyleGetPosition(IntPtr node, YogaEdge edge);
[DllImport(DllName)]
public static extern void YGNodeStyleSetMargin(IntPtr node, YogaEdge edge, float margin);
public static extern void YGNodeStyleSetMargin(IntPtr node, YogaEdge edge, YogaValue margin);
[DllImport(DllName)]
public static extern float YGNodeStyleGetMargin(IntPtr node, YogaEdge edge);
public static extern YogaValue YGNodeStyleGetMargin(IntPtr node, YogaEdge edge);
[DllImport(DllName)]
public static extern void YGNodeStyleSetPadding(IntPtr node, YogaEdge edge, float padding);
public static extern void YGNodeStyleSetPadding(IntPtr node, YogaEdge edge, YogaValue padding);
[DllImport(DllName)]
public static extern float YGNodeStyleGetPadding(IntPtr node, YogaEdge edge);
public static extern YogaValue YGNodeStyleGetPadding(IntPtr node, YogaEdge edge);
[DllImport(DllName)]
public static extern void YGNodeStyleSetBorder(IntPtr node, YogaEdge edge, float border);

View File

@@ -11,16 +11,16 @@ namespace Facebook.Yoga
{
public class Spacing
{
public float? Top;
public float? Bottom;
public float? Left;
public float? Right;
public YogaValue? Top;
public YogaValue? Bottom;
public YogaValue? Left;
public YogaValue? Right;
public Spacing(
float? top = null,
float? bottom = null,
float? left = null,
float? right = null)
YogaValue? top = null,
YogaValue? bottom = null,
YogaValue? left = null,
YogaValue? right = null)
{
Top = top;
Bottom = bottom;

View File

@@ -17,5 +17,10 @@ namespace Facebook.Yoga
{
return float.IsNaN(value);
}
public static bool IsUndefined(YogaValue value)
{
return !value.IsDefined;
}
}
}

View File

@@ -26,17 +26,17 @@ namespace Facebook.Yoga
float? flex = null,
float? flexGrow = null,
float? flexShrink = null,
float? flexBasis = null,
YogaValue? flexBasis = null,
Spacing position = null,
Spacing margin = null,
Spacing padding = null,
Spacing border = null,
float? Width = null,
float? Height = null,
float? MaxWidth = null,
float? MaxHeight = null,
float? MinWidth = null,
float? MinHeight = null)
Border border = null,
YogaValue? Width = null,
YogaValue? Height = null,
YogaValue? MaxWidth = null,
YogaValue? MaxHeight = null,
YogaValue? MinWidth = null,
YogaValue? MinHeight = null)
{
YogaNode node = new YogaNode();

View File

@@ -10,7 +10,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace Facebook.Yoga
@@ -233,7 +232,7 @@ namespace Facebook.Yoga
}
}
public float FlexBasis
public YogaValue FlexBasis
{
get
{
@@ -246,22 +245,22 @@ namespace Facebook.Yoga
}
}
public float GetMargin(YogaEdge edge)
public YogaValue GetMargin(YogaEdge edge)
{
return Native.YGNodeStyleGetMargin(_ygNode, edge);
}
public void SetMargin(YogaEdge edge, float value)
public void SetMargin(YogaEdge edge, YogaValue value)
{
Native.YGNodeStyleSetMargin(_ygNode, edge, value);
}
public float GetPadding(YogaEdge edge)
public YogaValue GetPadding(YogaEdge edge)
{
return Native.YGNodeStyleGetPadding(_ygNode, edge);
}
public void SetPadding(YogaEdge edge, float padding)
public void SetPadding(YogaEdge edge, YogaValue padding)
{
Native.YGNodeStyleSetPadding(_ygNode, edge, padding);
}
@@ -276,17 +275,17 @@ namespace Facebook.Yoga
Native.YGNodeStyleSetBorder(_ygNode, edge, border);
}
public float GetPosition(YogaEdge edge)
public YogaValue GetPosition(YogaEdge edge)
{
return Native.YGNodeStyleGetPosition(_ygNode, edge);
}
public void SetPosition(YogaEdge edge, float position)
public void SetPosition(YogaEdge edge, YogaValue position)
{
Native.YGNodeStyleSetPosition(_ygNode, edge, position);
}
public float Width
public YogaValue Width
{
get
{
@@ -299,7 +298,7 @@ namespace Facebook.Yoga
}
}
public float Height
public YogaValue Height
{
get
{
@@ -312,7 +311,7 @@ namespace Facebook.Yoga
}
}
public float MaxWidth
public YogaValue MaxWidth
{
get
{
@@ -325,7 +324,7 @@ namespace Facebook.Yoga
}
}
public float MaxHeight
public YogaValue MaxHeight
{
get
{
@@ -338,7 +337,7 @@ namespace Facebook.Yoga
}
}
public float MinWidth
public YogaValue MinWidth
{
get
{
@@ -351,7 +350,7 @@ namespace Facebook.Yoga
}
}
public float MinHeight
public YogaValue MinHeight
{
get
{

View File

@@ -0,0 +1,17 @@
/**
* 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.
*/
namespace Facebook.Yoga
{
public enum YogaUnit
{
Pixel,
Percent
}
}

View File

@@ -0,0 +1,67 @@
/**
* 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.
*/
using System.Runtime.InteropServices;
namespace Facebook.Yoga
{
[StructLayout(LayoutKind.Sequential)]
public struct YogaValue
{
private float Value;
private YogaUnit Unit;
private byte isDefined;
public bool IsDefined => isDefined != 0;
public static YogaValue Pixel(float value)
{
return new YogaValue
{
Value = value,
isDefined = 1,
Unit = YogaUnit.Pixel
};
}
public bool Equals(YogaValue other)
{
return Value.Equals(other.Value) && Unit == other.Unit;
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
return obj is YogaValue && Equals((YogaValue) obj);
}
public override int GetHashCode()
{
unchecked
{
return (Value.GetHashCode() * 397) ^ (int) Unit;
}
}
public static YogaValue Percent(float value)
{
return new YogaValue
{
Value = value,
isDefined = 1,
Unit = YogaUnit.Percent
};
}
public static implicit operator YogaValue(float pixelValue)
{
return Pixel(pixelValue);
}
}
}

View File

@@ -0,0 +1,34 @@
/**
* 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.
*/
namespace Facebook.Yoga
{
public static class YogaValueExtensions
{
public static YogaValue Percent(this float value)
{
return YogaValue.Percent(value);
}
public static YogaValue Px(this float value)
{
return YogaValue.Pixel(value);
}
public static YogaValue Percent(this int value)
{
return YogaValue.Percent(value);
}
public static YogaValue Px(this int value)
{
return YogaValue.Pixel(value);
}
}
}

View File

@@ -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.Px();
root.Height = 100.Px();
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.Px());
root_child0.SetPosition(YogaEdge.Top, 10.Px());
root_child0.Width = 10.Px();
root_child0.Height = 10.Px();
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.Px();
root.Height = 100.Px();
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.Px());
root_child0.SetPosition(YogaEdge.Bottom, 10.Px());
root_child0.Width = 10.Px();
root_child0.Height = 10.Px();
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.Px();
root.Height = 100.Px();
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.Px());
root_child0.SetPosition(YogaEdge.Top, 10.Px());
root_child0.SetPosition(YogaEdge.End, 10.Px());
root_child0.SetPosition(YogaEdge.Bottom, 10.Px());
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.Px();
root.Height = 100.Px();
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.Px());
root_child0.SetPosition(YogaEdge.Top, 10.Px());
root_child0.SetPosition(YogaEdge.End, 10.Px());
root_child0.SetPosition(YogaEdge.Bottom, 10.Px());
root_child0.Width = 10.Px();
root_child0.Height = 10.Px();
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.Px();
root.Height = 50.Px();
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.Px());
root_child0.SetPosition(YogaEdge.Top, 0.Px());
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.Px();
root_child0_child0.Height = 100.Px();
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.Px());
root.SetMargin(YogaEdge.Top, 10.Px());
root.SetMargin(YogaEdge.Right, 10.Px());
root.SetMargin(YogaEdge.Bottom, 10.Px());
root.SetPadding(YogaEdge.Left, 10.Px());
root.SetPadding(YogaEdge.Top, 10.Px());
root.SetPadding(YogaEdge.Right, 10.Px());
root.SetPadding(YogaEdge.Bottom, 10.Px());
root.SetBorder(YogaEdge.Left, 10);
root.SetBorder(YogaEdge.Top, 10);
root.SetBorder(YogaEdge.Right, 10);
root.SetBorder(YogaEdge.Bottom, 10);
root.Width = 100.Px();
root.Height = 100.Px();
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.Px());
root_child0.SetPosition(YogaEdge.Top, 0.Px());
root_child0.Width = 50.Px();
root_child0.Height = 50.Px();
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.Px());
root_child1.SetPosition(YogaEdge.Bottom, 0.Px());
root_child1.Width = 50.Px();
root_child1.Height = 50.Px();
root.Insert(1, root_child1);
root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout();

View File

@@ -22,32 +22,32 @@ namespace Facebook.Yoga
{
YogaNode root = new YogaNode();
root.Wrap = YogaWrap.Wrap;
root.Width = 100f;
root.Height = 100f;
root.Width = 100.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 50f;
root_child0.Height = 10f;
root_child0.Width = 50.Px();
root_child0.Height = 10.Px();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.Width = 50f;
root_child1.Height = 10f;
root_child1.Width = 50.Px();
root_child1.Height = 10.Px();
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
root_child2.Width = 50f;
root_child2.Height = 10f;
root_child2.Width = 50.Px();
root_child2.Height = 10.Px();
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
root_child3.Width = 50f;
root_child3.Height = 10f;
root_child3.Width = 50.Px();
root_child3.Height = 10.Px();
root.Insert(3, root_child3);
YogaNode root_child4 = new YogaNode();
root_child4.Width = 50f;
root_child4.Height = 10f;
root_child4.Width = 50.Px();
root_child4.Height = 10.Px();
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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 50f;
root_child0.Height = 10f;
root_child0.Width = 50.Px();
root_child0.Height = 10.Px();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.Width = 50f;
root_child1.Height = 10f;
root_child1.Width = 50.Px();
root_child1.Height = 10.Px();
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
root_child2.Width = 50f;
root_child2.Height = 10f;
root_child2.Width = 50.Px();
root_child2.Height = 10.Px();
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
root_child3.Width = 50f;
root_child3.Height = 10f;
root_child3.Width = 50.Px();
root_child3.Height = 10.Px();
root.Insert(3, root_child3);
YogaNode root_child4 = new YogaNode();
root_child4.Width = 50f;
root_child4.Height = 10f;
root_child4.Width = 50.Px();
root_child4.Height = 10.Px();
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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 50f;
root_child0.Height = 10f;
root_child0.Width = 50.Px();
root_child0.Height = 10.Px();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.Width = 50f;
root_child1.Height = 10f;
root_child1.Width = 50.Px();
root_child1.Height = 10.Px();
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
root_child2.Width = 50f;
root_child2.Height = 10f;
root_child2.Width = 50.Px();
root_child2.Height = 10.Px();
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
root_child3.Width = 50f;
root_child3.Height = 10f;
root_child3.Width = 50.Px();
root_child3.Height = 10.Px();
root.Insert(3, root_child3);
YogaNode root_child4 = new YogaNode();
root_child4.Width = 50f;
root_child4.Height = 10f;
root_child4.Width = 50.Px();
root_child4.Height = 10.Px();
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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 50f;
root_child0.Width = 50.Px();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.Width = 50f;
root_child1.Width = 50.Px();
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
root_child2.Width = 50f;
root_child2.Width = 50.Px();
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
root_child3.Width = 50f;
root_child3.Width = 50.Px();
root.Insert(3, root_child3);
YogaNode root_child4 = new YogaNode();
root_child4.Width = 50f;
root_child4.Width = 50.Px();
root.Insert(4, root_child4);
root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout();

View File

@@ -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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Height = 10f;
root_child0.Height = 10.Px();
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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 10f;
root_child0.Height = 10f;
root_child0.Width = 10.Px();
root_child0.Height = 10.Px();
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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 10f;
root_child0.Height = 10f;
root_child0.Width = 10.Px();
root_child0.Height = 10.Px();
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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 10f;
root_child0.Height = 10f;
root_child0.Width = 10.Px();
root_child0.Height = 10.Px();
root.Insert(0, root_child0);
root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout();

View File

@@ -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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.AlignSelf = YogaAlign.Center;
root_child0.Width = 10f;
root_child0.Height = 10f;
root_child0.Width = 10.Px();
root_child0.Height = 10.Px();
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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.AlignSelf = YogaAlign.FlexEnd;
root_child0.Width = 10f;
root_child0.Height = 10f;
root_child0.Width = 10.Px();
root_child0.Height = 10.Px();
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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.AlignSelf = YogaAlign.FlexStart;
root_child0.Width = 10f;
root_child0.Height = 10f;
root_child0.Width = 10.Px();
root_child0.Height = 10.Px();
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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.AlignSelf = YogaAlign.FlexEnd;
root_child0.Width = 10f;
root_child0.Height = 10f;
root_child0.Width = 10.Px();
root_child0.Height = 10.Px();
root.Insert(0, root_child0);
root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout();

View File

@@ -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.Px();
root_child0.Height = 10.Px();
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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.Width = 10f;
root_child0.FlexGrow = 1;
root_child0.Width = 10.Px();
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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Height = 10f;
root_child0.Height = 10.Px();
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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 10f;
root_child0.Height = 10f;
root_child0.Width = 10.Px();
root_child0.Height = 10.Px();
root.Insert(0, root_child0);
root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout();

View File

@@ -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.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Height = 10f;
root_child0.Height = 10.Px();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.Height = 10f;
root_child1.Height = 10.Px();
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
root_child2.Height = 10f;
root_child2.Height = 10.Px();
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.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 10f;
root_child0.Width = 10.Px();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.Width = 10f;
root_child1.Width = 10.Px();
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
root_child2.Width = 10f;
root_child2.Width = 10.Px();
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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Height = 10f;
root_child0.Height = 10.Px();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.Height = 10f;
root_child1.Height = 10.Px();
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
root_child2.Height = 10f;
root_child2.Height = 10.Px();
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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 10f;
root_child0.Width = 10.Px();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.Width = 10f;
root_child1.Width = 10.Px();
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
root_child2.Width = 10f;
root_child2.Width = 10.Px();
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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Height = 10f;
root_child0.Height = 10.Px();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.Height = 10f;
root_child1.Height = 10.Px();
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
root_child2.Height = 10f;
root_child2.Height = 10.Px();
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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 10f;
root_child0.Width = 10.Px();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.Width = 10f;
root_child1.Width = 10.Px();
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
root_child2.Width = 10f;
root_child2.Width = 10.Px();
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout();

View File

@@ -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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.FlexBasis = 50f;
root_child0.FlexGrow = 1;
root_child0.FlexBasis = 50.Px();
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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.FlexBasis = 50f;
root_child0.FlexGrow = 1;
root_child0.FlexBasis = 50.Px();
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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.FlexShrink = 1f;
root_child0.FlexBasis = 100f;
root_child0.FlexShrink = 1;
root_child0.FlexBasis = 100.Px();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.FlexBasis = 50f;
root_child1.FlexBasis = 50.Px();
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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.FlexShrink = 1f;
root_child0.FlexBasis = 100f;
root_child0.FlexShrink = 1;
root_child0.FlexBasis = 100.Px();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.FlexBasis = 50f;
root_child1.FlexBasis = 50.Px();
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.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 50f;
root_child0.Height = 50f;
root_child0.Width = 50.Px();
root_child0.Height = 50.Px();
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.Px();
root_child1.Height = 50.Px();
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
root_child2.Width = 50f;
root_child2.Height = 50f;
root_child2.Width = 50.Px();
root_child2.Height = 50.Px();
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.Px();
root.Height = 100.Px();
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.Px();
root_child0.Height = 20.Px();
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.Px();
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.Px();
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.Px();
root.Height = 100.Px();
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();

View File

@@ -22,26 +22,26 @@ namespace Facebook.Yoga
{
YogaNode root = new YogaNode();
root.Wrap = YogaWrap.Wrap;
root.Height = 100f;
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 30f;
root_child0.Height = 30f;
root_child0.Width = 30.Px();
root_child0.Height = 30.Px();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.Width = 30f;
root_child1.Height = 30f;
root_child1.Width = 30.Px();
root_child1.Height = 30.Px();
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
root_child2.Width = 30f;
root_child2.Height = 30f;
root_child2.Width = 30.Px();
root_child2.Height = 30.Px();
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
root_child3.Width = 30f;
root_child3.Height = 30f;
root_child3.Width = 30.Px();
root_child3.Height = 30.Px();
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.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 30f;
root_child0.Height = 30f;
root_child0.Width = 30.Px();
root_child0.Height = 30.Px();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.Width = 30f;
root_child1.Height = 30f;
root_child1.Width = 30.Px();
root_child1.Height = 30.Px();
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
root_child2.Width = 30f;
root_child2.Height = 30f;
root_child2.Width = 30.Px();
root_child2.Height = 30.Px();
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
root_child3.Width = 30f;
root_child3.Height = 30f;
root_child3.Width = 30.Px();
root_child3.Height = 30.Px();
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.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 30f;
root_child0.Height = 10f;
root_child0.Width = 30.Px();
root_child0.Height = 10.Px();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.Width = 30f;
root_child1.Height = 20f;
root_child1.Width = 30.Px();
root_child1.Height = 20.Px();
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
root_child2.Width = 30f;
root_child2.Height = 30f;
root_child2.Width = 30.Px();
root_child2.Height = 30.Px();
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
root_child3.Width = 30f;
root_child3.Height = 30f;
root_child3.Width = 30.Px();
root_child3.Height = 30.Px();
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.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 30f;
root_child0.Height = 10f;
root_child0.Width = 30.Px();
root_child0.Height = 10.Px();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.Width = 30f;
root_child1.Height = 20f;
root_child1.Width = 30.Px();
root_child1.Height = 20.Px();
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
root_child2.Width = 30f;
root_child2.Height = 30f;
root_child2.Width = 30.Px();
root_child2.Height = 30.Px();
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
root_child3.Width = 30f;
root_child3.Height = 30f;
root_child3.Width = 30.Px();
root_child3.Height = 30.Px();
root.Insert(3, root_child3);
root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout();

View File

@@ -22,19 +22,19 @@ namespace Facebook.Yoga
{
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 102f;
root.Height = 102f;
root.Width = 102.Px();
root.Height = 102.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 10f;
root_child0.Width = 10.Px();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.Width = 10f;
root_child1.Width = 10.Px();
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
root_child2.Width = 10f;
root_child2.Width = 10.Px();
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.Px();
root.Height = 102.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 10f;
root_child0.Width = 10.Px();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.Width = 10f;
root_child1.Width = 10.Px();
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
root_child2.Width = 10f;
root_child2.Width = 10.Px();
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.Px();
root.Height = 102.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 10f;
root_child0.Width = 10.Px();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.Width = 10f;
root_child1.Width = 10.Px();
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
root_child2.Width = 10f;
root_child2.Width = 10.Px();
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.Px();
root.Height = 102.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 10f;
root_child0.Width = 10.Px();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.Width = 10f;
root_child1.Width = 10.Px();
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
root_child2.Width = 10f;
root_child2.Width = 10.Px();
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.Px();
root.Height = 102.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 10f;
root_child0.Width = 10.Px();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.Width = 10f;
root_child1.Width = 10.Px();
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
root_child2.Width = 10f;
root_child2.Width = 10.Px();
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.Px();
root.Height = 102.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Height = 10f;
root_child0.Height = 10.Px();
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.Px();
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.Px();
root.Height = 102.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Height = 10f;
root_child0.Height = 10.Px();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.Height = 10f;
root_child1.Height = 10.Px();
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
root_child2.Height = 10f;
root_child2.Height = 10.Px();
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.Px();
root.Height = 102.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Height = 10f;
root_child0.Height = 10.Px();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.Height = 10f;
root_child1.Height = 10.Px();
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
root_child2.Height = 10f;
root_child2.Height = 10.Px();
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.Px();
root.Height = 102.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Height = 10f;
root_child0.Height = 10.Px();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.Height = 10f;
root_child1.Height = 10.Px();
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
root_child2.Height = 10f;
root_child2.Height = 10.Px();
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.Px();
root.Height = 102.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Height = 10f;
root_child0.Height = 10.Px();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.Height = 10f;
root_child1.Height = 10.Px();
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
root_child2.Height = 10f;
root_child2.Height = 10.Px();
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout();

View File

@@ -22,12 +22,12 @@ namespace Facebook.Yoga
{
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100f;
root.Height = 100f;
root.Width = 100.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.SetMargin(YogaEdge.Start, 10f);
root_child0.Width = 10f;
root_child0.SetMargin(YogaEdge.Start, 10.Px());
root_child0.Width = 10.Px();
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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.SetMargin(YogaEdge.Top, 10f);
root_child0.Height = 10f;
root_child0.SetMargin(YogaEdge.Top, 10.Px());
root_child0.Height = 10.Px();
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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.SetMargin(YogaEdge.End, 10f);
root_child0.Width = 10f;
root_child0.SetMargin(YogaEdge.End, 10.Px());
root_child0.Width = 10.Px();
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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.SetMargin(YogaEdge.Bottom, 10f);
root_child0.Height = 10f;
root_child0.SetMargin(YogaEdge.Bottom, 10.Px());
root_child0.Height = 10.Px();
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.Px();
root.Height = 100.Px();
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.Px());
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.Px();
root.Height = 100.Px();
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.Px());
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.Px();
root.Height = 100.Px();
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.Px());
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.Px();
root.Height = 100.Px();
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.Px());
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.Px();
root.Height = 100.Px();
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.Px();
root.Height = 100.Px();
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();

View File

@@ -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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.MaxWidth = 50f;
root_child0.Height = 10f;
root_child0.MaxWidth = 50.Px();
root_child0.Height = 10.Px();
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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 10f;
root_child0.MaxHeight = 50f;
root_child0.Width = 10.Px();
root_child0.MaxHeight = 50.Px();
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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.MinHeight = 60f;
root_child0.FlexGrow = 1;
root_child0.MinHeight = 60.Px();
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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.MinWidth = 60f;
root_child0.FlexGrow = 1;
root_child0.MinWidth = 60.Px();
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.Px();
root.MinHeight = 100.Px();
root.MaxHeight = 200.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 60f;
root_child0.Height = 60f;
root_child0.Width = 60.Px();
root_child0.Height = 60.Px();
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.Px();
root.MaxWidth = 200.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 60f;
root_child0.Height = 60f;
root_child0.Width = 60.Px();
root_child0.Height = 60.Px();
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.Px();
root.MaxHeight = 110.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 50f;
root_child0.Height = 50f;
root_child0.Width = 50.Px();
root_child0.Height = 50.Px();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.Width = 50f;
root_child1.Height = 50f;
root_child1.Width = 50.Px();
root_child1.Height = 50.Px();
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
root_child2.Width = 50f;
root_child2.Height = 50f;
root_child2.Width = 50.Px();
root_child2.Height = 50.Px();
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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.FlexDirection = YogaFlexDirection.Row;
root_child0.MaxWidth = 100f;
root_child0.MaxWidth = 100.Px();
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.Px();
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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.FlexDirection = YogaFlexDirection.Row;
root_child0.MaxWidth = 300f;
root_child0.MaxWidth = 300.Px();
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.Px();
root_child0.Insert(0, root_child0_child0);
root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout();

View File

@@ -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.Px());
root.SetPadding(YogaEdge.Top, 10.Px());
root.SetPadding(YogaEdge.Right, 10.Px());
root.SetPadding(YogaEdge.Bottom, 10.Px());
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.Px());
root.SetPadding(YogaEdge.Top, 10.Px());
root.SetPadding(YogaEdge.Right, 10.Px());
root.SetPadding(YogaEdge.Bottom, 10.Px());
YogaNode root_child0 = new YogaNode();
root_child0.Width = 10f;
root_child0.Height = 10f;
root_child0.Width = 10.Px();
root_child0.Height = 10.Px();
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.Px());
root.SetPadding(YogaEdge.Top, 10.Px());
root.SetPadding(YogaEdge.Right, 10.Px());
root.SetPadding(YogaEdge.Bottom, 10.Px());
root.Width = 100.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.Width = 10f;
root_child0.FlexGrow = 1;
root_child0.Width = 10.Px();
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.Px());
root.SetPadding(YogaEdge.Top, 10.Px());
root.SetPadding(YogaEdge.Right, 10.Px());
root.SetPadding(YogaEdge.Bottom, 10.Px());
root.Width = 100.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Height = 10f;
root_child0.Height = 10.Px();
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.Px());
root.SetPadding(YogaEdge.End, 20.Px());
root.SetPadding(YogaEdge.Bottom, 20.Px());
root.Width = 100.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 10f;
root_child0.Height = 10f;
root_child0.Width = 10.Px();
root_child0.Height = 10.Px();
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.Px();
root.Height = 200.Px();
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.Px());
root_child0.SetPadding(YogaEdge.Top, 20.Px());
root_child0.SetPadding(YogaEdge.Right, 20.Px());
root_child0.SetPadding(YogaEdge.Bottom, 20.Px());
root_child0.Width = 100.Px();
root_child0.Height = 100.Px();
root.Insert(0, root_child0);
root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout();

View File

@@ -24,12 +24,12 @@ namespace Facebook.Yoga
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 200f;
root.Height = 200f;
root.Width = 200.Px();
root.Height = 200.Px();
YogaNode root_child0 = new YogaNode();
root_child0.Width = 30f;
root_child0.Height = 30f;
root_child0.Width = 30.Percent();
root_child0.Height = 30.Percent();
root.Insert(0, root_child0);
root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout();
@@ -67,14 +67,14 @@ namespace Facebook.Yoga
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 400f;
root.Height = 400f;
root.Width = 400.Px();
root.Height = 400.Px();
YogaNode root_child0 = new YogaNode();
root_child0.SetPosition(YogaEdge.Left, 10f);
root_child0.SetPosition(YogaEdge.Top, 20f);
root_child0.Width = 45f;
root_child0.Height = 55f;
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();
@@ -112,14 +112,14 @@ namespace Facebook.Yoga
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 500f;
root.Height = 500f;
root.Width = 500.Px();
root.Height = 500.Px();
YogaNode root_child0 = new YogaNode();
root_child0.SetPosition(YogaEdge.Right, 20f);
root_child0.SetPosition(YogaEdge.Bottom, 10f);
root_child0.Width = 55f;
root_child0.Height = 15f;
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();
@@ -157,17 +157,17 @@ namespace Facebook.Yoga
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 200f;
root.Height = 200f;
root.Width = 200.Px();
root.Height = 200.Px();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.FlexBasis = 50f;
root_child0.FlexGrow = 1;
root_child0.FlexBasis = 50.Percent();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.FlexGrow = 1f;
root_child1.FlexBasis = 25f;
root_child1.FlexGrow = 1;
root_child1.FlexBasis = 25.Percent();
root.Insert(1, root_child1);
root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout();
@@ -214,17 +214,17 @@ namespace Facebook.Yoga
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
root.Width = 200f;
root.Height = 200f;
root.Width = 200.Px();
root.Height = 200.Px();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.FlexBasis = 50f;
root_child0.FlexGrow = 1;
root_child0.FlexBasis = 50.Percent();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.FlexGrow = 1f;
root_child1.FlexBasis = 25f;
root_child1.FlexGrow = 1;
root_child1.FlexBasis = 25.Percent();
root.Insert(1, root_child1);
root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout();
@@ -271,17 +271,17 @@ namespace Facebook.Yoga
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
root.Width = 200f;
root.Height = 200f;
root.Width = 200.Px();
root.Height = 200.Px();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.MinHeight = 60f;
root_child0.FlexGrow = 1;
root_child0.MinHeight = 60.Percent();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.FlexGrow = 2f;
root_child1.MinHeight = 10f;
root_child1.FlexGrow = 2;
root_child1.MinHeight = 10.Percent();
root.Insert(1, root_child1);
root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout();
@@ -329,19 +329,19 @@ namespace Facebook.Yoga
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 200f;
root.Height = 200f;
root.Width = 200.Px();
root.Height = 200.Px();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.FlexBasis = 10f;
root_child0.MaxHeight = 60f;
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 = 4f;
root_child1.FlexBasis = 10f;
root_child1.MaxHeight = 20f;
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();
@@ -388,19 +388,19 @@ namespace Facebook.Yoga
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
root.Width = 200f;
root.Height = 200f;
root.Width = 200.Px();
root.Height = 200.Px();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.FlexBasis = 10f;
root_child0.MaxHeight = 60f;
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 = 4f;
root_child1.FlexBasis = 10f;
root_child1.MaxHeight = 20f;
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();
@@ -448,19 +448,19 @@ namespace Facebook.Yoga
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 200f;
root.Height = 200f;
root.Width = 200.Px();
root.Height = 200.Px();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.FlexBasis = 15f;
root_child0.MaxWidth = 60f;
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 = 4f;
root_child1.FlexBasis = 10f;
root_child1.MaxWidth = 20f;
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();
@@ -507,19 +507,19 @@ namespace Facebook.Yoga
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
root.Width = 200f;
root.Height = 200f;
root.Width = 200.Px();
root.Height = 200.Px();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.FlexBasis = 10f;
root_child0.MaxWidth = 60f;
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 = 4f;
root_child1.FlexBasis = 15f;
root_child1.MaxWidth = 20f;
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();
@@ -567,19 +567,19 @@ namespace Facebook.Yoga
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 200f;
root.Height = 200f;
root.Width = 200.Px();
root.Height = 200.Px();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.FlexBasis = 15f;
root_child0.MinWidth = 60f;
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 = 4f;
root_child1.FlexBasis = 10f;
root_child1.MinWidth = 20f;
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();
@@ -626,19 +626,19 @@ namespace Facebook.Yoga
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
root.Width = 200f;
root.Height = 200f;
root.Width = 200.Px();
root.Height = 200.Px();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.FlexBasis = 10f;
root_child0.MinWidth = 60f;
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 = 4f;
root_child1.FlexBasis = 15f;
root_child1.MinWidth = 20f;
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();
@@ -685,51 +685,51 @@ namespace Facebook.Yoga
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
root.Width = 200f;
root.Height = 200f;
root.Width = 200.Px();
root.Height = 200.Px();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.FlexBasis = 10f;
root_child0.SetMargin(YogaEdge.Left, 5f);
root_child0.SetMargin(YogaEdge.Top, 5f);
root_child0.SetMargin(YogaEdge.Right, 5f);
root_child0.SetMargin(YogaEdge.Bottom, 5f);
root_child0.SetPadding(YogaEdge.Left, 3f);
root_child0.SetPadding(YogaEdge.Top, 3f);
root_child0.SetPadding(YogaEdge.Right, 3f);
root_child0.SetPadding(YogaEdge.Bottom, 3f);
root_child0.MinWidth = 60f;
root_child0.FlexGrow = 1;
root_child0.FlexBasis = 10.Percent();
root_child0.SetMargin(YogaEdge.Left, 5.Px());
root_child0.SetMargin(YogaEdge.Top, 5.Px());
root_child0.SetMargin(YogaEdge.Right, 5.Px());
root_child0.SetMargin(YogaEdge.Bottom, 5.Px());
root_child0.SetPadding(YogaEdge.Left, 3.Px());
root_child0.SetPadding(YogaEdge.Top, 3.Px());
root_child0.SetPadding(YogaEdge.Right, 3.Px());
root_child0.SetPadding(YogaEdge.Bottom, 3.Px());
root_child0.MinWidth = 60.Percent();
root.Insert(0, root_child0);
YogaNode root_child0_child0 = new YogaNode();
root_child0_child0.SetMargin(YogaEdge.Left, 5f);
root_child0_child0.SetMargin(YogaEdge.Top, 5f);
root_child0_child0.SetMargin(YogaEdge.Right, 5f);
root_child0_child0.SetMargin(YogaEdge.Bottom, 5f);
root_child0_child0.SetPadding(YogaEdge.Left, 3f);
root_child0_child0.SetPadding(YogaEdge.Top, 3f);
root_child0_child0.SetPadding(YogaEdge.Right, 3f);
root_child0_child0.SetPadding(YogaEdge.Bottom, 3f);
root_child0_child0.Width = 50f;
root_child0_child0.SetMargin(YogaEdge.Left, 5.Px());
root_child0_child0.SetMargin(YogaEdge.Top, 5.Px());
root_child0_child0.SetMargin(YogaEdge.Right, 5.Px());
root_child0_child0.SetMargin(YogaEdge.Bottom, 5.Px());
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, 5f);
root_child0_child0_child0.SetMargin(YogaEdge.Top, 5f);
root_child0_child0_child0.SetMargin(YogaEdge.Right, 5f);
root_child0_child0_child0.SetMargin(YogaEdge.Bottom, 5f);
root_child0_child0_child0.SetPadding(YogaEdge.Left, 3f);
root_child0_child0_child0.SetPadding(YogaEdge.Top, 3f);
root_child0_child0_child0.SetPadding(YogaEdge.Right, 3f);
root_child0_child0_child0.SetPadding(YogaEdge.Bottom, 3f);
root_child0_child0_child0.Width = 45f;
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.Px());
root_child0_child0_child0.SetPadding(YogaEdge.Top, 3.Px());
root_child0_child0_child0.SetPadding(YogaEdge.Right, 3.Px());
root_child0_child0_child0.SetPadding(YogaEdge.Bottom, 3.Px());
root_child0_child0_child0.Width = 45.Percent();
root_child0_child0.Insert(0, root_child0_child0_child0);
YogaNode root_child1 = new YogaNode();
root_child1.FlexGrow = 4f;
root_child1.FlexBasis = 15f;
root_child1.MinWidth = 20f;
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();
@@ -796,20 +796,20 @@ namespace Facebook.Yoga
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
root.Width = 200f;
root.Height = 100f;
root.Width = 200.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.SetMargin(YogaEdge.Left, 10f);
root_child0.SetMargin(YogaEdge.Top, 10f);
root_child0.SetMargin(YogaEdge.Right, 10f);
root_child0.SetMargin(YogaEdge.Bottom, 10f);
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 = 10f;
root_child0_child0.Height = 10f;
root_child0_child0.Width = 10.Px();
root_child0_child0.Height = 10.Px();
root_child0.Insert(0, root_child0_child0);
root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout();
@@ -856,20 +856,20 @@ namespace Facebook.Yoga
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
root.Width = 200f;
root.Height = 100f;
root.Width = 200.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.SetPadding(YogaEdge.Left, 10f);
root_child0.SetPadding(YogaEdge.Top, 10f);
root_child0.SetPadding(YogaEdge.Right, 10f);
root_child0.SetPadding(YogaEdge.Bottom, 10f);
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 = 10f;
root_child0_child0.Height = 10f;
root_child0_child0.Width = 10.Px();
root_child0_child0.Height = 10.Px();
root_child0.Insert(0, root_child0_child0);
root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout();
@@ -916,15 +916,15 @@ namespace Facebook.Yoga
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
root.Width = 200f;
root.Height = 100f;
root.Width = 200.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.PositionType = YogaPositionType.Absolute;
root_child0.SetPosition(YogaEdge.Left, 30f);
root_child0.SetPosition(YogaEdge.Top, 10f);
root_child0.Width = 10f;
root_child0.Height = 10f;
root_child0.SetPosition(YogaEdge.Left, 30.Percent());
root_child0.SetPosition(YogaEdge.Top, 10.Percent());
root_child0.Width = 10.Px();
root_child0.Height = 10.Px();
root.Insert(0, root_child0);
root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout();

View File

@@ -24,19 +24,19 @@ namespace Facebook.Yoga
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100f;
root.Height = 100f;
root.Width = 100.Px();
root.Height = 100.Px();
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.Px();
root.Height = 100.Px();
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.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.FlexShrink = 1f;
root_child0.FlexBasis = 100f;
root_child0.FlexShrink = 1;
root_child0.FlexBasis = 100.Px();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.FlexBasis = 25f;
root_child1.FlexBasis = 25.Px();
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
root_child2.FlexBasis = 25f;
root_child2.FlexBasis = 25.Px();
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.Px();
root.Height = 113.Px();
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.Px();
root_child0.Height = 20.Px();
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.Px();
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.Px();
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout();
@@ -335,23 +335,23 @@ namespace Facebook.Yoga
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
root.Width = 87.4f;
root.Height = 113.4f;
root.Width = 87.4f.Px();
root.Height = 113.4f.Px();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 0.7f;
root_child0.FlexBasis = 50.3f;
root_child0.Height = 20.3f;
root_child0.FlexBasis = 50.3f.Px();
root_child0.Height = 20.3f.Px();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.FlexGrow = 1.6f;
root_child1.Height = 10f;
root_child1.Height = 10.Px();
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
root_child2.FlexGrow = 1.1f;
root_child2.Height = 10.7f;
root_child2.Height = 10.7f.Px();
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout();
@@ -408,37 +408,37 @@ namespace Facebook.Yoga
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
root.Width = 87.4f;
root.Height = 113.4f;
root.Width = 87.4f.Px();
root.Height = 113.4f.Px();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 0.7f;
root_child0.FlexBasis = 50.3f;
root_child0.Height = 20.3f;
root_child0.FlexBasis = 50.3f.Px();
root_child0.Height = 20.3f.Px();
root.Insert(0, root_child0);
YogaNode root_child0_child0 = new YogaNode();
root_child0_child0.FlexGrow = 1f;
root_child0_child0.FlexBasis = 0.3f;
root_child0_child0.SetPosition(YogaEdge.Bottom, 13.3f);
root_child0_child0.Height = 9.9f;
root_child0_child0.FlexGrow = 1;
root_child0_child0.FlexBasis = 0.3f.Px();
root_child0_child0.SetPosition(YogaEdge.Bottom, 13.3f.Px());
root_child0_child0.Height = 9.9f.Px();
root_child0.Insert(0, root_child0_child0);
YogaNode root_child0_child1 = new YogaNode();
root_child0_child1.FlexGrow = 4f;
root_child0_child1.FlexBasis = 0.3f;
root_child0_child1.SetPosition(YogaEdge.Top, 13.3f);
root_child0_child1.Height = 1.1f;
root_child0_child1.FlexGrow = 4;
root_child0_child1.FlexBasis = 0.3f.Px();
root_child0_child1.SetPosition(YogaEdge.Top, 13.3f.Px());
root_child0_child1.Height = 1.1f.Px();
root_child0.Insert(1, root_child0_child1);
YogaNode root_child1 = new YogaNode();
root_child1.FlexGrow = 1.6f;
root_child1.Height = 10f;
root_child1.Height = 10.Px();
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
root_child2.FlexGrow = 1.1f;
root_child2.Height = 10.7f;
root_child2.Height = 10.7f.Px();
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout();
@@ -515,23 +515,23 @@ namespace Facebook.Yoga
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
root.Width = 100f;
root.Height = 113.4f;
root.Width = 100.Px();
root.Height = 113.4f.Px();
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.Px();
root_child0.Height = 20.Px();
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.Px();
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.Px();
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.Height = 113.6f;
root.Width = 100.Px();
root.Height = 113.6f.Px();
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.Px();
root_child0.Height = 20.Px();
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.Px();
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.Px();
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout();
@@ -661,24 +661,24 @@ namespace Facebook.Yoga
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
root.SetPosition(YogaEdge.Top, 0.3f);
root.Width = 100f;
root.Height = 113.4f;
root.SetPosition(YogaEdge.Top, 0.3f.Px());
root.Width = 100.Px();
root.Height = 113.4f.Px();
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.Px();
root_child0.Height = 20.Px();
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.Px();
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.Px();
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout();
@@ -735,24 +735,24 @@ namespace Facebook.Yoga
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
root.SetPosition(YogaEdge.Top, 0.7f);
root.Width = 100f;
root.Height = 113.4f;
root.SetPosition(YogaEdge.Top, 0.7f.Px());
root.Width = 100.Px();
root.Height = 113.4f.Px();
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.Px();
root_child0.Height = 20.Px();
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.Px();
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.Px();
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout();

View File

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

View File

@@ -225,7 +225,7 @@ namespace Facebook.Yoga
node1.MaxHeight = 100;
node0.CopyStyle(node1);
Assert.AreEqual(100, node0.MaxHeight);
Assert.AreEqual(100.Px(), node0.MaxHeight);
}
#if !UNITY_EDITOR

View File

@@ -9,7 +9,17 @@
function toValueCs(value) {
var n = value.toString().replace('px','').replace('%','');
return n + (Number(n) == n && n % 1 !== 0 ? '' : '');
return n + (Number(n) == n && n % 1 !== 0 ? 'f' : '');
}
function toValueCsCs(value) {
var methodName = '';
if(value.indexOf('px') >= 0){
methodName = 'Px';
}else if (value.indexOf('%') >= 0){
methodName = 'Percent';
}
return toValueCs(value) + '.' + methodName + '()';
}
var CSEmitter = function() {
@@ -160,7 +170,7 @@ CSEmitter.prototype = Object.create(Emitter.prototype, {
}},
YGNodeStyleSetBorder:{value:function(nodeName, edge, value) {
this.push(nodeName + '.SetBorder(' + edge + ', ' + toValueCs(value) + 'f);');
this.push(nodeName + '.SetBorder(' + edge + ', ' + toValueCs(value) + ');');
}},
YGNodeStyleSetDirection:{value:function(nodeName, value) {
@@ -168,7 +178,7 @@ CSEmitter.prototype = Object.create(Emitter.prototype, {
}},
YGNodeStyleSetFlexBasis:{value:function(nodeName, value) {
this.push(nodeName + '.FlexBasis = ' + toValueCs(value) + 'f;');
this.push(nodeName + '.FlexBasis = ' + toValueCsCs(value) + ';');
}},
YGNodeStyleSetFlexDirection:{value:function(nodeName, value) {
@@ -176,11 +186,11 @@ CSEmitter.prototype = Object.create(Emitter.prototype, {
}},
YGNodeStyleSetFlexGrow:{value:function(nodeName, value) {
this.push(nodeName + '.FlexGrow = ' + toValueCs(value) + 'f;');
this.push(nodeName + '.FlexGrow = ' + toValueCs(value) + ';');
}},
YGNodeStyleSetFlexShrink:{value:function(nodeName, value) {
this.push(nodeName + '.FlexShrink = ' + toValueCs(value) + 'f;');
this.push(nodeName + '.FlexShrink = ' + toValueCs(value) + ';');
}},
YGNodeStyleSetFlexWrap:{value:function(nodeName, value) {
@@ -188,7 +198,7 @@ CSEmitter.prototype = Object.create(Emitter.prototype, {
}},
YGNodeStyleSetHeight:{value:function(nodeName, value) {
this.push(nodeName + '.Height = ' + toValueCs(value) + 'f;');
this.push(nodeName + '.Height = ' + toValueCsCs(value) + ';');
}},
YGNodeStyleSetJustifyContent:{value:function(nodeName, value) {
@@ -196,23 +206,23 @@ CSEmitter.prototype = Object.create(Emitter.prototype, {
}},
YGNodeStyleSetMargin:{value:function(nodeName, edge, value) {
this.push(nodeName + '.SetMargin(' + edge + ', ' + toValueCs(value) + 'f);');
this.push(nodeName + '.SetMargin(' + edge + ', ' + toValueCsCs(value) + ');');
}},
YGNodeStyleSetMaxHeight:{value:function(nodeName, value) {
this.push(nodeName + '.MaxHeight = ' + toValueCs(value) + 'f;');
this.push(nodeName + '.MaxHeight = ' + toValueCsCs(value) + ';');
}},
YGNodeStyleSetMaxWidth:{value:function(nodeName, value) {
this.push(nodeName + '.MaxWidth = ' + toValueCs(value) + 'f;');
this.push(nodeName + '.MaxWidth = ' + toValueCsCs(value) + ';');
}},
YGNodeStyleSetMinHeight:{value:function(nodeName, value) {
this.push(nodeName + '.MinHeight = ' + toValueCs(value) + 'f;');
this.push(nodeName + '.MinHeight = ' + toValueCsCs(value) + ';');
}},
YGNodeStyleSetMinWidth:{value:function(nodeName, value) {
this.push(nodeName + '.MinWidth = ' + toValueCs(value) + 'f;');
this.push(nodeName + '.MinWidth = ' + toValueCsCs(value) + ';');
}},
YGNodeStyleSetOverflow:{value:function(nodeName, value) {
@@ -220,11 +230,11 @@ CSEmitter.prototype = Object.create(Emitter.prototype, {
}},
YGNodeStyleSetPadding:{value:function(nodeName, edge, value) {
this.push(nodeName + '.SetPadding(' + edge + ', ' + toValueCs(value) + 'f);');
this.push(nodeName + '.SetPadding(' + edge + ', ' + toValueCsCs(value) + ');');
}},
YGNodeStyleSetPosition:{value:function(nodeName, edge, value) {
this.push(nodeName + '.SetPosition(' + edge + ', ' + toValueCs(value) + 'f);');
this.push(nodeName + '.SetPosition(' + edge + ', ' + toValueCsCs(value) + ');');
}},
YGNodeStyleSetPositionType:{value:function(nodeName, value) {
@@ -232,6 +242,6 @@ CSEmitter.prototype = Object.create(Emitter.prototype, {
}},
YGNodeStyleSetWidth:{value:function(nodeName, value) {
this.push(nodeName + '.Width = ' + toValueCs(value) + 'f;');
this.push(nodeName + '.Width = ' + toValueCsCs(value) + ';');
}},
});