Move configuration to new YGConfig and pass them down to CalculateLayout

Summary:
Move configuration to new ```YGConfig``` and pass them down to CalculateLayout. See #418 .

Adds ```YGConfigNew()``` + ```YGConfigFree```, and changed ```YGSetExperimentalFeatureEnabled``` to use the config.

New function for calculation is ```YGNodeCalculateLayoutWithConfig```.
Closes https://github.com/facebook/yoga/pull/432

Reviewed By: astreet

Differential Revision: D4611359

Pulled By: emilsjolander

fbshipit-source-id: a1332f0e1b21cec02129dd021ee57408449e10b0
This commit is contained in:
Lukas Wöhrl
2017-03-01 09:19:55 -08:00
committed by Facebook Github Bot
parent 8668e43f6d
commit 37c48257ae
89 changed files with 4536 additions and 3049 deletions

View File

@@ -75,6 +75,38 @@ namespace Facebook.Yoga
#endif
}
internal class YGConfigHandle : SafeHandle
{
#if (UNITY_IOS && !UNITY_EDITOR) || __IOS__
private GCHandle _managed;
#endif
private YGConfigHandle() : base(IntPtr.Zero, true)
{
}
public override bool IsInvalid
{
get
{
return this.handle == IntPtr.Zero;
}
}
protected override bool ReleaseHandle()
{
#if (UNITY_IOS && !UNITY_EDITOR) || __IOS__
if (_managed.IsAllocated)
{
_managed.Free();
}
#endif
Native.YGConfigFree(this.handle);
GC.KeepAlive(this);
return true;
}
}
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern void YGInteropSetLogger(
[MarshalAs(UnmanagedType.FunctionPtr)] YogaLogger.Func func);
@@ -82,22 +114,33 @@ namespace Facebook.Yoga
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern YGNodeHandle YGNodeNew();
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern YGNodeHandle YGNodeNewWithConfig(YGConfigHandle config);
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern void YGNodeFree(IntPtr node);
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern void YGNodeReset(YGNodeHandle node);
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern YGConfigHandle YGConfigNew();
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern void YGConfigFree(IntPtr node);
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern int YGNodeGetInstanceCount();
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern void YGSetExperimentalFeatureEnabled(
public static extern void YGConfigSetExperimentalFeatureEnabled(
YGConfigHandle config,
YogaExperimentalFeature feature,
bool enabled);
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern bool YGIsExperimentalFeatureEnabled(
public static extern bool YGConfigIsExperimentalFeatureEnabled(
YGConfigHandle config,
YogaExperimentalFeature feature);
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
@@ -258,7 +301,7 @@ namespace Facebook.Yoga
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern void YGNodeStyleSetHeightPercent(YGNodeHandle node, float height);
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern void YGNodeStyleSetHeightAuto(YGNodeHandle node);

View File

@@ -21,6 +21,40 @@ using ObjCRuntime;
namespace Facebook.Yoga
{
public class YogaConfig
{
private Native.YGConfigHandle _ygConfig;
public YogaConfig()
{
_ygConfig = Native.YGConfigNew();
if (_ygConfig.IsInvalid)
{
throw new InvalidOperationException("Failed to allocate native memory");
}
}
internal Native.YGConfigHandle Handle {
get {
return _ygConfig;
}
}
public void SetExperimentalFeatureEnabled(
YogaExperimentalFeature feature,
bool enabled)
{
Native.YGConfigSetExperimentalFeatureEnabled(_ygConfig, feature, enabled);
}
public bool IsExperimentalFeatureEnabled(YogaExperimentalFeature feature)
{
return Native.YGConfigIsExperimentalFeatureEnabled(_ygConfig, feature);
}
}
public partial class YogaNode : IEnumerable<YogaNode>
{
private Native.YGNodeHandle _ygNode;
@@ -48,6 +82,17 @@ namespace Facebook.Yoga
}
}
public YogaNode(YogaConfig config)
{
YogaLogger.Initialize();
_ygNode = Native.YGNodeNewWithConfig(config.Handle);
if (_ygNode.IsInvalid)
{
throw new InvalidOperationException("Failed to allocate native memory");
}
}
public YogaNode(YogaNode srcNode)
: this()
{
@@ -681,17 +726,5 @@ namespace Facebook.Yoga
{
return Native.YGNodeGetInstanceCount();
}
public static void SetExperimentalFeatureEnabled(
YogaExperimentalFeature feature,
bool enabled)
{
Native.YGSetExperimentalFeatureEnabled(feature, enabled);
}
public static bool IsExperimentalFeatureEnabled(YogaExperimentalFeature feature)
{
return Native.YGIsExperimentalFeatureEnabled(feature);
}
}
}

View File

@@ -20,11 +20,13 @@ namespace Facebook.Yoga
[Test]
public void Test_absolute_layout_width_height_start_top()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.PositionType = YogaPositionType.Absolute;
root_child0.Start = 10;
root_child0.Top = 10;
@@ -61,11 +63,13 @@ namespace Facebook.Yoga
[Test]
public void Test_absolute_layout_width_height_end_bottom()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.PositionType = YogaPositionType.Absolute;
root_child0.End = 10;
root_child0.Bottom = 10;
@@ -102,11 +106,13 @@ namespace Facebook.Yoga
[Test]
public void Test_absolute_layout_start_top_end_bottom()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.PositionType = YogaPositionType.Absolute;
root_child0.Start = 10;
root_child0.Top = 10;
@@ -143,11 +149,13 @@ namespace Facebook.Yoga
[Test]
public void Test_absolute_layout_width_height_start_top_end_bottom()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.PositionType = YogaPositionType.Absolute;
root_child0.Start = 10;
root_child0.Top = 10;
@@ -186,19 +194,21 @@ namespace Facebook.Yoga
[Test]
public void Test_do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Overflow = YogaOverflow.Hidden;
root.Width = 50;
root.Height = 50;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.PositionType = YogaPositionType.Absolute;
root_child0.Start = 0;
root_child0.Top = 0;
root.Insert(0, root_child0);
YogaNode root_child0_child0 = new YogaNode();
YogaNode root_child0_child0 = new YogaNode(config);
root_child0_child0.Width = 100;
root_child0_child0.Height = 100;
root_child0.Insert(0, root_child0_child0);
@@ -242,7 +252,9 @@ namespace Facebook.Yoga
[Test]
public void Test_absolute_layout_within_border()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.MarginLeft = 10;
root.MarginTop = 10;
root.MarginRight = 10;
@@ -258,7 +270,7 @@ namespace Facebook.Yoga
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.PositionType = YogaPositionType.Absolute;
root_child0.Left = 0;
root_child0.Top = 0;
@@ -266,7 +278,7 @@ namespace Facebook.Yoga
root_child0.Height = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.PositionType = YogaPositionType.Absolute;
root_child1.Right = 0;
root_child1.Bottom = 0;
@@ -313,14 +325,16 @@ namespace Facebook.Yoga
[Test]
public void Test_absolute_layout_align_items_and_justify_content_center()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.JustifyContent = YogaJustify.Center;
root.AlignItems = YogaAlign.Center;
root.FlexGrow = 1;
root.Width = 110;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.PositionType = YogaPositionType.Absolute;
root_child0.Width = 60;
root_child0.Height = 40;
@@ -355,14 +369,16 @@ namespace Facebook.Yoga
[Test]
public void Test_absolute_layout_align_items_and_justify_content_flex_end()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.JustifyContent = YogaJustify.FlexEnd;
root.AlignItems = YogaAlign.FlexEnd;
root.FlexGrow = 1;
root.Width = 110;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.PositionType = YogaPositionType.Absolute;
root_child0.Width = 60;
root_child0.Height = 40;
@@ -397,13 +413,15 @@ namespace Facebook.Yoga
[Test]
public void Test_absolute_layout_justify_content_center()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.JustifyContent = YogaJustify.Center;
root.FlexGrow = 1;
root.Width = 110;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.PositionType = YogaPositionType.Absolute;
root_child0.Width = 60;
root_child0.Height = 40;
@@ -438,13 +456,15 @@ namespace Facebook.Yoga
[Test]
public void Test_absolute_layout_align_items_center()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.AlignItems = YogaAlign.Center;
root.FlexGrow = 1;
root.Width = 110;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.PositionType = YogaPositionType.Absolute;
root_child0.Width = 60;
root_child0.Height = 40;
@@ -479,12 +499,14 @@ namespace Facebook.Yoga
[Test]
public void Test_absolute_layout_align_items_center_on_child_only()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexGrow = 1;
root.Width = 110;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.AlignSelf = YogaAlign.Center;
root_child0.PositionType = YogaPositionType.Absolute;
root_child0.Width = 60;
@@ -520,14 +542,16 @@ namespace Facebook.Yoga
[Test]
public void Test_absolute_layout_align_items_and_justify_content_center_and_top_position()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.JustifyContent = YogaJustify.Center;
root.AlignItems = YogaAlign.Center;
root.FlexGrow = 1;
root.Width = 110;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.PositionType = YogaPositionType.Absolute;
root_child0.Top = 10;
root_child0.Width = 60;
@@ -563,14 +587,16 @@ namespace Facebook.Yoga
[Test]
public void Test_absolute_layout_align_items_and_justify_content_center_and_bottom_position()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.JustifyContent = YogaJustify.Center;
root.AlignItems = YogaAlign.Center;
root.FlexGrow = 1;
root.Width = 110;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.PositionType = YogaPositionType.Absolute;
root_child0.Bottom = 10;
root_child0.Width = 60;
@@ -606,14 +632,16 @@ namespace Facebook.Yoga
[Test]
public void Test_absolute_layout_align_items_and_justify_content_center_and_left_position()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.JustifyContent = YogaJustify.Center;
root.AlignItems = YogaAlign.Center;
root.FlexGrow = 1;
root.Width = 110;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.PositionType = YogaPositionType.Absolute;
root_child0.Left = 5;
root_child0.Width = 60;
@@ -649,14 +677,16 @@ namespace Facebook.Yoga
[Test]
public void Test_absolute_layout_align_items_and_justify_content_center_and_right_position()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.JustifyContent = YogaJustify.Center;
root.AlignItems = YogaAlign.Center;
root.FlexGrow = 1;
root.Width = 110;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.PositionType = YogaPositionType.Absolute;
root_child0.Right = 5;
root_child0.Width = 60;

View File

@@ -20,33 +20,35 @@ namespace Facebook.Yoga
[Test]
public void Test_align_content_flex_start()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Wrap = YogaWrap.Wrap;
root.Width = 130;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root_child0.Height = 10;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root_child1.Height = 10;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 50;
root_child2.Height = 10;
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.Width = 50;
root_child3.Height = 10;
root.Insert(3, root_child3);
YogaNode root_child4 = new YogaNode();
YogaNode root_child4 = new YogaNode(config);
root_child4.Width = 50;
root_child4.Height = 10;
root.Insert(4, root_child4);
@@ -120,30 +122,32 @@ namespace Facebook.Yoga
[Test]
public void Test_align_content_flex_start_without_height_on_children()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Wrap = YogaWrap.Wrap;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root_child1.Height = 10;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 50;
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.Width = 50;
root_child3.Height = 10;
root.Insert(3, root_child3);
YogaNode root_child4 = new YogaNode();
YogaNode root_child4 = new YogaNode(config);
root_child4.Width = 50;
root.Insert(4, root_child4);
root.StyleDirection = YogaDirection.LTR;
@@ -216,36 +220,38 @@ namespace Facebook.Yoga
[Test]
public void Test_align_content_flex_start_with_flex()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Wrap = YogaWrap.Wrap;
root.Width = 100;
root.Height = 120;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.FlexBasis = 0.Percent();
root_child0.Width = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 1;
root_child1.FlexBasis = 0.Percent();
root_child1.Width = 50;
root_child1.Height = 10;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 50;
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.FlexGrow = 1;
root_child3.FlexShrink = 1;
root_child3.FlexBasis = 0.Percent();
root_child3.Width = 50;
root.Insert(3, root_child3);
YogaNode root_child4 = new YogaNode();
YogaNode root_child4 = new YogaNode(config);
root_child4.Width = 50;
root.Insert(4, root_child4);
root.StyleDirection = YogaDirection.LTR;
@@ -318,33 +324,35 @@ namespace Facebook.Yoga
[Test]
public void Test_align_content_flex_end()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.AlignContent = YogaAlign.FlexEnd;
root.Wrap = YogaWrap.Wrap;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root_child0.Height = 10;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root_child1.Height = 10;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 50;
root_child2.Height = 10;
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.Width = 50;
root_child3.Height = 10;
root.Insert(3, root_child3);
YogaNode root_child4 = new YogaNode();
YogaNode root_child4 = new YogaNode(config);
root_child4.Width = 50;
root_child4.Height = 10;
root.Insert(4, root_child4);
@@ -418,29 +426,31 @@ namespace Facebook.Yoga
[Test]
public void Test_align_content_stretch()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.AlignContent = YogaAlign.Stretch;
root.Wrap = YogaWrap.Wrap;
root.Width = 150;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 50;
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.Width = 50;
root.Insert(3, root_child3);
YogaNode root_child4 = new YogaNode();
YogaNode root_child4 = new YogaNode(config);
root_child4.Width = 50;
root.Insert(4, root_child4);
root.StyleDirection = YogaDirection.LTR;
@@ -513,34 +523,36 @@ namespace Facebook.Yoga
[Test]
public void Test_align_content_spacebetween()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignContent = YogaAlign.SpaceBetween;
root.Wrap = YogaWrap.Wrap;
root.Width = 130;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root_child0.Height = 10;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root_child1.Height = 10;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 50;
root_child2.Height = 10;
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.Width = 50;
root_child3.Height = 10;
root.Insert(3, root_child3);
YogaNode root_child4 = new YogaNode();
YogaNode root_child4 = new YogaNode(config);
root_child4.Width = 50;
root_child4.Height = 10;
root.Insert(4, root_child4);
@@ -614,34 +626,36 @@ namespace Facebook.Yoga
[Test]
public void Test_align_content_spacearound()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignContent = YogaAlign.SpaceAround;
root.Wrap = YogaWrap.Wrap;
root.Width = 140;
root.Height = 120;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root_child0.Height = 10;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root_child1.Height = 10;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 50;
root_child2.Height = 10;
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.Width = 50;
root_child3.Height = 10;
root.Insert(3, root_child3);
YogaNode root_child4 = new YogaNode();
YogaNode root_child4 = new YogaNode(config);
root_child4.Width = 50;
root_child4.Height = 10;
root.Insert(4, root_child4);
@@ -715,30 +729,32 @@ namespace Facebook.Yoga
[Test]
public void Test_align_content_stretch_row()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignContent = YogaAlign.Stretch;
root.Wrap = YogaWrap.Wrap;
root.Width = 150;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 50;
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.Width = 50;
root.Insert(3, root_child3);
YogaNode root_child4 = new YogaNode();
YogaNode root_child4 = new YogaNode(config);
root_child4.Width = 50;
root.Insert(4, root_child4);
root.StyleDirection = YogaDirection.LTR;
@@ -811,36 +827,38 @@ namespace Facebook.Yoga
[Test]
public void Test_align_content_stretch_row_with_children()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignContent = YogaAlign.Stretch;
root.Wrap = YogaWrap.Wrap;
root.Width = 150;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root.Insert(0, root_child0);
YogaNode root_child0_child0 = new YogaNode();
YogaNode root_child0_child0 = new YogaNode(config);
root_child0_child0.FlexGrow = 1;
root_child0_child0.FlexShrink = 1;
root_child0_child0.FlexBasis = 0.Percent();
root_child0.Insert(0, root_child0_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 50;
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.Width = 50;
root.Insert(3, root_child3);
YogaNode root_child4 = new YogaNode();
YogaNode root_child4 = new YogaNode(config);
root_child4.Width = 50;
root.Insert(4, root_child4);
root.StyleDirection = YogaDirection.LTR;
@@ -923,36 +941,38 @@ namespace Facebook.Yoga
[Test]
public void Test_align_content_stretch_row_with_flex()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignContent = YogaAlign.Stretch;
root.Wrap = YogaWrap.Wrap;
root.Width = 150;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 1;
root_child1.FlexShrink = 1;
root_child1.FlexBasis = 0.Percent();
root_child1.Width = 50;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 50;
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.FlexGrow = 1;
root_child3.FlexShrink = 1;
root_child3.FlexBasis = 0.Percent();
root_child3.Width = 50;
root.Insert(3, root_child3);
YogaNode root_child4 = new YogaNode();
YogaNode root_child4 = new YogaNode(config);
root_child4.Width = 50;
root.Insert(4, root_child4);
root.StyleDirection = YogaDirection.LTR;
@@ -1025,35 +1045,37 @@ namespace Facebook.Yoga
[Test]
public void Test_align_content_stretch_row_with_flex_no_shrink()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignContent = YogaAlign.Stretch;
root.Wrap = YogaWrap.Wrap;
root.Width = 150;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 1;
root_child1.FlexShrink = 1;
root_child1.FlexBasis = 0.Percent();
root_child1.Width = 50;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 50;
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.FlexGrow = 1;
root_child3.FlexBasis = 0.Percent();
root_child3.Width = 50;
root.Insert(3, root_child3);
YogaNode root_child4 = new YogaNode();
YogaNode root_child4 = new YogaNode(config);
root_child4.Width = 50;
root.Insert(4, root_child4);
root.StyleDirection = YogaDirection.LTR;
@@ -1126,18 +1148,20 @@ namespace Facebook.Yoga
[Test]
public void Test_align_content_stretch_row_with_margin()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignContent = YogaAlign.Stretch;
root.Wrap = YogaWrap.Wrap;
root.Width = 150;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.MarginLeft = 10;
root_child1.MarginTop = 10;
root_child1.MarginRight = 10;
@@ -1145,11 +1169,11 @@ namespace Facebook.Yoga
root_child1.Width = 50;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 50;
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.MarginLeft = 10;
root_child3.MarginTop = 10;
root_child3.MarginRight = 10;
@@ -1157,7 +1181,7 @@ namespace Facebook.Yoga
root_child3.Width = 50;
root.Insert(3, root_child3);
YogaNode root_child4 = new YogaNode();
YogaNode root_child4 = new YogaNode(config);
root_child4.Width = 50;
root.Insert(4, root_child4);
root.StyleDirection = YogaDirection.LTR;
@@ -1230,18 +1254,20 @@ namespace Facebook.Yoga
[Test]
public void Test_align_content_stretch_row_with_padding()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignContent = YogaAlign.Stretch;
root.Wrap = YogaWrap.Wrap;
root.Width = 150;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.PaddingLeft = 10;
root_child1.PaddingTop = 10;
root_child1.PaddingRight = 10;
@@ -1249,11 +1275,11 @@ namespace Facebook.Yoga
root_child1.Width = 50;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 50;
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.PaddingLeft = 10;
root_child3.PaddingTop = 10;
root_child3.PaddingRight = 10;
@@ -1261,7 +1287,7 @@ namespace Facebook.Yoga
root_child3.Width = 50;
root.Insert(3, root_child3);
YogaNode root_child4 = new YogaNode();
YogaNode root_child4 = new YogaNode(config);
root_child4.Width = 50;
root.Insert(4, root_child4);
root.StyleDirection = YogaDirection.LTR;
@@ -1334,18 +1360,20 @@ namespace Facebook.Yoga
[Test]
public void Test_align_content_stretch_row_with_single_row()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignContent = YogaAlign.Stretch;
root.Wrap = YogaWrap.Wrap;
root.Width = 150;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root.Insert(1, root_child1);
root.StyleDirection = YogaDirection.LTR;
@@ -1388,31 +1416,33 @@ namespace Facebook.Yoga
[Test]
public void Test_align_content_stretch_row_with_fixed_height()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignContent = YogaAlign.Stretch;
root.Wrap = YogaWrap.Wrap;
root.Width = 150;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root_child1.Height = 60;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 50;
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.Width = 50;
root.Insert(3, root_child3);
YogaNode root_child4 = new YogaNode();
YogaNode root_child4 = new YogaNode(config);
root_child4.Width = 50;
root.Insert(4, root_child4);
root.StyleDirection = YogaDirection.LTR;
@@ -1485,31 +1515,33 @@ namespace Facebook.Yoga
[Test]
public void Test_align_content_stretch_row_with_max_height()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignContent = YogaAlign.Stretch;
root.Wrap = YogaWrap.Wrap;
root.Width = 150;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root_child1.MaxHeight = 20;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 50;
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.Width = 50;
root.Insert(3, root_child3);
YogaNode root_child4 = new YogaNode();
YogaNode root_child4 = new YogaNode(config);
root_child4.Width = 50;
root.Insert(4, root_child4);
root.StyleDirection = YogaDirection.LTR;
@@ -1582,31 +1614,33 @@ namespace Facebook.Yoga
[Test]
public void Test_align_content_stretch_row_with_min_height()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignContent = YogaAlign.Stretch;
root.Wrap = YogaWrap.Wrap;
root.Width = 150;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root_child1.MinHeight = 80;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 50;
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.Width = 50;
root.Insert(3, root_child3);
YogaNode root_child4 = new YogaNode();
YogaNode root_child4 = new YogaNode(config);
root_child4.Width = 50;
root.Insert(4, root_child4);
root.StyleDirection = YogaDirection.LTR;
@@ -1679,38 +1713,40 @@ namespace Facebook.Yoga
[Test]
public void Test_align_content_stretch_column()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.AlignContent = YogaAlign.Stretch;
root.Wrap = YogaWrap.Wrap;
root.Width = 100;
root.Height = 150;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Height = 50;
root.Insert(0, root_child0);
YogaNode root_child0_child0 = new YogaNode();
YogaNode root_child0_child0 = new YogaNode(config);
root_child0_child0.FlexGrow = 1;
root_child0_child0.FlexShrink = 1;
root_child0_child0.FlexBasis = 0.Percent();
root_child0.Insert(0, root_child0_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 1;
root_child1.FlexShrink = 1;
root_child1.FlexBasis = 0.Percent();
root_child1.Height = 50;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Height = 50;
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.Height = 50;
root.Insert(3, root_child3);
YogaNode root_child4 = new YogaNode();
YogaNode root_child4 = new YogaNode(config);
root_child4.Height = 50;
root.Insert(4, root_child4);
root.StyleDirection = YogaDirection.LTR;
@@ -1793,10 +1829,12 @@ namespace Facebook.Yoga
[Test]
public void Test_align_content_stretch_is_not_overriding_align_items()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.AlignContent = YogaAlign.Stretch;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexDirection = YogaFlexDirection.Row;
root_child0.AlignContent = YogaAlign.Stretch;
root_child0.AlignItems = YogaAlign.Center;
@@ -1804,7 +1842,7 @@ namespace Facebook.Yoga
root_child0.Height = 100;
root.Insert(0, root_child0);
YogaNode root_child0_child0 = new YogaNode();
YogaNode root_child0_child0 = new YogaNode(config);
root_child0_child0.AlignContent = YogaAlign.Stretch;
root_child0_child0.Width = 10;
root_child0_child0.Height = 10;

View File

@@ -20,11 +20,13 @@ namespace Facebook.Yoga
[Test]
public void Test_align_items_stretch()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Height = 10;
root.Insert(0, root_child0);
root.StyleDirection = YogaDirection.LTR;
@@ -57,12 +59,14 @@ namespace Facebook.Yoga
[Test]
public void Test_align_items_center()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.AlignItems = YogaAlign.Center;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 10;
root_child0.Height = 10;
root.Insert(0, root_child0);
@@ -96,12 +100,14 @@ namespace Facebook.Yoga
[Test]
public void Test_align_items_flex_start()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.AlignItems = YogaAlign.FlexStart;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 10;
root_child0.Height = 10;
root.Insert(0, root_child0);
@@ -135,12 +141,14 @@ namespace Facebook.Yoga
[Test]
public void Test_align_items_flex_end()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.AlignItems = YogaAlign.FlexEnd;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 10;
root_child0.Height = 10;
root.Insert(0, root_child0);
@@ -174,18 +182,20 @@ namespace Facebook.Yoga
[Test]
public void Test_align_baseline()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignItems = YogaAlign.Baseline;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root_child0.Height = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root_child1.Height = 20;
root.Insert(1, root_child1);
@@ -229,23 +239,25 @@ namespace Facebook.Yoga
[Test]
public void Test_align_baseline_child()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignItems = YogaAlign.Baseline;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root_child0.Height = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root_child1.Height = 20;
root.Insert(1, root_child1);
YogaNode root_child1_child0 = new YogaNode();
YogaNode root_child1_child0 = new YogaNode(config);
root_child1_child0.Width = 50;
root_child1_child0.Height = 10;
root_child1.Insert(0, root_child1_child0);
@@ -299,40 +311,42 @@ namespace Facebook.Yoga
[Test]
public void Test_align_baseline_child_multiline()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignItems = YogaAlign.Baseline;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root_child0.Height = 60;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexDirection = YogaFlexDirection.Row;
root_child1.Wrap = YogaWrap.Wrap;
root_child1.Width = 50;
root_child1.Height = 25;
root.Insert(1, root_child1);
YogaNode root_child1_child0 = new YogaNode();
YogaNode root_child1_child0 = new YogaNode(config);
root_child1_child0.Width = 25;
root_child1_child0.Height = 20;
root_child1.Insert(0, root_child1_child0);
YogaNode root_child1_child1 = new YogaNode();
YogaNode root_child1_child1 = new YogaNode(config);
root_child1_child1.Width = 25;
root_child1_child1.Height = 10;
root_child1.Insert(1, root_child1_child1);
YogaNode root_child1_child2 = new YogaNode();
YogaNode root_child1_child2 = new YogaNode(config);
root_child1_child2.Width = 25;
root_child1_child2.Height = 20;
root_child1.Insert(2, root_child1_child2);
YogaNode root_child1_child3 = new YogaNode();
YogaNode root_child1_child3 = new YogaNode(config);
root_child1_child3.Width = 25;
root_child1_child3.Height = 10;
root_child1.Insert(3, root_child1_child3);
@@ -416,41 +430,43 @@ namespace Facebook.Yoga
[Test]
public void Test_align_baseline_child_multiline_override()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignItems = YogaAlign.Baseline;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root_child0.Height = 60;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexDirection = YogaFlexDirection.Row;
root_child1.Wrap = YogaWrap.Wrap;
root_child1.Width = 50;
root_child1.Height = 25;
root.Insert(1, root_child1);
YogaNode root_child1_child0 = new YogaNode();
YogaNode root_child1_child0 = new YogaNode(config);
root_child1_child0.Width = 25;
root_child1_child0.Height = 20;
root_child1.Insert(0, root_child1_child0);
YogaNode root_child1_child1 = new YogaNode();
YogaNode root_child1_child1 = new YogaNode(config);
root_child1_child1.AlignSelf = YogaAlign.Baseline;
root_child1_child1.Width = 25;
root_child1_child1.Height = 10;
root_child1.Insert(1, root_child1_child1);
YogaNode root_child1_child2 = new YogaNode();
YogaNode root_child1_child2 = new YogaNode(config);
root_child1_child2.Width = 25;
root_child1_child2.Height = 20;
root_child1.Insert(2, root_child1_child2);
YogaNode root_child1_child3 = new YogaNode();
YogaNode root_child1_child3 = new YogaNode(config);
root_child1_child3.AlignSelf = YogaAlign.Baseline;
root_child1_child3.Width = 25;
root_child1_child3.Height = 10;
@@ -535,40 +551,42 @@ namespace Facebook.Yoga
[Test]
public void Test_align_baseline_child_multiline_no_override_on_secondline()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignItems = YogaAlign.Baseline;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root_child0.Height = 60;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexDirection = YogaFlexDirection.Row;
root_child1.Wrap = YogaWrap.Wrap;
root_child1.Width = 50;
root_child1.Height = 25;
root.Insert(1, root_child1);
YogaNode root_child1_child0 = new YogaNode();
YogaNode root_child1_child0 = new YogaNode(config);
root_child1_child0.Width = 25;
root_child1_child0.Height = 20;
root_child1.Insert(0, root_child1_child0);
YogaNode root_child1_child1 = new YogaNode();
YogaNode root_child1_child1 = new YogaNode(config);
root_child1_child1.Width = 25;
root_child1_child1.Height = 10;
root_child1.Insert(1, root_child1_child1);
YogaNode root_child1_child2 = new YogaNode();
YogaNode root_child1_child2 = new YogaNode(config);
root_child1_child2.Width = 25;
root_child1_child2.Height = 20;
root_child1.Insert(2, root_child1_child2);
YogaNode root_child1_child3 = new YogaNode();
YogaNode root_child1_child3 = new YogaNode(config);
root_child1_child3.AlignSelf = YogaAlign.Baseline;
root_child1_child3.Width = 25;
root_child1_child3.Height = 10;
@@ -653,24 +671,26 @@ namespace Facebook.Yoga
[Test]
public void Test_align_baseline_child_top()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignItems = YogaAlign.Baseline;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Top = 10;
root_child0.Width = 50;
root_child0.Height = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root_child1.Height = 20;
root.Insert(1, root_child1);
YogaNode root_child1_child0 = new YogaNode();
YogaNode root_child1_child0 = new YogaNode(config);
root_child1_child0.Width = 50;
root_child1_child0.Height = 10;
root_child1.Insert(0, root_child1_child0);
@@ -724,24 +744,26 @@ namespace Facebook.Yoga
[Test]
public void Test_align_baseline_child_top2()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignItems = YogaAlign.Baseline;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root_child0.Height = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Top = 5;
root_child1.Width = 50;
root_child1.Height = 20;
root.Insert(1, root_child1);
YogaNode root_child1_child0 = new YogaNode();
YogaNode root_child1_child0 = new YogaNode(config);
root_child1_child0.Width = 50;
root_child1_child0.Height = 10;
root_child1.Insert(0, root_child1_child0);
@@ -795,28 +817,30 @@ namespace Facebook.Yoga
[Test]
public void Test_align_baseline_double_nested_child()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignItems = YogaAlign.Baseline;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root_child0.Height = 50;
root.Insert(0, root_child0);
YogaNode root_child0_child0 = new YogaNode();
YogaNode root_child0_child0 = new YogaNode(config);
root_child0_child0.Width = 50;
root_child0_child0.Height = 20;
root_child0.Insert(0, root_child0_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root_child1.Height = 20;
root.Insert(1, root_child1);
YogaNode root_child1_child0 = new YogaNode();
YogaNode root_child1_child0 = new YogaNode(config);
root_child1_child0.Width = 50;
root_child1_child0.Height = 15;
root_child1.Insert(0, root_child1_child0);
@@ -880,17 +904,19 @@ namespace Facebook.Yoga
[Test]
public void Test_align_baseline_column()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.AlignItems = YogaAlign.Baseline;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root_child0.Height = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root_child1.Height = 20;
root.Insert(1, root_child1);
@@ -934,13 +960,15 @@ namespace Facebook.Yoga
[Test]
public void Test_align_baseline_child_margin()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignItems = YogaAlign.Baseline;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.MarginLeft = 5;
root_child0.MarginTop = 5;
root_child0.MarginRight = 5;
@@ -949,12 +977,12 @@ namespace Facebook.Yoga
root_child0.Height = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root_child1.Height = 20;
root.Insert(1, root_child1);
YogaNode root_child1_child0 = new YogaNode();
YogaNode root_child1_child0 = new YogaNode(config);
root_child1_child0.MarginLeft = 1;
root_child1_child0.MarginTop = 1;
root_child1_child0.MarginRight = 1;
@@ -1012,7 +1040,9 @@ namespace Facebook.Yoga
[Test]
public void Test_align_baseline_child_padding()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignItems = YogaAlign.Baseline;
root.PaddingLeft = 5;
@@ -1022,12 +1052,12 @@ namespace Facebook.Yoga
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root_child0.Height = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.PaddingLeft = 5;
root_child1.PaddingTop = 5;
root_child1.PaddingRight = 5;
@@ -1036,7 +1066,7 @@ namespace Facebook.Yoga
root_child1.Height = 20;
root.Insert(1, root_child1);
YogaNode root_child1_child0 = new YogaNode();
YogaNode root_child1_child0 = new YogaNode(config);
root_child1_child0.Width = 50;
root_child1_child0.Height = 10;
root_child1.Insert(0, root_child1_child0);
@@ -1090,39 +1120,41 @@ namespace Facebook.Yoga
[Test]
public void Test_align_baseline_multiline()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignItems = YogaAlign.Baseline;
root.Wrap = YogaWrap.Wrap;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root_child0.Height = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root_child1.Height = 20;
root.Insert(1, root_child1);
YogaNode root_child1_child0 = new YogaNode();
YogaNode root_child1_child0 = new YogaNode(config);
root_child1_child0.Width = 50;
root_child1_child0.Height = 10;
root_child1.Insert(0, root_child1_child0);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 50;
root_child2.Height = 20;
root.Insert(2, root_child2);
YogaNode root_child2_child0 = new YogaNode();
YogaNode root_child2_child0 = new YogaNode(config);
root_child2_child0.Width = 50;
root_child2_child0.Height = 10;
root_child2.Insert(0, root_child2_child0);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.Width = 50;
root_child3.Height = 50;
root.Insert(3, root_child3);
@@ -1206,38 +1238,40 @@ namespace Facebook.Yoga
[Test]
public void Test_align_baseline_multiline_column()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.AlignItems = YogaAlign.Baseline;
root.Wrap = YogaWrap.Wrap;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root_child0.Height = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 30;
root_child1.Height = 50;
root.Insert(1, root_child1);
YogaNode root_child1_child0 = new YogaNode();
YogaNode root_child1_child0 = new YogaNode(config);
root_child1_child0.Width = 20;
root_child1_child0.Height = 20;
root_child1.Insert(0, root_child1_child0);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 40;
root_child2.Height = 70;
root.Insert(2, root_child2);
YogaNode root_child2_child0 = new YogaNode();
YogaNode root_child2_child0 = new YogaNode(config);
root_child2_child0.Width = 10;
root_child2_child0.Height = 10;
root_child2.Insert(0, root_child2_child0);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.Width = 50;
root_child3.Height = 20;
root.Insert(3, root_child3);
@@ -1321,38 +1355,40 @@ namespace Facebook.Yoga
[Test]
public void Test_align_baseline_multiline_column2()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.AlignItems = YogaAlign.Baseline;
root.Wrap = YogaWrap.Wrap;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root_child0.Height = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 30;
root_child1.Height = 50;
root.Insert(1, root_child1);
YogaNode root_child1_child0 = new YogaNode();
YogaNode root_child1_child0 = new YogaNode(config);
root_child1_child0.Width = 20;
root_child1_child0.Height = 20;
root_child1.Insert(0, root_child1_child0);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 40;
root_child2.Height = 70;
root.Insert(2, root_child2);
YogaNode root_child2_child0 = new YogaNode();
YogaNode root_child2_child0 = new YogaNode(config);
root_child2_child0.Width = 10;
root_child2_child0.Height = 10;
root_child2.Insert(0, root_child2_child0);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.Width = 50;
root_child3.Height = 20;
root.Insert(3, root_child3);
@@ -1436,39 +1472,41 @@ namespace Facebook.Yoga
[Test]
public void Test_align_baseline_multiline_row_and_column()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignItems = YogaAlign.Baseline;
root.Wrap = YogaWrap.Wrap;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root_child0.Height = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root_child1.Height = 50;
root.Insert(1, root_child1);
YogaNode root_child1_child0 = new YogaNode();
YogaNode root_child1_child0 = new YogaNode(config);
root_child1_child0.Width = 50;
root_child1_child0.Height = 10;
root_child1.Insert(0, root_child1_child0);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 50;
root_child2.Height = 20;
root.Insert(2, root_child2);
YogaNode root_child2_child0 = new YogaNode();
YogaNode root_child2_child0 = new YogaNode(config);
root_child2_child0.Width = 50;
root_child2_child0.Height = 10;
root_child2.Insert(0, root_child2_child0);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.Width = 50;
root_child3.Height = 20;
root.Insert(3, root_child3);

View File

@@ -20,11 +20,13 @@ namespace Facebook.Yoga
[Test]
public void Test_align_self_center()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.AlignSelf = YogaAlign.Center;
root_child0.Width = 10;
root_child0.Height = 10;
@@ -59,11 +61,13 @@ namespace Facebook.Yoga
[Test]
public void Test_align_self_flex_end()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.AlignSelf = YogaAlign.FlexEnd;
root_child0.Width = 10;
root_child0.Height = 10;
@@ -98,11 +102,13 @@ namespace Facebook.Yoga
[Test]
public void Test_align_self_flex_start()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.AlignSelf = YogaAlign.FlexStart;
root_child0.Width = 10;
root_child0.Height = 10;
@@ -137,12 +143,14 @@ namespace Facebook.Yoga
[Test]
public void Test_align_self_flex_end_override_flex_start()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.AlignItems = YogaAlign.FlexStart;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.AlignSelf = YogaAlign.FlexEnd;
root_child0.Width = 10;
root_child0.Height = 10;
@@ -177,24 +185,26 @@ namespace Facebook.Yoga
[Test]
public void Test_align_self_baseline()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.AlignSelf = YogaAlign.Baseline;
root_child0.Width = 50;
root_child0.Height = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.AlignSelf = YogaAlign.Baseline;
root_child1.Width = 50;
root_child1.Height = 20;
root.Insert(1, root_child1);
YogaNode root_child1_child0 = new YogaNode();
YogaNode root_child1_child0 = new YogaNode(config);
root_child1_child0.Width = 50;
root_child1_child0.Height = 10;
root_child1.Insert(0, root_child1_child0);

View File

@@ -20,7 +20,9 @@ namespace Facebook.Yoga
[Test]
public void Test_border_no_size()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.BorderLeftWidth = 10;
root.BorderTopWidth = 10;
root.BorderRightWidth = 10;
@@ -45,13 +47,15 @@ namespace Facebook.Yoga
[Test]
public void Test_border_container_match_child()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.BorderLeftWidth = 10;
root.BorderTopWidth = 10;
root.BorderRightWidth = 10;
root.BorderBottomWidth = 10;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 10;
root_child0.Height = 10;
root.Insert(0, root_child0);
@@ -85,7 +89,9 @@ namespace Facebook.Yoga
[Test]
public void Test_border_flex_child()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.BorderLeftWidth = 10;
root.BorderTopWidth = 10;
root.BorderRightWidth = 10;
@@ -93,7 +99,7 @@ namespace Facebook.Yoga
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.Width = 10;
root.Insert(0, root_child0);
@@ -127,7 +133,9 @@ namespace Facebook.Yoga
[Test]
public void Test_border_stretch_child()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.BorderLeftWidth = 10;
root.BorderTopWidth = 10;
root.BorderRightWidth = 10;
@@ -135,7 +143,7 @@ namespace Facebook.Yoga
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Height = 10;
root.Insert(0, root_child0);
root.StyleDirection = YogaDirection.LTR;
@@ -168,7 +176,9 @@ namespace Facebook.Yoga
[Test]
public void Test_border_center_child()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.JustifyContent = YogaJustify.Center;
root.AlignItems = YogaAlign.Center;
root.BorderStartWidth = 10;
@@ -177,7 +187,7 @@ namespace Facebook.Yoga
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 10;
root_child0.Height = 10;
root.Insert(0, root_child0);

View File

@@ -20,9 +20,11 @@ namespace Facebook.Yoga
[Test]
public void Test_wrap_child()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root_child0 = new YogaNode();
YogaNode root = new YogaNode(config);
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 100;
root_child0.Height = 100;
root.Insert(0, root_child0);
@@ -56,12 +58,14 @@ namespace Facebook.Yoga
[Test]
public void Test_wrap_grandchild()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root_child0 = new YogaNode();
YogaNode root = new YogaNode(config);
YogaNode root_child0 = new YogaNode(config);
root.Insert(0, root_child0);
YogaNode root_child0_child0 = new YogaNode();
YogaNode root_child0_child0 = new YogaNode(config);
root_child0_child0.Width = 100;
root_child0_child0.Height = 100;
root_child0.Insert(0, root_child0_child0);

View File

@@ -20,16 +20,18 @@ namespace Facebook.Yoga
[Test]
public void Test_display_none()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 1;
root_child1.Display = YogaDisplay.None;
root.Insert(1, root_child1);
@@ -73,16 +75,18 @@ namespace Facebook.Yoga
[Test]
public void Test_display_none_fixed_size()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 20;
root_child1.Height = 20;
root_child1.Display = YogaDisplay.None;
@@ -127,12 +131,14 @@ namespace Facebook.Yoga
[Test]
public void Test_display_none_with_margin()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.MarginLeft = 10;
root_child0.MarginTop = 10;
root_child0.MarginRight = 10;
@@ -142,7 +148,7 @@ namespace Facebook.Yoga
root_child0.Display = YogaDisplay.None;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 1;
root.Insert(1, root_child1);
root.StyleDirection = YogaDirection.LTR;
@@ -185,25 +191,27 @@ namespace Facebook.Yoga
[Test]
public void Test_display_none_with_child()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.FlexShrink = 1;
root_child0.FlexBasis = 0.Percent();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 1;
root_child1.FlexShrink = 1;
root_child1.FlexBasis = 0.Percent();
root_child1.Display = YogaDisplay.None;
root.Insert(1, root_child1);
YogaNode root_child1_child0 = new YogaNode();
YogaNode root_child1_child0 = new YogaNode(config);
root_child1_child0.FlexGrow = 1;
root_child1_child0.FlexShrink = 1;
root_child1_child0.FlexBasis = 0.Percent();
@@ -212,7 +220,7 @@ namespace Facebook.Yoga
root_child1_child0.MinHeight = 0;
root_child1.Insert(0, root_child1_child0);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.FlexGrow = 1;
root_child2.FlexShrink = 1;
root_child2.FlexBasis = 0.Percent();
@@ -277,16 +285,18 @@ namespace Facebook.Yoga
[Test]
public void Test_display_none_with_position()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 1;
root_child1.Top = 10;
root_child1.Display = YogaDisplay.None;

View File

@@ -20,18 +20,20 @@ namespace Facebook.Yoga
[Test]
public void Test_flex_direction_column_no_height()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Height = 10;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Height = 10;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Height = 10;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -84,19 +86,21 @@ namespace Facebook.Yoga
[Test]
public void Test_flex_direction_row_no_width()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 10;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 10;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 10;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -149,19 +153,21 @@ namespace Facebook.Yoga
[Test]
public void Test_flex_direction_column()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Height = 10;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Height = 10;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Height = 10;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -214,20 +220,22 @@ namespace Facebook.Yoga
[Test]
public void Test_flex_direction_row()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 10;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 10;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 10;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -280,20 +288,22 @@ namespace Facebook.Yoga
[Test]
public void Test_flex_direction_column_reverse()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.ColumnReverse;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Height = 10;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Height = 10;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Height = 10;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -346,20 +356,22 @@ namespace Facebook.Yoga
[Test]
public void Test_flex_direction_row_reverse()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.RowReverse;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 10;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 10;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 10;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;

View File

@@ -20,16 +20,18 @@ namespace Facebook.Yoga
[Test]
public void Test_flex_basis_flex_grow_column()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.FlexBasis = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 1;
root.Insert(1, root_child1);
root.StyleDirection = YogaDirection.LTR;
@@ -72,17 +74,19 @@ namespace Facebook.Yoga
[Test]
public void Test_flex_basis_flex_grow_row()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.FlexBasis = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 1;
root.Insert(1, root_child1);
root.StyleDirection = YogaDirection.LTR;
@@ -125,16 +129,18 @@ namespace Facebook.Yoga
[Test]
public void Test_flex_basis_flex_shrink_column()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexShrink = 1;
root_child0.FlexBasis = 100;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexBasis = 50;
root.Insert(1, root_child1);
root.StyleDirection = YogaDirection.LTR;
@@ -177,17 +183,19 @@ namespace Facebook.Yoga
[Test]
public void Test_flex_basis_flex_shrink_row()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexShrink = 1;
root_child0.FlexBasis = 100;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexBasis = 50;
root.Insert(1, root_child1);
root.StyleDirection = YogaDirection.LTR;
@@ -230,21 +238,23 @@ namespace Facebook.Yoga
[Test]
public void Test_flex_shrink_to_zero()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Height = 75;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root_child0.Height = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexShrink = 1;
root_child1.Width = 50;
root_child1.Height = 50;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 50;
root_child2.Height = 50;
root.Insert(2, root_child2);
@@ -298,22 +308,24 @@ namespace Facebook.Yoga
[Test]
public void Test_flex_basis_overrides_main_size()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.FlexBasis = 50;
root_child0.Height = 20;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 1;
root_child1.Height = 10;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.FlexGrow = 1;
root_child2.Height = 10;
root.Insert(2, root_child2);
@@ -367,14 +379,16 @@ namespace Facebook.Yoga
[Test]
public void Test_flex_grow_shrink_at_most()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root.Insert(0, root_child0);
YogaNode root_child0_child0 = new YogaNode();
YogaNode root_child0_child0 = new YogaNode(config);
root_child0_child0.FlexGrow = 1;
root_child0_child0.FlexShrink = 1;
root_child0.Insert(0, root_child0_child0);

View File

@@ -20,26 +20,28 @@ namespace Facebook.Yoga
[Test]
public void Test_wrap_column()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Wrap = YogaWrap.Wrap;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 30;
root_child0.Height = 30;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 30;
root_child1.Height = 30;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 30;
root_child2.Height = 30;
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.Width = 30;
root_child3.Height = 30;
root.Insert(3, root_child3);
@@ -103,27 +105,29 @@ namespace Facebook.Yoga
[Test]
public void Test_wrap_row()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Wrap = YogaWrap.Wrap;
root.Width = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 30;
root_child0.Height = 30;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 30;
root_child1.Height = 30;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 30;
root_child2.Height = 30;
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.Width = 30;
root_child3.Height = 30;
root.Insert(3, root_child3);
@@ -187,28 +191,30 @@ namespace Facebook.Yoga
[Test]
public void Test_wrap_row_align_items_flex_end()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignItems = YogaAlign.FlexEnd;
root.Wrap = YogaWrap.Wrap;
root.Width = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 30;
root_child0.Height = 10;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 30;
root_child1.Height = 20;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 30;
root_child2.Height = 30;
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.Width = 30;
root_child3.Height = 30;
root.Insert(3, root_child3);
@@ -272,28 +278,30 @@ namespace Facebook.Yoga
[Test]
public void Test_wrap_row_align_items_center()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignItems = YogaAlign.Center;
root.Wrap = YogaWrap.Wrap;
root.Width = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 30;
root_child0.Height = 10;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 30;
root_child1.Height = 20;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 30;
root_child2.Height = 30;
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.Width = 30;
root_child3.Height = 30;
root.Insert(3, root_child3);
@@ -357,18 +365,20 @@ namespace Facebook.Yoga
[Test]
public void Test_flex_wrap_children_with_min_main_overriding_flex_basis()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Wrap = YogaWrap.Wrap;
root.Width = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexBasis = 50;
root_child0.MinWidth = 55;
root_child0.Height = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexBasis = 50;
root_child1.MinWidth = 55;
root_child1.Height = 50;
@@ -413,24 +423,26 @@ namespace Facebook.Yoga
[Test]
public void Test_flex_wrap_wrap_to_child_height()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root_child0 = new YogaNode();
YogaNode root = new YogaNode(config);
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexDirection = YogaFlexDirection.Row;
root_child0.AlignItems = YogaAlign.FlexStart;
root_child0.Wrap = YogaWrap.Wrap;
root.Insert(0, root_child0);
YogaNode root_child0_child0 = new YogaNode();
YogaNode root_child0_child0 = new YogaNode(config);
root_child0_child0.Width = 100;
root_child0.Insert(0, root_child0_child0);
YogaNode root_child0_child0_child0 = new YogaNode();
YogaNode root_child0_child0_child0 = new YogaNode(config);
root_child0_child0_child0.Width = 100;
root_child0_child0_child0.Height = 100;
root_child0_child0.Insert(0, root_child0_child0_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 100;
root_child1.Height = 100;
root.Insert(1, root_child1);
@@ -494,17 +506,19 @@ namespace Facebook.Yoga
[Test]
public void Test_flex_wrap_align_stretch_fits_one_row()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Wrap = YogaWrap.Wrap;
root.Width = 150;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root.Insert(1, root_child1);
root.StyleDirection = YogaDirection.LTR;
@@ -547,32 +561,34 @@ namespace Facebook.Yoga
[Test]
public void Test_wrap_reverse_row_align_content_flex_start()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Wrap = YogaWrap.WrapReverse;
root.Width = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 30;
root_child0.Height = 10;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 30;
root_child1.Height = 20;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 30;
root_child2.Height = 30;
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.Width = 30;
root_child3.Height = 40;
root.Insert(3, root_child3);
YogaNode root_child4 = new YogaNode();
YogaNode root_child4 = new YogaNode(config);
root_child4.Width = 30;
root_child4.Height = 50;
root.Insert(4, root_child4);
@@ -646,33 +662,35 @@ namespace Facebook.Yoga
[Test]
public void Test_wrap_reverse_row_align_content_center()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignContent = YogaAlign.Center;
root.Wrap = YogaWrap.WrapReverse;
root.Width = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 30;
root_child0.Height = 10;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 30;
root_child1.Height = 20;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 30;
root_child2.Height = 30;
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.Width = 30;
root_child3.Height = 40;
root.Insert(3, root_child3);
YogaNode root_child4 = new YogaNode();
YogaNode root_child4 = new YogaNode(config);
root_child4.Width = 30;
root_child4.Height = 50;
root.Insert(4, root_child4);
@@ -746,32 +764,34 @@ namespace Facebook.Yoga
[Test]
public void Test_wrap_reverse_row_single_line_different_size()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Wrap = YogaWrap.WrapReverse;
root.Width = 300;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 30;
root_child0.Height = 10;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 30;
root_child1.Height = 20;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 30;
root_child2.Height = 30;
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.Width = 30;
root_child3.Height = 40;
root.Insert(3, root_child3);
YogaNode root_child4 = new YogaNode();
YogaNode root_child4 = new YogaNode(config);
root_child4.Width = 30;
root_child4.Height = 50;
root.Insert(4, root_child4);
@@ -845,33 +865,35 @@ namespace Facebook.Yoga
[Test]
public void Test_wrap_reverse_row_align_content_stretch()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignContent = YogaAlign.Stretch;
root.Wrap = YogaWrap.WrapReverse;
root.Width = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 30;
root_child0.Height = 10;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 30;
root_child1.Height = 20;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 30;
root_child2.Height = 30;
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.Width = 30;
root_child3.Height = 40;
root.Insert(3, root_child3);
YogaNode root_child4 = new YogaNode();
YogaNode root_child4 = new YogaNode(config);
root_child4.Width = 30;
root_child4.Height = 50;
root.Insert(4, root_child4);
@@ -945,33 +967,35 @@ namespace Facebook.Yoga
[Test]
public void Test_wrap_reverse_row_align_content_space_around()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignContent = YogaAlign.SpaceAround;
root.Wrap = YogaWrap.WrapReverse;
root.Width = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 30;
root_child0.Height = 10;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 30;
root_child1.Height = 20;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 30;
root_child2.Height = 30;
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.Width = 30;
root_child3.Height = 40;
root.Insert(3, root_child3);
YogaNode root_child4 = new YogaNode();
YogaNode root_child4 = new YogaNode(config);
root_child4.Width = 30;
root_child4.Height = 50;
root.Insert(4, root_child4);
@@ -1045,33 +1069,35 @@ namespace Facebook.Yoga
[Test]
public void Test_wrap_reverse_column_fixed_size()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.AlignItems = YogaAlign.Center;
root.Wrap = YogaWrap.WrapReverse;
root.Width = 200;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 30;
root_child0.Height = 10;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 30;
root_child1.Height = 20;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 30;
root_child2.Height = 30;
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.Width = 30;
root_child3.Height = 40;
root.Insert(3, root_child3);
YogaNode root_child4 = new YogaNode();
YogaNode root_child4 = new YogaNode(config);
root_child4.Width = 30;
root_child4.Height = 50;
root.Insert(4, root_child4);
@@ -1145,22 +1171,24 @@ namespace Facebook.Yoga
[Test]
public void Test_wrapped_row_within_align_items_center()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.AlignItems = YogaAlign.Center;
root.Width = 200;
root.Height = 200;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexDirection = YogaFlexDirection.Row;
root_child0.Wrap = YogaWrap.Wrap;
root.Insert(0, root_child0);
YogaNode root_child0_child0 = new YogaNode();
YogaNode root_child0_child0 = new YogaNode(config);
root_child0_child0.Width = 150;
root_child0_child0.Height = 80;
root_child0.Insert(0, root_child0_child0);
YogaNode root_child0_child1 = new YogaNode();
YogaNode root_child0_child1 = new YogaNode(config);
root_child0_child1.Width = 80;
root_child0_child1.Height = 80;
root_child0.Insert(1, root_child0_child1);
@@ -1214,22 +1242,24 @@ namespace Facebook.Yoga
[Test]
public void Test_wrapped_row_within_align_items_flex_start()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.AlignItems = YogaAlign.FlexStart;
root.Width = 200;
root.Height = 200;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexDirection = YogaFlexDirection.Row;
root_child0.Wrap = YogaWrap.Wrap;
root.Insert(0, root_child0);
YogaNode root_child0_child0 = new YogaNode();
YogaNode root_child0_child0 = new YogaNode(config);
root_child0_child0.Width = 150;
root_child0_child0.Height = 80;
root_child0.Insert(0, root_child0_child0);
YogaNode root_child0_child1 = new YogaNode();
YogaNode root_child0_child1 = new YogaNode(config);
root_child0_child1.Width = 80;
root_child0_child1.Height = 80;
root_child0.Insert(1, root_child0_child1);
@@ -1283,22 +1313,24 @@ namespace Facebook.Yoga
[Test]
public void Test_wrapped_row_within_align_items_flex_end()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.AlignItems = YogaAlign.FlexEnd;
root.Width = 200;
root.Height = 200;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexDirection = YogaFlexDirection.Row;
root_child0.Wrap = YogaWrap.Wrap;
root.Insert(0, root_child0);
YogaNode root_child0_child0 = new YogaNode();
YogaNode root_child0_child0 = new YogaNode(config);
root_child0_child0.Width = 150;
root_child0_child0.Height = 80;
root_child0.Insert(0, root_child0_child0);
YogaNode root_child0_child1 = new YogaNode();
YogaNode root_child0_child1 = new YogaNode(config);
root_child0_child1.Width = 80;
root_child0_child1.Height = 80;
root_child0.Insert(1, root_child0_child1);

View File

@@ -20,20 +20,22 @@ namespace Facebook.Yoga
[Test]
public void Test_justify_content_row_flex_start()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 102;
root.Height = 102;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 10;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 10;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 10;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -86,21 +88,23 @@ namespace Facebook.Yoga
[Test]
public void Test_justify_content_row_flex_end()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.JustifyContent = YogaJustify.FlexEnd;
root.Width = 102;
root.Height = 102;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 10;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 10;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 10;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -153,21 +157,23 @@ namespace Facebook.Yoga
[Test]
public void Test_justify_content_row_center()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.JustifyContent = YogaJustify.Center;
root.Width = 102;
root.Height = 102;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 10;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 10;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 10;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -220,21 +226,23 @@ namespace Facebook.Yoga
[Test]
public void Test_justify_content_row_space_between()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.JustifyContent = YogaJustify.SpaceBetween;
root.Width = 102;
root.Height = 102;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 10;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 10;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 10;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -287,21 +295,23 @@ namespace Facebook.Yoga
[Test]
public void Test_justify_content_row_space_around()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.JustifyContent = YogaJustify.SpaceAround;
root.Width = 102;
root.Height = 102;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 10;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 10;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 10;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -354,18 +364,20 @@ namespace Facebook.Yoga
[Test]
public void Test_justify_content_column_flex_start()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 102;
root.Height = 102;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Height = 10;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Height = 10;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -418,20 +430,22 @@ namespace Facebook.Yoga
[Test]
public void Test_justify_content_column_flex_end()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.JustifyContent = YogaJustify.FlexEnd;
root.Width = 102;
root.Height = 102;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Height = 10;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Height = 10;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Height = 10;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -484,20 +498,22 @@ namespace Facebook.Yoga
[Test]
public void Test_justify_content_column_center()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.JustifyContent = YogaJustify.Center;
root.Width = 102;
root.Height = 102;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Height = 10;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Height = 10;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Height = 10;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -550,20 +566,22 @@ namespace Facebook.Yoga
[Test]
public void Test_justify_content_column_space_between()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.JustifyContent = YogaJustify.SpaceBetween;
root.Width = 102;
root.Height = 102;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Height = 10;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Height = 10;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Height = 10;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -616,20 +634,22 @@ namespace Facebook.Yoga
[Test]
public void Test_justify_content_column_space_around()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.JustifyContent = YogaJustify.SpaceAround;
root.Width = 102;
root.Height = 102;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Height = 10;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Height = 10;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Height = 10;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;

View File

@@ -20,12 +20,14 @@ namespace Facebook.Yoga
[Test]
public void Test_margin_start()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.MarginStart = 10;
root_child0.Width = 10;
root.Insert(0, root_child0);
@@ -59,11 +61,13 @@ namespace Facebook.Yoga
[Test]
public void Test_margin_top()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.MarginTop = 10;
root_child0.Height = 10;
root.Insert(0, root_child0);
@@ -97,13 +101,15 @@ namespace Facebook.Yoga
[Test]
public void Test_margin_end()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.JustifyContent = YogaJustify.FlexEnd;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.MarginEnd = 10;
root_child0.Width = 10;
root.Insert(0, root_child0);
@@ -137,12 +143,14 @@ namespace Facebook.Yoga
[Test]
public void Test_margin_bottom()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.JustifyContent = YogaJustify.FlexEnd;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.MarginBottom = 10;
root_child0.Height = 10;
root.Insert(0, root_child0);
@@ -176,12 +184,14 @@ namespace Facebook.Yoga
[Test]
public void Test_margin_and_flex_row()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.MarginStart = 10;
root_child0.MarginEnd = 10;
@@ -216,11 +226,13 @@ namespace Facebook.Yoga
[Test]
public void Test_margin_and_flex_column()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.MarginTop = 10;
root_child0.MarginBottom = 10;
@@ -255,12 +267,14 @@ namespace Facebook.Yoga
[Test]
public void Test_margin_and_stretch_row()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.MarginTop = 10;
root_child0.MarginBottom = 10;
@@ -295,11 +309,13 @@ namespace Facebook.Yoga
[Test]
public void Test_margin_and_stretch_column()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.MarginStart = 10;
root_child0.MarginEnd = 10;
@@ -334,17 +350,19 @@ namespace Facebook.Yoga
[Test]
public void Test_margin_with_sibling_row()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.MarginEnd = 10;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 1;
root.Insert(1, root_child1);
root.StyleDirection = YogaDirection.LTR;
@@ -387,16 +405,18 @@ namespace Facebook.Yoga
[Test]
public void Test_margin_with_sibling_column()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.MarginBottom = 10;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 1;
root.Insert(1, root_child1);
root.StyleDirection = YogaDirection.LTR;
@@ -439,18 +459,20 @@ namespace Facebook.Yoga
[Test]
public void Test_margin_auto_bottom()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.AlignItems = YogaAlign.Center;
root.Width = 200;
root.Height = 200;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.MarginBottom = YogaValue.Auto();
root_child0.Width = 50;
root_child0.Height = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root_child1.Height = 50;
root.Insert(1, root_child1);
@@ -494,18 +516,20 @@ namespace Facebook.Yoga
[Test]
public void Test_margin_auto_top()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.AlignItems = YogaAlign.Center;
root.Width = 200;
root.Height = 200;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.MarginTop = YogaValue.Auto();
root_child0.Width = 50;
root_child0.Height = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root_child1.Height = 50;
root.Insert(1, root_child1);
@@ -549,19 +573,21 @@ namespace Facebook.Yoga
[Test]
public void Test_margin_auto_bottom_and_top()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.AlignItems = YogaAlign.Center;
root.Width = 200;
root.Height = 200;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.MarginTop = YogaValue.Auto();
root_child0.MarginBottom = YogaValue.Auto();
root_child0.Width = 50;
root_child0.Height = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root_child1.Height = 50;
root.Insert(1, root_child1);
@@ -605,19 +631,21 @@ namespace Facebook.Yoga
[Test]
public void Test_margin_auto_bottom_and_top_justify_center()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.JustifyContent = YogaJustify.Center;
root.Width = 200;
root.Height = 200;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.MarginTop = YogaValue.Auto();
root_child0.MarginBottom = YogaValue.Auto();
root_child0.Width = 50;
root_child0.Height = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root_child1.Height = 50;
root.Insert(1, root_child1);
@@ -661,24 +689,26 @@ namespace Facebook.Yoga
[Test]
public void Test_margin_auto_mutiple_children_column()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.AlignItems = YogaAlign.Center;
root.Width = 200;
root.Height = 200;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.MarginTop = YogaValue.Auto();
root_child0.Width = 50;
root_child0.Height = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.MarginTop = YogaValue.Auto();
root_child1.Width = 50;
root_child1.Height = 50;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 50;
root_child2.Height = 50;
root.Insert(2, root_child2);
@@ -732,25 +762,27 @@ namespace Facebook.Yoga
[Test]
public void Test_margin_auto_mutiple_children_row()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignItems = YogaAlign.Center;
root.Width = 200;
root.Height = 200;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.MarginRight = YogaValue.Auto();
root_child0.Width = 50;
root_child0.Height = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.MarginRight = YogaValue.Auto();
root_child1.Width = 50;
root_child1.Height = 50;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 50;
root_child2.Height = 50;
root.Insert(2, root_child2);
@@ -804,20 +836,22 @@ namespace Facebook.Yoga
[Test]
public void Test_margin_auto_left_and_right_column()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignItems = YogaAlign.Center;
root.Width = 200;
root.Height = 200;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.MarginLeft = YogaValue.Auto();
root_child0.MarginRight = YogaValue.Auto();
root_child0.Width = 50;
root_child0.Height = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root_child1.Height = 50;
root.Insert(1, root_child1);
@@ -861,18 +895,20 @@ namespace Facebook.Yoga
[Test]
public void Test_margin_auto_left_and_right()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 200;
root.Height = 200;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.MarginLeft = YogaValue.Auto();
root_child0.MarginRight = YogaValue.Auto();
root_child0.Width = 50;
root_child0.Height = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root_child1.Height = 50;
root.Insert(1, root_child1);
@@ -1028,19 +1064,21 @@ namespace Facebook.Yoga
[Test]
public void Test_margin_auto_left_and_right_column_and_center()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.AlignItems = YogaAlign.Center;
root.Width = 200;
root.Height = 200;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.MarginLeft = YogaValue.Auto();
root_child0.MarginRight = YogaValue.Auto();
root_child0.Width = 50;
root_child0.Height = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root_child1.Height = 50;
root.Insert(1, root_child1);
@@ -1084,18 +1122,20 @@ namespace Facebook.Yoga
[Test]
public void Test_margin_auto_left()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.AlignItems = YogaAlign.Center;
root.Width = 200;
root.Height = 200;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.MarginLeft = YogaValue.Auto();
root_child0.Width = 50;
root_child0.Height = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root_child1.Height = 50;
root.Insert(1, root_child1);
@@ -1139,18 +1179,20 @@ namespace Facebook.Yoga
[Test]
public void Test_margin_auto_right()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.AlignItems = YogaAlign.Center;
root.Width = 200;
root.Height = 200;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.MarginRight = YogaValue.Auto();
root_child0.Width = 50;
root_child0.Height = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root_child1.Height = 50;
root.Insert(1, root_child1);
@@ -1194,19 +1236,21 @@ namespace Facebook.Yoga
[Test]
public void Test_margin_auto_left_and_right_strech()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 200;
root.Height = 200;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.MarginLeft = YogaValue.Auto();
root_child0.MarginRight = YogaValue.Auto();
root_child0.Width = 50;
root_child0.Height = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root_child1.Height = 50;
root.Insert(1, root_child1);
@@ -1250,18 +1294,20 @@ namespace Facebook.Yoga
[Test]
public void Test_margin_auto_top_and_bottom_strech()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 200;
root.Height = 200;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.MarginTop = YogaValue.Auto();
root_child0.MarginBottom = YogaValue.Auto();
root_child0.Width = 50;
root_child0.Height = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root_child1.Height = 50;
root.Insert(1, root_child1);

View File

@@ -20,11 +20,13 @@ namespace Facebook.Yoga
[Test]
public void Test_max_width()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.MaxWidth = 50;
root_child0.Height = 10;
root.Insert(0, root_child0);
@@ -58,12 +60,14 @@ namespace Facebook.Yoga
[Test]
public void Test_max_height()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 10;
root_child0.MaxHeight = 50;
root.Insert(0, root_child0);
@@ -97,16 +101,18 @@ namespace Facebook.Yoga
[Test]
public void Test_min_height()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.MinHeight = 60;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 1;
root.Insert(1, root_child1);
root.StyleDirection = YogaDirection.LTR;
@@ -149,17 +155,19 @@ namespace Facebook.Yoga
[Test]
public void Test_min_width()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.MinWidth = 60;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 1;
root.Insert(1, root_child1);
root.StyleDirection = YogaDirection.LTR;
@@ -202,13 +210,15 @@ namespace Facebook.Yoga
[Test]
public void Test_justify_content_min_max()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.JustifyContent = YogaJustify.Center;
root.Width = 100;
root.MinHeight = 100;
root.MaxHeight = 200;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 60;
root_child0.Height = 60;
root.Insert(0, root_child0);
@@ -242,13 +252,15 @@ namespace Facebook.Yoga
[Test]
public void Test_align_items_min_max()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.AlignItems = YogaAlign.Center;
root.MinWidth = 100;
root.MaxWidth = 200;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 60;
root_child0.Height = 60;
root.Insert(0, root_child0);
@@ -282,22 +294,24 @@ namespace Facebook.Yoga
[Test]
public void Test_justify_content_overflow_min_max()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.JustifyContent = YogaJustify.Center;
root.MinHeight = 100;
root.MaxHeight = 110;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50;
root_child0.Height = 50;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root_child1.Height = 50;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 50;
root_child2.Height = 50;
root.Insert(2, root_child2);
@@ -351,19 +365,20 @@ namespace Facebook.Yoga
[Test]
public void Test_flex_grow_to_min()
{
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.MinFlexFix, true);
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.MinFlexFix, true);
YogaNode root = new YogaNode();
YogaNode root = new YogaNode(config);
root.Width = 100;
root.MinHeight = 100;
root.MaxHeight = 500;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.FlexShrink = 1;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Height = 50;
root.Insert(1, root_child1);
root.StyleDirection = YogaDirection.LTR;
@@ -401,26 +416,25 @@ namespace Facebook.Yoga
Assert.AreEqual(50f, root_child1.LayoutY);
Assert.AreEqual(100f, root_child1.LayoutWidth);
Assert.AreEqual(50f, root_child1.LayoutHeight);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.MinFlexFix, false);
}
[Test]
public void Test_flex_grow_in_at_most_container()
{
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.MinFlexFix, true);
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.MinFlexFix, true);
YogaNode root = new YogaNode();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.AlignItems = YogaAlign.FlexStart;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexDirection = YogaFlexDirection.Row;
root.Insert(0, root_child0);
YogaNode root_child0_child0 = new YogaNode();
YogaNode root_child0_child0 = new YogaNode(config);
root_child0_child0.FlexGrow = 1;
root_child0_child0.FlexBasis = 0;
root_child0.Insert(0, root_child0_child0);
@@ -459,23 +473,23 @@ namespace Facebook.Yoga
Assert.AreEqual(0f, root_child0_child0.LayoutY);
Assert.AreEqual(0f, root_child0_child0.LayoutWidth);
Assert.AreEqual(0f, root_child0_child0.LayoutHeight);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.MinFlexFix, false);
}
[Test]
public void Test_flex_grow_within_max_width()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 200;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexDirection = YogaFlexDirection.Row;
root_child0.MaxWidth = 100;
root.Insert(0, root_child0);
YogaNode root_child0_child0 = new YogaNode();
YogaNode root_child0_child0 = new YogaNode(config);
root_child0_child0.FlexGrow = 1;
root_child0_child0.Height = 20;
root_child0.Insert(0, root_child0_child0);
@@ -519,16 +533,18 @@ namespace Facebook.Yoga
[Test]
public void Test_flex_grow_within_constrained_max_width()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 200;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexDirection = YogaFlexDirection.Row;
root_child0.MaxWidth = 300;
root.Insert(0, root_child0);
YogaNode root_child0_child0 = new YogaNode();
YogaNode root_child0_child0 = new YogaNode(config);
root_child0_child0.FlexGrow = 1;
root_child0_child0.Height = 20;
root_child0.Insert(0, root_child0_child0);
@@ -572,16 +588,18 @@ namespace Facebook.Yoga
[Test]
public void Test_flex_grow_within_constrained_min_row()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.MinWidth = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Width = 50;
root.Insert(1, root_child1);
root.StyleDirection = YogaDirection.LTR;
@@ -624,14 +642,16 @@ namespace Facebook.Yoga
[Test]
public void Test_flex_grow_within_constrained_min_column()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.MinHeight = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Height = 50;
root.Insert(1, root_child1);
root.StyleDirection = YogaDirection.LTR;
@@ -674,21 +694,23 @@ namespace Facebook.Yoga
[Test]
public void Test_flex_grow_within_constrained_max_row()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 200;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexDirection = YogaFlexDirection.Row;
root_child0.MaxWidth = 100;
root_child0.Height = 100;
root.Insert(0, root_child0);
YogaNode root_child0_child0 = new YogaNode();
YogaNode root_child0_child0 = new YogaNode(config);
root_child0_child0.FlexShrink = 1;
root_child0_child0.FlexBasis = 100;
root_child0.Insert(0, root_child0_child0);
YogaNode root_child0_child1 = new YogaNode();
YogaNode root_child0_child1 = new YogaNode(config);
root_child0_child1.Width = 50;
root_child0.Insert(1, root_child0_child1);
root.StyleDirection = YogaDirection.LTR;
@@ -741,16 +763,18 @@ namespace Facebook.Yoga
[Test]
public void Test_flex_grow_within_constrained_max_column()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 100;
root.MaxHeight = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexShrink = 1;
root_child0.FlexBasis = 100;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.Height = 50;
root.Insert(1, root_child1);
root.StyleDirection = YogaDirection.LTR;
@@ -793,7 +817,9 @@ namespace Facebook.Yoga
[Test]
public void Test_min_width_overrides_width()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 50;
root.MinWidth = 100;
root.StyleDirection = YogaDirection.LTR;
@@ -816,7 +842,9 @@ namespace Facebook.Yoga
[Test]
public void Test_max_width_overrides_width()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 200;
root.MaxWidth = 100;
root.StyleDirection = YogaDirection.LTR;
@@ -839,7 +867,9 @@ namespace Facebook.Yoga
[Test]
public void Test_min_height_overrides_height()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Height = 50;
root.MinHeight = 100;
root.StyleDirection = YogaDirection.LTR;
@@ -862,7 +892,9 @@ namespace Facebook.Yoga
[Test]
public void Test_max_height_overrides_height()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Height = 200;
root.MaxHeight = 100;
root.StyleDirection = YogaDirection.LTR;
@@ -885,12 +917,14 @@ namespace Facebook.Yoga
[Test]
public void Test_min_max_percent_no_width_height()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.AlignItems = YogaAlign.FlexStart;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.MinWidth = 10.Percent();
root_child0.MaxWidth = 10.Percent();
root_child0.MinHeight = 10.Percent();

View File

@@ -20,7 +20,9 @@ namespace Facebook.Yoga
[Test]
public void Test_padding_no_size()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.PaddingLeft = 10;
root.PaddingTop = 10;
root.PaddingRight = 10;
@@ -45,13 +47,15 @@ namespace Facebook.Yoga
[Test]
public void Test_padding_container_match_child()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.PaddingLeft = 10;
root.PaddingTop = 10;
root.PaddingRight = 10;
root.PaddingBottom = 10;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 10;
root_child0.Height = 10;
root.Insert(0, root_child0);
@@ -85,7 +89,9 @@ namespace Facebook.Yoga
[Test]
public void Test_padding_flex_child()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.PaddingLeft = 10;
root.PaddingTop = 10;
root.PaddingRight = 10;
@@ -93,7 +99,7 @@ namespace Facebook.Yoga
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.Width = 10;
root.Insert(0, root_child0);
@@ -127,7 +133,9 @@ namespace Facebook.Yoga
[Test]
public void Test_padding_stretch_child()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.PaddingLeft = 10;
root.PaddingTop = 10;
root.PaddingRight = 10;
@@ -135,7 +143,7 @@ namespace Facebook.Yoga
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Height = 10;
root.Insert(0, root_child0);
root.StyleDirection = YogaDirection.LTR;
@@ -168,7 +176,9 @@ namespace Facebook.Yoga
[Test]
public void Test_padding_center_child()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.JustifyContent = YogaJustify.Center;
root.AlignItems = YogaAlign.Center;
root.PaddingStart = 10;
@@ -177,7 +187,7 @@ namespace Facebook.Yoga
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 10;
root_child0.Height = 10;
root.Insert(0, root_child0);
@@ -211,13 +221,15 @@ namespace Facebook.Yoga
[Test]
public void Test_child_with_padding_align_end()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.JustifyContent = YogaJustify.FlexEnd;
root.AlignItems = YogaAlign.FlexEnd;
root.Width = 200;
root.Height = 200;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.PaddingLeft = 20;
root_child0.PaddingTop = 20;
root_child0.PaddingRight = 20;

View File

@@ -20,14 +20,15 @@ namespace Facebook.Yoga
[Test]
public void Test_percentage_width_height()
{
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 200;
root.Height = 200;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 30.Percent();
root_child0.Height = 30.Percent();
root.Insert(0, root_child0);
@@ -56,21 +57,20 @@ namespace Facebook.Yoga
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(60f, root_child0.LayoutWidth);
Assert.AreEqual(60f, root_child0.LayoutHeight);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_percentage_position_left_top()
{
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 400;
root.Height = 400;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Left = 10.Percent();
root_child0.Top = 20.Percent();
root_child0.Width = 45.Percent();
@@ -101,21 +101,20 @@ namespace Facebook.Yoga
Assert.AreEqual(80f, root_child0.LayoutY);
Assert.AreEqual(180f, root_child0.LayoutWidth);
Assert.AreEqual(220f, root_child0.LayoutHeight);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_percentage_position_bottom_right()
{
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 500;
root.Height = 500;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Right = 20.Percent();
root_child0.Bottom = 10.Percent();
root_child0.Width = 55.Percent();
@@ -146,26 +145,25 @@ namespace Facebook.Yoga
Assert.AreEqual(-50f, root_child0.LayoutY);
Assert.AreEqual(275f, root_child0.LayoutWidth);
Assert.AreEqual(75f, root_child0.LayoutHeight);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_percentage_flex_basis()
{
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 200;
root.Height = 200;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.FlexBasis = 50.Percent();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 1;
root_child1.FlexBasis = 25.Percent();
root.Insert(1, root_child1);
@@ -204,25 +202,24 @@ namespace Facebook.Yoga
Assert.AreEqual(0f, root_child1.LayoutY);
Assert.AreEqual(75f, root_child1.LayoutWidth);
Assert.AreEqual(200f, root_child1.LayoutHeight);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_percentage_flex_basis_cross()
{
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
YogaNode root = new YogaNode(config);
root.Width = 200;
root.Height = 200;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.FlexBasis = 50.Percent();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 1;
root_child1.FlexBasis = 25.Percent();
root.Insert(1, root_child1);
@@ -261,25 +258,24 @@ namespace Facebook.Yoga
Assert.AreEqual(125f, root_child1.LayoutY);
Assert.AreEqual(200f, root_child1.LayoutWidth);
Assert.AreEqual(75f, root_child1.LayoutHeight);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_percentage_flex_basis_cross_min_height()
{
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
YogaNode root = new YogaNode(config);
root.Width = 200;
root.Height = 200;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.MinHeight = 60.Percent();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 2;
root_child1.MinHeight = 10.Percent();
root.Insert(1, root_child1);
@@ -318,27 +314,26 @@ namespace Facebook.Yoga
Assert.AreEqual(140f, root_child1.LayoutY);
Assert.AreEqual(200f, root_child1.LayoutWidth);
Assert.AreEqual(60f, root_child1.LayoutHeight);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_percentage_flex_basis_main_max_height()
{
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 200;
root.Height = 200;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.FlexBasis = 10.Percent();
root_child0.MaxHeight = 60.Percent();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 4;
root_child1.FlexBasis = 10.Percent();
root_child1.MaxHeight = 20.Percent();
@@ -378,26 +373,25 @@ namespace Facebook.Yoga
Assert.AreEqual(0f, root_child1.LayoutY);
Assert.AreEqual(148f, root_child1.LayoutWidth);
Assert.AreEqual(40f, root_child1.LayoutHeight);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_percentage_flex_basis_cross_max_height()
{
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
YogaNode root = new YogaNode(config);
root.Width = 200;
root.Height = 200;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.FlexBasis = 10.Percent();
root_child0.MaxHeight = 60.Percent();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 4;
root_child1.FlexBasis = 10.Percent();
root_child1.MaxHeight = 20.Percent();
@@ -437,27 +431,26 @@ namespace Facebook.Yoga
Assert.AreEqual(120f, root_child1.LayoutY);
Assert.AreEqual(200f, root_child1.LayoutWidth);
Assert.AreEqual(40f, root_child1.LayoutHeight);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_percentage_flex_basis_main_max_width()
{
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 200;
root.Height = 200;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.FlexBasis = 15.Percent();
root_child0.MaxWidth = 60.Percent();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 4;
root_child1.FlexBasis = 10.Percent();
root_child1.MaxWidth = 20.Percent();
@@ -497,26 +490,25 @@ namespace Facebook.Yoga
Assert.AreEqual(0f, root_child1.LayoutY);
Assert.AreEqual(40f, root_child1.LayoutWidth);
Assert.AreEqual(200f, root_child1.LayoutHeight);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_percentage_flex_basis_cross_max_width()
{
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
YogaNode root = new YogaNode(config);
root.Width = 200;
root.Height = 200;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.FlexBasis = 10.Percent();
root_child0.MaxWidth = 60.Percent();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 4;
root_child1.FlexBasis = 15.Percent();
root_child1.MaxWidth = 20.Percent();
@@ -556,27 +548,26 @@ namespace Facebook.Yoga
Assert.AreEqual(50f, root_child1.LayoutY);
Assert.AreEqual(40f, root_child1.LayoutWidth);
Assert.AreEqual(150f, root_child1.LayoutHeight);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_percentage_flex_basis_main_min_width()
{
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 200;
root.Height = 200;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.FlexBasis = 15.Percent();
root_child0.MinWidth = 60.Percent();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 4;
root_child1.FlexBasis = 10.Percent();
root_child1.MinWidth = 20.Percent();
@@ -616,26 +607,25 @@ namespace Facebook.Yoga
Assert.AreEqual(0f, root_child1.LayoutY);
Assert.AreEqual(80f, root_child1.LayoutWidth);
Assert.AreEqual(200f, root_child1.LayoutHeight);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_percentage_flex_basis_cross_min_width()
{
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
YogaNode root = new YogaNode(config);
root.Width = 200;
root.Height = 200;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.FlexBasis = 10.Percent();
root_child0.MinWidth = 60.Percent();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 4;
root_child1.FlexBasis = 15.Percent();
root_child1.MinWidth = 20.Percent();
@@ -675,20 +665,19 @@ namespace Facebook.Yoga
Assert.AreEqual(50f, root_child1.LayoutY);
Assert.AreEqual(200f, root_child1.LayoutWidth);
Assert.AreEqual(150f, root_child1.LayoutHeight);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_percentage_multiple_nested_with_padding_margin_and_percentage_values()
{
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
YogaNode root = new YogaNode(config);
root.Width = 200;
root.Height = 200;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.FlexBasis = 10.Percent();
root_child0.MarginLeft = 5;
@@ -702,7 +691,7 @@ namespace Facebook.Yoga
root_child0.MinWidth = 60.Percent();
root.Insert(0, root_child0);
YogaNode root_child0_child0 = new YogaNode();
YogaNode root_child0_child0 = new YogaNode(config);
root_child0_child0.MarginLeft = 5;
root_child0_child0.MarginTop = 5;
root_child0_child0.MarginRight = 5;
@@ -714,7 +703,7 @@ namespace Facebook.Yoga
root_child0_child0.Width = 50.Percent();
root_child0.Insert(0, root_child0_child0);
YogaNode root_child0_child0_child0 = new YogaNode();
YogaNode root_child0_child0_child0 = new YogaNode(config);
root_child0_child0_child0.MarginLeft = 5.Percent();
root_child0_child0_child0.MarginTop = 5.Percent();
root_child0_child0_child0.MarginRight = 5.Percent();
@@ -726,7 +715,7 @@ namespace Facebook.Yoga
root_child0_child0_child0.Width = 45.Percent();
root_child0_child0.Insert(0, root_child0_child0_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 4;
root_child1.FlexBasis = 15.Percent();
root_child1.MinWidth = 20.Percent();
@@ -786,20 +775,19 @@ namespace Facebook.Yoga
Assert.AreEqual(58f, root_child1.LayoutY);
Assert.AreEqual(200f, root_child1.LayoutWidth);
Assert.AreEqual(142f, root_child1.LayoutHeight);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_percentage_margin_should_calculate_based_only_on_width()
{
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
YogaNode root = new YogaNode(config);
root.Width = 200;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.MarginLeft = 10.Percent();
root_child0.MarginTop = 10.Percent();
@@ -807,7 +795,7 @@ namespace Facebook.Yoga
root_child0.MarginBottom = 10.Percent();
root.Insert(0, root_child0);
YogaNode root_child0_child0 = new YogaNode();
YogaNode root_child0_child0 = new YogaNode(config);
root_child0_child0.Width = 10;
root_child0_child0.Height = 10;
root_child0.Insert(0, root_child0_child0);
@@ -846,20 +834,19 @@ namespace Facebook.Yoga
Assert.AreEqual(0f, root_child0_child0.LayoutY);
Assert.AreEqual(10f, root_child0_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0_child0.LayoutHeight);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_percentage_padding_should_calculate_based_only_on_width()
{
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
YogaNode root = new YogaNode(config);
root.Width = 200;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.PaddingLeft = 10.Percent();
root_child0.PaddingTop = 10.Percent();
@@ -867,7 +854,7 @@ namespace Facebook.Yoga
root_child0.PaddingBottom = 10.Percent();
root.Insert(0, root_child0);
YogaNode root_child0_child0 = new YogaNode();
YogaNode root_child0_child0 = new YogaNode(config);
root_child0_child0.Width = 10;
root_child0_child0.Height = 10;
root_child0.Insert(0, root_child0_child0);
@@ -906,20 +893,19 @@ namespace Facebook.Yoga
Assert.AreEqual(20f, root_child0_child0.LayoutY);
Assert.AreEqual(10f, root_child0_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0_child0.LayoutHeight);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_percentage_absolute_position()
{
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
YogaNode root = new YogaNode(config);
root.Width = 200;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.PositionType = YogaPositionType.Absolute;
root_child0.Left = 30.Percent();
root_child0.Top = 10.Percent();
@@ -951,16 +937,16 @@ namespace Facebook.Yoga
Assert.AreEqual(10f, root_child0.LayoutY);
Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_percentage_width_height_undefined_parent_size()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root_child0 = new YogaNode();
YogaNode root = new YogaNode(config);
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 50.Percent();
root_child0.Height = 50.Percent();
root.Insert(0, root_child0);
@@ -994,24 +980,26 @@ namespace Facebook.Yoga
[Test]
public void Test_percent_within_flex_grow()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 350;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 100;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 1;
root.Insert(1, root_child1);
YogaNode root_child1_child0 = new YogaNode();
YogaNode root_child1_child0 = new YogaNode(config);
root_child1_child0.Width = 100.Percent();
root_child1.Insert(0, root_child1_child0);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.Width = 100;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;

View File

@@ -20,22 +20,23 @@ namespace Facebook.Yoga
[Test]
public void Test_rounding_flex_basis_flex_grow_row_width_of_100()
{
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 1;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.FlexGrow = 1;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -83,37 +84,36 @@ namespace Facebook.Yoga
Assert.AreEqual(0f, root_child2.LayoutY);
Assert.AreEqual(33f, root_child2.LayoutWidth);
Assert.AreEqual(100f, root_child2.LayoutHeight);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_rounding_flex_basis_flex_grow_row_prime_number_width()
{
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 113;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 1;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.FlexGrow = 1;
root.Insert(2, root_child2);
YogaNode root_child3 = new YogaNode();
YogaNode root_child3 = new YogaNode(config);
root_child3.FlexGrow = 1;
root.Insert(3, root_child3);
YogaNode root_child4 = new YogaNode();
YogaNode root_child4 = new YogaNode(config);
root_child4.FlexGrow = 1;
root.Insert(4, root_child4);
root.StyleDirection = YogaDirection.LTR;
@@ -181,30 +181,29 @@ namespace Facebook.Yoga
Assert.AreEqual(0f, root_child4.LayoutY);
Assert.AreEqual(23f, root_child4.LayoutWidth);
Assert.AreEqual(100f, root_child4.LayoutHeight);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_rounding_flex_basis_flex_shrink_row()
{
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
root.Width = 101;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexShrink = 1;
root_child0.FlexBasis = 100;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexBasis = 25;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.FlexBasis = 25;
root.Insert(2, root_child2);
root.StyleDirection = YogaDirection.LTR;
@@ -252,31 +251,30 @@ namespace Facebook.Yoga
Assert.AreEqual(0f, root_child2.LayoutY);
Assert.AreEqual(25f, root_child2.LayoutWidth);
Assert.AreEqual(100f, root_child2.LayoutHeight);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_rounding_flex_basis_overrides_main_size()
{
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
YogaNode root = new YogaNode(config);
root.Width = 100;
root.Height = 113;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.FlexBasis = 50;
root_child0.Height = 20;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 1;
root_child1.Height = 10;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.FlexGrow = 1;
root_child2.Height = 10;
root.Insert(2, root_child2);
@@ -325,31 +323,30 @@ namespace Facebook.Yoga
Assert.AreEqual(89f, root_child2.LayoutY);
Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_rounding_total_fractial()
{
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
YogaNode root = new YogaNode(config);
root.Width = 87.4f;
root.Height = 113.4f;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 0.7f;
root_child0.FlexBasis = 50.3f;
root_child0.Height = 20.3f;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 1.6f;
root_child1.Height = 10;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.FlexGrow = 1.1f;
root_child2.Height = 10.7f;
root.Insert(2, root_child2);
@@ -398,45 +395,44 @@ namespace Facebook.Yoga
Assert.AreEqual(89f, root_child2.LayoutY);
Assert.AreEqual(87f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_rounding_total_fractial_nested()
{
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
YogaNode root = new YogaNode(config);
root.Width = 87.4f;
root.Height = 113.4f;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 0.7f;
root_child0.FlexBasis = 50.3f;
root_child0.Height = 20.3f;
root.Insert(0, root_child0);
YogaNode root_child0_child0 = new YogaNode();
YogaNode root_child0_child0 = new YogaNode(config);
root_child0_child0.FlexGrow = 1;
root_child0_child0.FlexBasis = 0.3f;
root_child0_child0.Bottom = 13.3f;
root_child0_child0.Height = 9.9f;
root_child0.Insert(0, root_child0_child0);
YogaNode root_child0_child1 = new YogaNode();
YogaNode root_child0_child1 = new YogaNode(config);
root_child0_child1.FlexGrow = 4;
root_child0_child1.FlexBasis = 0.3f;
root_child0_child1.Top = 13.3f;
root_child0_child1.Height = 1.1f;
root_child0.Insert(1, root_child0_child1);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 1.6f;
root_child1.Height = 10;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.FlexGrow = 1.1f;
root_child2.Height = 10.7f;
root.Insert(2, root_child2);
@@ -505,31 +501,30 @@ namespace Facebook.Yoga
Assert.AreEqual(89f, root_child2.LayoutY);
Assert.AreEqual(87f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_rounding_fractial_input_1()
{
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
YogaNode root = new YogaNode(config);
root.Width = 100;
root.Height = 113.4f;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.FlexBasis = 50;
root_child0.Height = 20;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 1;
root_child1.Height = 10;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.FlexGrow = 1;
root_child2.Height = 10;
root.Insert(2, root_child2);
@@ -578,31 +573,30 @@ namespace Facebook.Yoga
Assert.AreEqual(89f, root_child2.LayoutY);
Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_rounding_fractial_input_2()
{
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
YogaNode root = new YogaNode(config);
root.Width = 100;
root.Height = 113.6f;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.FlexBasis = 50;
root_child0.Height = 20;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 1;
root_child1.Height = 10;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.FlexGrow = 1;
root_child2.Height = 10;
root.Insert(2, root_child2);
@@ -651,32 +645,31 @@ namespace Facebook.Yoga
Assert.AreEqual(89f, root_child2.LayoutY);
Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(25f, root_child2.LayoutHeight);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_rounding_fractial_input_3()
{
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
YogaNode root = new YogaNode(config);
root.Top = 0.3f;
root.Width = 100;
root.Height = 113.4f;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.FlexBasis = 50;
root_child0.Height = 20;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 1;
root_child1.Height = 10;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.FlexGrow = 1;
root_child2.Height = 10;
root.Insert(2, root_child2);
@@ -725,32 +718,31 @@ namespace Facebook.Yoga
Assert.AreEqual(89f, root_child2.LayoutY);
Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
[Test]
public void Test_rounding_fractial_input_4()
{
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
YogaNode root = new YogaNode();
YogaNode root = new YogaNode(config);
root.Top = 0.7f;
root.Width = 100;
root.Height = 113.4f;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.FlexGrow = 1;
root_child0.FlexBasis = 50;
root_child0.Height = 20;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
YogaNode root_child1 = new YogaNode(config);
root_child1.FlexGrow = 1;
root_child1.Height = 10;
root.Insert(1, root_child1);
YogaNode root_child2 = new YogaNode();
YogaNode root_child2 = new YogaNode(config);
root_child2.FlexGrow = 1;
root_child2.Height = 10;
root.Insert(2, root_child2);
@@ -799,8 +791,6 @@ namespace Facebook.Yoga
Assert.AreEqual(89f, root_child2.LayoutY);
Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight);
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
}
}

View File

@@ -20,14 +20,16 @@ namespace Facebook.Yoga
[Test]
public void Test_nested_overflowing_child()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root.Insert(0, root_child0);
YogaNode root_child0_child0 = new YogaNode();
YogaNode root_child0_child0 = new YogaNode(config);
root_child0_child0.Width = 200;
root_child0_child0.Height = 200;
root_child0.Insert(0, root_child0_child0);
@@ -71,16 +73,18 @@ namespace Facebook.Yoga
[Test]
public void Test_nested_overflowing_child_in_constraint_parent()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 100;
root_child0.Height = 100;
root.Insert(0, root_child0);
YogaNode root_child0_child0 = new YogaNode();
YogaNode root_child0_child0 = new YogaNode(config);
root_child0_child0.Width = 200;
root_child0_child0.Height = 200;
root_child0.Insert(0, root_child0_child0);
@@ -124,15 +128,17 @@ namespace Facebook.Yoga
[Test]
public void Test_parent_wrap_child_size_overflowing_parent()
{
YogaNode root = new YogaNode();
YogaConfig config = new YogaConfig();
YogaNode root = new YogaNode(config);
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
YogaNode root_child0 = new YogaNode(config);
root_child0.Width = 100;
root.Insert(0, root_child0);
YogaNode root_child0_child0 = new YogaNode();
YogaNode root_child0_child0 = new YogaNode(config);
root_child0_child0.Width = 100;
root_child0_child0.Height = 200;
root_child0.Insert(0, root_child0_child0);