Add support for space-between and space-around on align-content
Summary: Adds the two missing alignments ```space-between``` and ```space-around``` for ```align-content``` . Those values are a noop on ```align-items``` in order to prevent a breaking changes for an additional enum. Fix #229 Closes https://github.com/facebook/yoga/pull/364 Reviewed By: gkassabli Differential Revision: D4528561 Pulled By: emilsjolander fbshipit-source-id: ea6291b6dd22cef05d9eec03893250d50371236e
This commit is contained in:
committed by
Facebook Github Bot
parent
247aa26d3e
commit
6a7ad2125d
@@ -17,5 +17,7 @@ namespace Facebook.Yoga
|
||||
FlexEnd,
|
||||
Stretch,
|
||||
Baseline,
|
||||
SpaceBetween,
|
||||
SpaceAround,
|
||||
}
|
||||
}
|
||||
|
@@ -21,8 +21,9 @@ namespace Facebook.Yoga
|
||||
public void Test_align_content_flex_start()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.Wrap = YogaWrap.Wrap;
|
||||
root.Width = 100;
|
||||
root.Width = 130;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
@@ -54,7 +55,7 @@ namespace Facebook.Yoga
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(100f, root.LayoutWidth);
|
||||
Assert.AreEqual(130f, root.LayoutWidth);
|
||||
Assert.AreEqual(100f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
@@ -62,23 +63,23 @@ namespace Facebook.Yoga
|
||||
Assert.AreEqual(50f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||
Assert.AreEqual(10f, root_child1.LayoutY);
|
||||
Assert.AreEqual(50f, root_child1.LayoutX);
|
||||
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||
Assert.AreEqual(50f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child1.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child2.LayoutX);
|
||||
Assert.AreEqual(20f, root_child2.LayoutY);
|
||||
Assert.AreEqual(10f, root_child2.LayoutY);
|
||||
Assert.AreEqual(50f, root_child2.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child2.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child3.LayoutX);
|
||||
Assert.AreEqual(30f, root_child3.LayoutY);
|
||||
Assert.AreEqual(50f, root_child3.LayoutX);
|
||||
Assert.AreEqual(10f, root_child3.LayoutY);
|
||||
Assert.AreEqual(50f, root_child3.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child3.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child4.LayoutX);
|
||||
Assert.AreEqual(40f, root_child4.LayoutY);
|
||||
Assert.AreEqual(20f, root_child4.LayoutY);
|
||||
Assert.AreEqual(50f, root_child4.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child4.LayoutHeight);
|
||||
|
||||
@@ -87,31 +88,31 @@ namespace Facebook.Yoga
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(100f, root.LayoutWidth);
|
||||
Assert.AreEqual(130f, root.LayoutWidth);
|
||||
Assert.AreEqual(100f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(50f, root_child0.LayoutX);
|
||||
Assert.AreEqual(80f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(50f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(50f, root_child1.LayoutX);
|
||||
Assert.AreEqual(10f, root_child1.LayoutY);
|
||||
Assert.AreEqual(30f, root_child1.LayoutX);
|
||||
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||
Assert.AreEqual(50f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child1.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(50f, root_child2.LayoutX);
|
||||
Assert.AreEqual(20f, root_child2.LayoutY);
|
||||
Assert.AreEqual(80f, root_child2.LayoutX);
|
||||
Assert.AreEqual(10f, root_child2.LayoutY);
|
||||
Assert.AreEqual(50f, root_child2.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child2.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(50f, root_child3.LayoutX);
|
||||
Assert.AreEqual(30f, root_child3.LayoutY);
|
||||
Assert.AreEqual(30f, root_child3.LayoutX);
|
||||
Assert.AreEqual(10f, root_child3.LayoutY);
|
||||
Assert.AreEqual(50f, root_child3.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child3.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(50f, root_child4.LayoutX);
|
||||
Assert.AreEqual(40f, root_child4.LayoutY);
|
||||
Assert.AreEqual(80f, root_child4.LayoutX);
|
||||
Assert.AreEqual(20f, root_child4.LayoutY);
|
||||
Assert.AreEqual(50f, root_child4.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child4.LayoutHeight);
|
||||
}
|
||||
@@ -120,9 +121,10 @@ namespace Facebook.Yoga
|
||||
public void Test_align_content_flex_end()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.AlignContent = YogaAlign.FlexEnd;
|
||||
root.Wrap = YogaWrap.Wrap;
|
||||
root.Width = 100;
|
||||
root.Width = 130;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
@@ -154,31 +156,31 @@ namespace Facebook.Yoga
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(100f, root.LayoutWidth);
|
||||
Assert.AreEqual(130f, root.LayoutWidth);
|
||||
Assert.AreEqual(100f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(70f, root_child0.LayoutY);
|
||||
Assert.AreEqual(50f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||
Assert.AreEqual(10f, root_child1.LayoutY);
|
||||
Assert.AreEqual(50f, root_child1.LayoutX);
|
||||
Assert.AreEqual(70f, root_child1.LayoutY);
|
||||
Assert.AreEqual(50f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child1.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child2.LayoutX);
|
||||
Assert.AreEqual(20f, root_child2.LayoutY);
|
||||
Assert.AreEqual(80f, root_child2.LayoutY);
|
||||
Assert.AreEqual(50f, root_child2.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child2.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child3.LayoutX);
|
||||
Assert.AreEqual(30f, root_child3.LayoutY);
|
||||
Assert.AreEqual(50f, root_child3.LayoutX);
|
||||
Assert.AreEqual(80f, root_child3.LayoutY);
|
||||
Assert.AreEqual(50f, root_child3.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child3.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child4.LayoutX);
|
||||
Assert.AreEqual(40f, root_child4.LayoutY);
|
||||
Assert.AreEqual(90f, root_child4.LayoutY);
|
||||
Assert.AreEqual(50f, root_child4.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child4.LayoutHeight);
|
||||
|
||||
@@ -187,31 +189,31 @@ namespace Facebook.Yoga
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(100f, root.LayoutWidth);
|
||||
Assert.AreEqual(130f, root.LayoutWidth);
|
||||
Assert.AreEqual(100f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(50f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(80f, root_child0.LayoutX);
|
||||
Assert.AreEqual(70f, root_child0.LayoutY);
|
||||
Assert.AreEqual(50f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(50f, root_child1.LayoutX);
|
||||
Assert.AreEqual(10f, root_child1.LayoutY);
|
||||
Assert.AreEqual(30f, root_child1.LayoutX);
|
||||
Assert.AreEqual(70f, root_child1.LayoutY);
|
||||
Assert.AreEqual(50f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child1.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(50f, root_child2.LayoutX);
|
||||
Assert.AreEqual(20f, root_child2.LayoutY);
|
||||
Assert.AreEqual(80f, root_child2.LayoutX);
|
||||
Assert.AreEqual(80f, root_child2.LayoutY);
|
||||
Assert.AreEqual(50f, root_child2.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child2.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(50f, root_child3.LayoutX);
|
||||
Assert.AreEqual(30f, root_child3.LayoutY);
|
||||
Assert.AreEqual(30f, root_child3.LayoutX);
|
||||
Assert.AreEqual(80f, root_child3.LayoutY);
|
||||
Assert.AreEqual(50f, root_child3.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child3.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(50f, root_child4.LayoutX);
|
||||
Assert.AreEqual(40f, root_child4.LayoutY);
|
||||
Assert.AreEqual(80f, root_child4.LayoutX);
|
||||
Assert.AreEqual(90f, root_child4.LayoutY);
|
||||
Assert.AreEqual(50f, root_child4.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child4.LayoutHeight);
|
||||
}
|
||||
@@ -220,9 +222,10 @@ namespace Facebook.Yoga
|
||||
public void Test_align_content_center()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.AlignContent = YogaAlign.Center;
|
||||
root.Wrap = YogaWrap.Wrap;
|
||||
root.Width = 100;
|
||||
root.Width = 130;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
@@ -254,31 +257,31 @@ namespace Facebook.Yoga
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(100f, root.LayoutWidth);
|
||||
Assert.AreEqual(130f, root.LayoutWidth);
|
||||
Assert.AreEqual(100f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(35f, root_child0.LayoutY);
|
||||
Assert.AreEqual(50f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||
Assert.AreEqual(10f, root_child1.LayoutY);
|
||||
Assert.AreEqual(50f, root_child1.LayoutX);
|
||||
Assert.AreEqual(35f, root_child1.LayoutY);
|
||||
Assert.AreEqual(50f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child1.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child2.LayoutX);
|
||||
Assert.AreEqual(20f, root_child2.LayoutY);
|
||||
Assert.AreEqual(45f, root_child2.LayoutY);
|
||||
Assert.AreEqual(50f, root_child2.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child2.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child3.LayoutX);
|
||||
Assert.AreEqual(30f, root_child3.LayoutY);
|
||||
Assert.AreEqual(50f, root_child3.LayoutX);
|
||||
Assert.AreEqual(45f, root_child3.LayoutY);
|
||||
Assert.AreEqual(50f, root_child3.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child3.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child4.LayoutX);
|
||||
Assert.AreEqual(40f, root_child4.LayoutY);
|
||||
Assert.AreEqual(55f, root_child4.LayoutY);
|
||||
Assert.AreEqual(50f, root_child4.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child4.LayoutHeight);
|
||||
|
||||
@@ -287,31 +290,31 @@ namespace Facebook.Yoga
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(100f, root.LayoutWidth);
|
||||
Assert.AreEqual(130f, root.LayoutWidth);
|
||||
Assert.AreEqual(100f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(50f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(80f, root_child0.LayoutX);
|
||||
Assert.AreEqual(35f, root_child0.LayoutY);
|
||||
Assert.AreEqual(50f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(50f, root_child1.LayoutX);
|
||||
Assert.AreEqual(10f, root_child1.LayoutY);
|
||||
Assert.AreEqual(30f, root_child1.LayoutX);
|
||||
Assert.AreEqual(35f, root_child1.LayoutY);
|
||||
Assert.AreEqual(50f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child1.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(50f, root_child2.LayoutX);
|
||||
Assert.AreEqual(20f, root_child2.LayoutY);
|
||||
Assert.AreEqual(80f, root_child2.LayoutX);
|
||||
Assert.AreEqual(45f, root_child2.LayoutY);
|
||||
Assert.AreEqual(50f, root_child2.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child2.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(50f, root_child3.LayoutX);
|
||||
Assert.AreEqual(30f, root_child3.LayoutY);
|
||||
Assert.AreEqual(30f, root_child3.LayoutX);
|
||||
Assert.AreEqual(45f, root_child3.LayoutY);
|
||||
Assert.AreEqual(50f, root_child3.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child3.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(50f, root_child4.LayoutX);
|
||||
Assert.AreEqual(40f, root_child4.LayoutY);
|
||||
Assert.AreEqual(80f, root_child4.LayoutX);
|
||||
Assert.AreEqual(55f, root_child4.LayoutY);
|
||||
Assert.AreEqual(50f, root_child4.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child4.LayoutHeight);
|
||||
}
|
||||
@@ -322,7 +325,7 @@ namespace Facebook.Yoga
|
||||
YogaNode root = new YogaNode();
|
||||
root.AlignContent = YogaAlign.Stretch;
|
||||
root.Wrap = YogaWrap.Wrap;
|
||||
root.Width = 100;
|
||||
root.Width = 150;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
@@ -349,7 +352,7 @@ namespace Facebook.Yoga
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(100f, root.LayoutWidth);
|
||||
Assert.AreEqual(150f, root.LayoutWidth);
|
||||
Assert.AreEqual(100f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
@@ -382,34 +385,236 @@ namespace Facebook.Yoga
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(100f, root.LayoutWidth);
|
||||
Assert.AreEqual(150f, root.LayoutWidth);
|
||||
Assert.AreEqual(100f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(50f, root_child0.LayoutX);
|
||||
Assert.AreEqual(100f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(50f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(0f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(50f, root_child1.LayoutX);
|
||||
Assert.AreEqual(100f, root_child1.LayoutX);
|
||||
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||
Assert.AreEqual(50f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(0f, root_child1.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(50f, root_child2.LayoutX);
|
||||
Assert.AreEqual(100f, root_child2.LayoutX);
|
||||
Assert.AreEqual(0f, root_child2.LayoutY);
|
||||
Assert.AreEqual(50f, root_child2.LayoutWidth);
|
||||
Assert.AreEqual(0f, root_child2.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(50f, root_child3.LayoutX);
|
||||
Assert.AreEqual(100f, root_child3.LayoutX);
|
||||
Assert.AreEqual(0f, root_child3.LayoutY);
|
||||
Assert.AreEqual(50f, root_child3.LayoutWidth);
|
||||
Assert.AreEqual(0f, root_child3.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(50f, root_child4.LayoutX);
|
||||
Assert.AreEqual(100f, root_child4.LayoutX);
|
||||
Assert.AreEqual(0f, root_child4.LayoutY);
|
||||
Assert.AreEqual(50f, root_child4.LayoutWidth);
|
||||
Assert.AreEqual(0f, root_child4.LayoutHeight);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_align_content_spacebetween()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.AlignContent = YogaAlign.SpaceBetween;
|
||||
root.Wrap = YogaWrap.Wrap;
|
||||
root.Width = 130;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 50;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.Width = 50;
|
||||
root_child1.Height = 10;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.Width = 50;
|
||||
root_child2.Height = 10;
|
||||
root.Insert(2, root_child2);
|
||||
|
||||
YogaNode root_child3 = new YogaNode();
|
||||
root_child3.Width = 50;
|
||||
root_child3.Height = 10;
|
||||
root.Insert(3, root_child3);
|
||||
|
||||
YogaNode root_child4 = new YogaNode();
|
||||
root_child4.Width = 50;
|
||||
root_child4.Height = 10;
|
||||
root.Insert(4, root_child4);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(130f, root.LayoutWidth);
|
||||
Assert.AreEqual(100f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(50f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(50f, root_child1.LayoutX);
|
||||
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||
Assert.AreEqual(50f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child1.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child2.LayoutX);
|
||||
Assert.AreEqual(45f, root_child2.LayoutY);
|
||||
Assert.AreEqual(50f, root_child2.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child2.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(50f, root_child3.LayoutX);
|
||||
Assert.AreEqual(45f, root_child3.LayoutY);
|
||||
Assert.AreEqual(50f, root_child3.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child3.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child4.LayoutX);
|
||||
Assert.AreEqual(90f, root_child4.LayoutY);
|
||||
Assert.AreEqual(50f, root_child4.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child4.LayoutHeight);
|
||||
|
||||
root.StyleDirection = YogaDirection.RTL;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(130f, root.LayoutWidth);
|
||||
Assert.AreEqual(100f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(80f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(50f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(30f, root_child1.LayoutX);
|
||||
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||
Assert.AreEqual(50f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child1.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(80f, root_child2.LayoutX);
|
||||
Assert.AreEqual(45f, root_child2.LayoutY);
|
||||
Assert.AreEqual(50f, root_child2.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child2.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(30f, root_child3.LayoutX);
|
||||
Assert.AreEqual(45f, root_child3.LayoutY);
|
||||
Assert.AreEqual(50f, root_child3.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child3.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(80f, root_child4.LayoutX);
|
||||
Assert.AreEqual(90f, root_child4.LayoutY);
|
||||
Assert.AreEqual(50f, root_child4.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child4.LayoutHeight);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_align_content_spacearound()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.AlignContent = YogaAlign.SpaceAround;
|
||||
root.Wrap = YogaWrap.Wrap;
|
||||
root.Width = 140;
|
||||
root.Height = 120;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 50;
|
||||
root_child0.Height = 10;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.Width = 50;
|
||||
root_child1.Height = 10;
|
||||
root.Insert(1, root_child1);
|
||||
|
||||
YogaNode root_child2 = new YogaNode();
|
||||
root_child2.Width = 50;
|
||||
root_child2.Height = 10;
|
||||
root.Insert(2, root_child2);
|
||||
|
||||
YogaNode root_child3 = new YogaNode();
|
||||
root_child3.Width = 50;
|
||||
root_child3.Height = 10;
|
||||
root.Insert(3, root_child3);
|
||||
|
||||
YogaNode root_child4 = new YogaNode();
|
||||
root_child4.Width = 50;
|
||||
root_child4.Height = 10;
|
||||
root.Insert(4, root_child4);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(140f, root.LayoutWidth);
|
||||
Assert.AreEqual(120f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(15f, root_child0.LayoutY);
|
||||
Assert.AreEqual(50f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(50f, root_child1.LayoutX);
|
||||
Assert.AreEqual(15f, root_child1.LayoutY);
|
||||
Assert.AreEqual(50f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child1.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child2.LayoutX);
|
||||
Assert.AreEqual(55f, root_child2.LayoutY);
|
||||
Assert.AreEqual(50f, root_child2.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child2.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(50f, root_child3.LayoutX);
|
||||
Assert.AreEqual(55f, root_child3.LayoutY);
|
||||
Assert.AreEqual(50f, root_child3.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child3.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child4.LayoutX);
|
||||
Assert.AreEqual(95f, root_child4.LayoutY);
|
||||
Assert.AreEqual(50f, root_child4.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child4.LayoutHeight);
|
||||
|
||||
root.StyleDirection = YogaDirection.RTL;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(140f, root.LayoutWidth);
|
||||
Assert.AreEqual(120f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(90f, root_child0.LayoutX);
|
||||
Assert.AreEqual(15f, root_child0.LayoutY);
|
||||
Assert.AreEqual(50f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(40f, root_child1.LayoutX);
|
||||
Assert.AreEqual(15f, root_child1.LayoutY);
|
||||
Assert.AreEqual(50f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child1.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(90f, root_child2.LayoutX);
|
||||
Assert.AreEqual(55f, root_child2.LayoutY);
|
||||
Assert.AreEqual(50f, root_child2.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child2.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(40f, root_child3.LayoutX);
|
||||
Assert.AreEqual(55f, root_child3.LayoutY);
|
||||
Assert.AreEqual(50f, root_child3.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child3.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(90f, root_child4.LayoutX);
|
||||
Assert.AreEqual(95f, root_child4.LayoutY);
|
||||
Assert.AreEqual(50f, root_child4.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child4.LayoutHeight);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
2
enums.py
2
enums.py
@@ -47,6 +47,8 @@ ENUMS = {
|
||||
'FlexEnd',
|
||||
'Stretch',
|
||||
'Baseline',
|
||||
'SpaceBetween',
|
||||
'SpaceAround',
|
||||
],
|
||||
'PositionType': [
|
||||
'Relative',
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<div id="align_content_flex_start" style="width: 100px; height: 100px; flex-wrap: wrap; flex-direction: column; align-content: flex-start;">
|
||||
<div id="align_content_flex_start" style="width: 130px; height: 100px; flex-wrap: wrap; flex-direction: row; align-content: flex-start;">
|
||||
<div style="width: 50px; height: 10px;"></div>
|
||||
<div style="width: 50px; height: 10px;"></div>
|
||||
<div style="width: 50px; height: 10px;"></div>
|
||||
@@ -6,7 +6,7 @@
|
||||
<div style="width: 50px; height: 10px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="align_content_flex_end" style="width: 100px; height: 100px; flex-wrap: wrap; flex-direction: column; align-content: flex-end;">
|
||||
<div id="align_content_flex_end" style="width: 130px; height: 100px; flex-wrap: wrap; flex-direction: row; align-content: flex-end;">
|
||||
<div style="width: 50px; height: 10px;"></div>
|
||||
<div style="width: 50px; height: 10px;"></div>
|
||||
<div style="width: 50px; height: 10px;"></div>
|
||||
@@ -14,7 +14,7 @@
|
||||
<div style="width: 50px; height: 10px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="align_content_center" style="width: 100px; height: 100px; flex-wrap: wrap; flex-direction: column; align-content: center;">
|
||||
<div id="align_content_center" style="width: 130px; height: 100px; flex-wrap: wrap; flex-direction: row; align-content: center;">
|
||||
<div style="width: 50px; height: 10px;"></div>
|
||||
<div style="width: 50px; height: 10px;"></div>
|
||||
<div style="width: 50px; height: 10px;"></div>
|
||||
@@ -22,10 +22,26 @@
|
||||
<div style="width: 50px; height: 10px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="align_content_stretch" style="width: 100px; height: 100px; flex-wrap: wrap; flex-direction: column; align-content: stretch;">
|
||||
<div id="align_content_stretch" style="width: 150px; height: 100px; flex-wrap: wrap; flex-direction: column; align-content: stretch;">
|
||||
<div style="width: 50px;"></div>
|
||||
<div style="width: 50px;"></div>
|
||||
<div style="width: 50px;"></div>
|
||||
<div style="width: 50px;"></div>
|
||||
<div style="width: 50px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="align_content_spacebetween" style="width: 130px; height: 100px; flex-wrap: wrap; flex-direction: row; align-content: space-between;">
|
||||
<div style="width: 50px; height: 10px;"></div>
|
||||
<div style="width: 50px; height: 10px;"></div>
|
||||
<div style="width: 50px; height: 10px;"></div>
|
||||
<div style="width: 50px; height: 10px;"></div>
|
||||
<div style="width: 50px; height: 10px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="align_content_spacearound" style="width: 140px; height: 120px; flex-wrap: wrap; flex-direction: row; align-content: space-around;">
|
||||
<div style="width: 50px; height: 10px;"></div>
|
||||
<div style="width: 50px; height: 10px;"></div>
|
||||
<div style="width: 50px; height: 10px;"></div>
|
||||
<div style="width: 50px; height: 10px;"></div>
|
||||
<div style="width: 50px; height: 10px;"></div>
|
||||
</div>
|
||||
|
@@ -82,7 +82,8 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
YGAlignFlexEnd:{value:'YGAlignFlexEnd'},
|
||||
YGAlignFlexStart:{value:'YGAlignFlexStart'},
|
||||
YGAlignStretch:{value:'YGAlignStretch'},
|
||||
|
||||
YGAlignSpaceBetween:{value:'YGAlignSpaceBetween'},
|
||||
YGAlignSpaceAround:{value:'YGAlignSpaceAround'},
|
||||
YGAlignBaseline:{value:'YGAlignBaseline'},
|
||||
|
||||
YGDirectionInherit:{value:'YGDirectionInherit'},
|
||||
|
@@ -96,6 +96,8 @@ CSEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
YGAlignFlexEnd:{value:'YogaAlign.FlexEnd'},
|
||||
YGAlignFlexStart:{value:'YogaAlign.FlexStart'},
|
||||
YGAlignStretch:{value:'YogaAlign.Stretch'},
|
||||
YGAlignSpaceBetween:{value:'YogaAlign.SpaceBetween'},
|
||||
YGAlignSpaceAround:{value:'YogaAlign.SpaceAround'},
|
||||
YGAlignBaseline:{value:'YogaAlign.Baseline'},
|
||||
|
||||
YGDirectionInherit:{value:'YogaDirection.Inherit'},
|
||||
|
@@ -100,6 +100,8 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
YGAlignFlexEnd:{value:'YogaAlign.FLEX_END'},
|
||||
YGAlignFlexStart:{value:'YogaAlign.FLEX_START'},
|
||||
YGAlignStretch:{value:'YogaAlign.STRETCH'},
|
||||
YGAlignSpaceBetween:{value:'YogaAlign.SPACE_BETWEEN'},
|
||||
YGAlignSpaceAround:{value:'YogaAlign.SPACE_AROUND'},
|
||||
YGAlignBaseline:{value:'YogaAlign.BASELINE'},
|
||||
|
||||
YGDirectionInherit:{value:'YogaDirection.INHERIT'},
|
||||
|
@@ -90,6 +90,8 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
YGAlignFlexEnd:{value:'Yoga.ALIGN_FLEX_END'},
|
||||
YGAlignFlexStart:{value:'Yoga.ALIGN_FLEX_START'},
|
||||
YGAlignStretch:{value:'Yoga.ALIGN_STRETCH'},
|
||||
YGAlignSpaceBetween:{value:'Yoga.ALIGN_SPACE_BETWEEN'},
|
||||
YGAlignSpaceAround:{value:'Yoga.ALIGN_SPACE_AROUND'},
|
||||
YGAlignBaseline:{value:'Yoga.ALIGN_BASELINE'},
|
||||
|
||||
YGDirectionInherit:{value:'Yoga.DIRECTION_INHERIT'},
|
||||
|
@@ -381,6 +381,8 @@ function alignValue(e, value) {
|
||||
case 'stretch': return e.YGAlignStretch;
|
||||
case 'flex-start': return e.YGAlignFlexStart;
|
||||
case 'flex-end': return e.YGAlignFlexEnd;
|
||||
case 'space-between': return e.YGAlignSpaceBetween;
|
||||
case 'space-around': return e.YGAlignSpaceAround;
|
||||
case 'baseline': return e.YGAlignBaseline;
|
||||
}
|
||||
}
|
||||
|
@@ -18,7 +18,9 @@ public enum YogaAlign {
|
||||
CENTER(2),
|
||||
FLEX_END(3),
|
||||
STRETCH(4),
|
||||
BASELINE(5);
|
||||
BASELINE(5),
|
||||
SPACE_BETWEEN(6),
|
||||
SPACE_AROUND(7);
|
||||
|
||||
private int mIntValue;
|
||||
|
||||
@@ -38,6 +40,8 @@ public enum YogaAlign {
|
||||
case 3: return FLEX_END;
|
||||
case 4: return STRETCH;
|
||||
case 5: return BASELINE;
|
||||
case 6: return SPACE_BETWEEN;
|
||||
case 7: return SPACE_AROUND;
|
||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
||||
}
|
||||
}
|
||||
|
@@ -19,8 +19,9 @@ public class YGAlignContentTest {
|
||||
@Test
|
||||
public void test_align_content_flex_start() {
|
||||
final YogaNode root = new YogaNode();
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(100f);
|
||||
root.setWidth(130f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = new YogaNode();
|
||||
@@ -52,7 +53,7 @@ public class YGAlignContentTest {
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(130f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
@@ -60,23 +61,23 @@ public class YGAlignContentTest {
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(10f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child3.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child4.getLayoutX(), 0.0f);
|
||||
assertEquals(40f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(20f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
|
||||
|
||||
@@ -85,31 +86,31 @@ public class YGAlignContentTest {
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(130f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(80f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(30f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(80f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(30f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child3.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child4.getLayoutX(), 0.0f);
|
||||
assertEquals(40f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(80f, root_child4.getLayoutX(), 0.0f);
|
||||
assertEquals(20f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
@@ -117,9 +118,10 @@ public class YGAlignContentTest {
|
||||
@Test
|
||||
public void test_align_content_flex_end() {
|
||||
final YogaNode root = new YogaNode();
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setAlignContent(YogaAlign.FLEX_END);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(100f);
|
||||
root.setWidth(130f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = new YogaNode();
|
||||
@@ -151,31 +153,31 @@ public class YGAlignContentTest {
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(130f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(70f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(70f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(80f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(80f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child3.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child4.getLayoutX(), 0.0f);
|
||||
assertEquals(40f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(90f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
|
||||
|
||||
@@ -184,31 +186,31 @@ public class YGAlignContentTest {
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(130f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(80f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(70f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(30f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(70f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(80f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(80f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(30f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(80f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child3.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child4.getLayoutX(), 0.0f);
|
||||
assertEquals(40f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(80f, root_child4.getLayoutX(), 0.0f);
|
||||
assertEquals(90f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
@@ -216,9 +218,10 @@ public class YGAlignContentTest {
|
||||
@Test
|
||||
public void test_align_content_center() {
|
||||
final YogaNode root = new YogaNode();
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setAlignContent(YogaAlign.CENTER);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(100f);
|
||||
root.setWidth(130f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = new YogaNode();
|
||||
@@ -250,31 +253,31 @@ public class YGAlignContentTest {
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(130f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(35f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(35f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(45f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(45f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child3.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child4.getLayoutX(), 0.0f);
|
||||
assertEquals(40f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(55f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
|
||||
|
||||
@@ -283,31 +286,31 @@ public class YGAlignContentTest {
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(130f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(80f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(35f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(30f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(35f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(80f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(45f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(30f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(45f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child3.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child4.getLayoutX(), 0.0f);
|
||||
assertEquals(40f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(80f, root_child4.getLayoutX(), 0.0f);
|
||||
assertEquals(55f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
@@ -317,7 +320,7 @@ public class YGAlignContentTest {
|
||||
final YogaNode root = new YogaNode();
|
||||
root.setAlignContent(YogaAlign.STRETCH);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(100f);
|
||||
root.setWidth(150f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = new YogaNode();
|
||||
@@ -344,7 +347,7 @@ public class YGAlignContentTest {
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(150f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
@@ -377,33 +380,233 @@ public class YGAlignContentTest {
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(150f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child3.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child4.getLayoutX(), 0.0f);
|
||||
assertEquals(100f, root_child4.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child4.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_align_content_spacebetween() {
|
||||
final YogaNode root = new YogaNode();
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setAlignContent(YogaAlign.SPACE_BETWEEN);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(130f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = new YogaNode();
|
||||
root_child0.setWidth(50f);
|
||||
root_child0.setHeight(10f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = new YogaNode();
|
||||
root_child1.setWidth(50f);
|
||||
root_child1.setHeight(10f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = new YogaNode();
|
||||
root_child2.setWidth(50f);
|
||||
root_child2.setHeight(10f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
|
||||
final YogaNode root_child3 = new YogaNode();
|
||||
root_child3.setWidth(50f);
|
||||
root_child3.setHeight(10f);
|
||||
root.addChildAt(root_child3, 3);
|
||||
|
||||
final YogaNode root_child4 = new YogaNode();
|
||||
root_child4.setWidth(50f);
|
||||
root_child4.setHeight(10f);
|
||||
root.addChildAt(root_child4, 4);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(130f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(45f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(45f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child3.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child4.getLayoutX(), 0.0f);
|
||||
assertEquals(90f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(130f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(80f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(30f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(80f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(45f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(30f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(45f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child3.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(80f, root_child4.getLayoutX(), 0.0f);
|
||||
assertEquals(90f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_align_content_spacearound() {
|
||||
final YogaNode root = new YogaNode();
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setAlignContent(YogaAlign.SPACE_AROUND);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(140f);
|
||||
root.setHeight(120f);
|
||||
|
||||
final YogaNode root_child0 = new YogaNode();
|
||||
root_child0.setWidth(50f);
|
||||
root_child0.setHeight(10f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = new YogaNode();
|
||||
root_child1.setWidth(50f);
|
||||
root_child1.setHeight(10f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = new YogaNode();
|
||||
root_child2.setWidth(50f);
|
||||
root_child2.setHeight(10f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
|
||||
final YogaNode root_child3 = new YogaNode();
|
||||
root_child3.setWidth(50f);
|
||||
root_child3.setHeight(10f);
|
||||
root.addChildAt(root_child3, 3);
|
||||
|
||||
final YogaNode root_child4 = new YogaNode();
|
||||
root_child4.setWidth(50f);
|
||||
root_child4.setHeight(10f);
|
||||
root.addChildAt(root_child4, 4);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(140f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(120f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(15f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(15f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(55f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(55f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child3.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child4.getLayoutX(), 0.0f);
|
||||
assertEquals(95f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(140f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(120f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(90f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(15f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(40f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(15f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(90f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(55f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(40f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(55f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child3.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(90f, root_child4.getLayoutX(), 0.0f);
|
||||
assertEquals(95f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -9,13 +9,15 @@
|
||||
|
||||
module.exports = {
|
||||
|
||||
ALIGN_COUNT: 6,
|
||||
ALIGN_COUNT: 8,
|
||||
ALIGN_AUTO: 0,
|
||||
ALIGN_FLEX_START: 1,
|
||||
ALIGN_CENTER: 2,
|
||||
ALIGN_FLEX_END: 3,
|
||||
ALIGN_STRETCH: 4,
|
||||
ALIGN_BASELINE: 5,
|
||||
ALIGN_SPACE_BETWEEN: 6,
|
||||
ALIGN_SPACE_AROUND: 7,
|
||||
|
||||
DIMENSION_COUNT: 2,
|
||||
DIMENSION_WIDTH: 0,
|
||||
|
@@ -13,8 +13,9 @@ var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY);
|
||||
|
||||
it("align_content_flex_start", function () {
|
||||
var root = Yoga.Node.create();
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setFlexWrap(Yoga.WRAP_WRAP);
|
||||
root.setWidth(100);
|
||||
root.setWidth(130);
|
||||
root.setHeight(100);
|
||||
|
||||
var root_child0 = Yoga.Node.create();
|
||||
@@ -45,7 +46,7 @@ it("align_content_flex_start", function () {
|
||||
|
||||
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
||||
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
||||
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||
console.assert(130 === root.getComputedWidth(), "130 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
||||
|
||||
console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||
@@ -53,23 +54,23 @@ it("align_content_flex_start", function () {
|
||||
console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
||||
|
||||
console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||
console.assert(10 === root_child1.getComputedTop(), "10 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
||||
console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||
console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
||||
console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
|
||||
|
||||
console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
||||
console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
||||
console.assert(10 === root_child2.getComputedTop(), "10 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
||||
console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
|
||||
|
||||
console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")");
|
||||
console.assert(30 === root_child3.getComputedTop(), "30 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")");
|
||||
console.assert(50 === root_child3.getComputedLeft(), "50 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")");
|
||||
console.assert(10 === root_child3.getComputedTop(), "10 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")");
|
||||
console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child3.getComputedHeight(), "10 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")");
|
||||
|
||||
console.assert(0 === root_child4.getComputedLeft(), "0 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")");
|
||||
console.assert(40 === root_child4.getComputedTop(), "40 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")");
|
||||
console.assert(20 === root_child4.getComputedTop(), "20 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")");
|
||||
console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child4.getComputedHeight(), "10 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")");
|
||||
|
||||
@@ -77,31 +78,31 @@ it("align_content_flex_start", function () {
|
||||
|
||||
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
||||
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
||||
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||
console.assert(130 === root.getComputedWidth(), "130 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
||||
|
||||
console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||
console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
||||
console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
||||
|
||||
console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||
console.assert(10 === root_child1.getComputedTop(), "10 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
||||
console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||
console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
||||
console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
|
||||
|
||||
console.assert(50 === root_child2.getComputedLeft(), "50 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
||||
console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
||||
console.assert(80 === root_child2.getComputedLeft(), "80 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
||||
console.assert(10 === root_child2.getComputedTop(), "10 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
||||
console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
|
||||
|
||||
console.assert(50 === root_child3.getComputedLeft(), "50 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")");
|
||||
console.assert(30 === root_child3.getComputedTop(), "30 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")");
|
||||
console.assert(30 === root_child3.getComputedLeft(), "30 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")");
|
||||
console.assert(10 === root_child3.getComputedTop(), "10 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")");
|
||||
console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child3.getComputedHeight(), "10 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")");
|
||||
|
||||
console.assert(50 === root_child4.getComputedLeft(), "50 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")");
|
||||
console.assert(40 === root_child4.getComputedTop(), "40 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")");
|
||||
console.assert(80 === root_child4.getComputedLeft(), "80 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")");
|
||||
console.assert(20 === root_child4.getComputedTop(), "20 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")");
|
||||
console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child4.getComputedHeight(), "10 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")");
|
||||
|
||||
@@ -113,9 +114,10 @@ it("align_content_flex_start", function () {
|
||||
});
|
||||
it("align_content_flex_end", function () {
|
||||
var root = Yoga.Node.create();
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setAlignContent(Yoga.ALIGN_FLEX_END);
|
||||
root.setFlexWrap(Yoga.WRAP_WRAP);
|
||||
root.setWidth(100);
|
||||
root.setWidth(130);
|
||||
root.setHeight(100);
|
||||
|
||||
var root_child0 = Yoga.Node.create();
|
||||
@@ -146,31 +148,31 @@ it("align_content_flex_end", function () {
|
||||
|
||||
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
||||
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
||||
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||
console.assert(130 === root.getComputedWidth(), "130 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
||||
|
||||
console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
||||
console.assert(70 === root_child0.getComputedTop(), "70 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
||||
console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
||||
|
||||
console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||
console.assert(10 === root_child1.getComputedTop(), "10 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
||||
console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||
console.assert(70 === root_child1.getComputedTop(), "70 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
||||
console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
|
||||
|
||||
console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
||||
console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
||||
console.assert(80 === root_child2.getComputedTop(), "80 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
||||
console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
|
||||
|
||||
console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")");
|
||||
console.assert(30 === root_child3.getComputedTop(), "30 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")");
|
||||
console.assert(50 === root_child3.getComputedLeft(), "50 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")");
|
||||
console.assert(80 === root_child3.getComputedTop(), "80 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")");
|
||||
console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child3.getComputedHeight(), "10 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")");
|
||||
|
||||
console.assert(0 === root_child4.getComputedLeft(), "0 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")");
|
||||
console.assert(40 === root_child4.getComputedTop(), "40 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")");
|
||||
console.assert(90 === root_child4.getComputedTop(), "90 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")");
|
||||
console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child4.getComputedHeight(), "10 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")");
|
||||
|
||||
@@ -178,31 +180,31 @@ it("align_content_flex_end", function () {
|
||||
|
||||
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
||||
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
||||
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||
console.assert(130 === root.getComputedWidth(), "130 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
||||
|
||||
console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
||||
console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||
console.assert(70 === root_child0.getComputedTop(), "70 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
||||
console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
||||
|
||||
console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||
console.assert(10 === root_child1.getComputedTop(), "10 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
||||
console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||
console.assert(70 === root_child1.getComputedTop(), "70 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
||||
console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
|
||||
|
||||
console.assert(50 === root_child2.getComputedLeft(), "50 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
||||
console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
||||
console.assert(80 === root_child2.getComputedLeft(), "80 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
||||
console.assert(80 === root_child2.getComputedTop(), "80 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
||||
console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
|
||||
|
||||
console.assert(50 === root_child3.getComputedLeft(), "50 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")");
|
||||
console.assert(30 === root_child3.getComputedTop(), "30 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")");
|
||||
console.assert(30 === root_child3.getComputedLeft(), "30 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")");
|
||||
console.assert(80 === root_child3.getComputedTop(), "80 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")");
|
||||
console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child3.getComputedHeight(), "10 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")");
|
||||
|
||||
console.assert(50 === root_child4.getComputedLeft(), "50 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")");
|
||||
console.assert(40 === root_child4.getComputedTop(), "40 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")");
|
||||
console.assert(80 === root_child4.getComputedLeft(), "80 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")");
|
||||
console.assert(90 === root_child4.getComputedTop(), "90 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")");
|
||||
console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child4.getComputedHeight(), "10 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")");
|
||||
|
||||
@@ -214,9 +216,10 @@ it("align_content_flex_end", function () {
|
||||
});
|
||||
it("align_content_center", function () {
|
||||
var root = Yoga.Node.create();
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setAlignContent(Yoga.ALIGN_CENTER);
|
||||
root.setFlexWrap(Yoga.WRAP_WRAP);
|
||||
root.setWidth(100);
|
||||
root.setWidth(130);
|
||||
root.setHeight(100);
|
||||
|
||||
var root_child0 = Yoga.Node.create();
|
||||
@@ -247,31 +250,31 @@ it("align_content_center", function () {
|
||||
|
||||
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
||||
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
||||
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||
console.assert(130 === root.getComputedWidth(), "130 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
||||
|
||||
console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
||||
console.assert(35 === root_child0.getComputedTop(), "35 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
||||
console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
||||
|
||||
console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||
console.assert(10 === root_child1.getComputedTop(), "10 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
||||
console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||
console.assert(35 === root_child1.getComputedTop(), "35 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
||||
console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
|
||||
|
||||
console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
||||
console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
||||
console.assert(45 === root_child2.getComputedTop(), "45 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
||||
console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
|
||||
|
||||
console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")");
|
||||
console.assert(30 === root_child3.getComputedTop(), "30 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")");
|
||||
console.assert(50 === root_child3.getComputedLeft(), "50 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")");
|
||||
console.assert(45 === root_child3.getComputedTop(), "45 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")");
|
||||
console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child3.getComputedHeight(), "10 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")");
|
||||
|
||||
console.assert(0 === root_child4.getComputedLeft(), "0 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")");
|
||||
console.assert(40 === root_child4.getComputedTop(), "40 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")");
|
||||
console.assert(55 === root_child4.getComputedTop(), "55 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")");
|
||||
console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child4.getComputedHeight(), "10 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")");
|
||||
|
||||
@@ -279,31 +282,31 @@ it("align_content_center", function () {
|
||||
|
||||
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
||||
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
||||
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||
console.assert(130 === root.getComputedWidth(), "130 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
||||
|
||||
console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
||||
console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||
console.assert(35 === root_child0.getComputedTop(), "35 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
||||
console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
||||
|
||||
console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||
console.assert(10 === root_child1.getComputedTop(), "10 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
||||
console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||
console.assert(35 === root_child1.getComputedTop(), "35 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
||||
console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
|
||||
|
||||
console.assert(50 === root_child2.getComputedLeft(), "50 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
||||
console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
||||
console.assert(80 === root_child2.getComputedLeft(), "80 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
||||
console.assert(45 === root_child2.getComputedTop(), "45 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
||||
console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
|
||||
|
||||
console.assert(50 === root_child3.getComputedLeft(), "50 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")");
|
||||
console.assert(30 === root_child3.getComputedTop(), "30 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")");
|
||||
console.assert(30 === root_child3.getComputedLeft(), "30 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")");
|
||||
console.assert(45 === root_child3.getComputedTop(), "45 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")");
|
||||
console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child3.getComputedHeight(), "10 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")");
|
||||
|
||||
console.assert(50 === root_child4.getComputedLeft(), "50 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")");
|
||||
console.assert(40 === root_child4.getComputedTop(), "40 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")");
|
||||
console.assert(80 === root_child4.getComputedLeft(), "80 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")");
|
||||
console.assert(55 === root_child4.getComputedTop(), "55 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")");
|
||||
console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child4.getComputedHeight(), "10 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")");
|
||||
|
||||
@@ -317,7 +320,7 @@ it("align_content_stretch", function () {
|
||||
var root = Yoga.Node.create();
|
||||
root.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root.setFlexWrap(Yoga.WRAP_WRAP);
|
||||
root.setWidth(100);
|
||||
root.setWidth(150);
|
||||
root.setHeight(100);
|
||||
|
||||
var root_child0 = Yoga.Node.create();
|
||||
@@ -343,7 +346,7 @@ it("align_content_stretch", function () {
|
||||
|
||||
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
||||
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
||||
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||
console.assert(150 === root.getComputedWidth(), "150 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
||||
|
||||
console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||
@@ -375,30 +378,30 @@ it("align_content_stretch", function () {
|
||||
|
||||
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
||||
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
||||
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||
console.assert(150 === root.getComputedWidth(), "150 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
||||
|
||||
console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||
console.assert(100 === root_child0.getComputedLeft(), "100 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
||||
console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
||||
console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
||||
|
||||
console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||
console.assert(100 === root_child1.getComputedLeft(), "100 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||
console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
||||
console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
|
||||
console.assert(0 === root_child1.getComputedHeight(), "0 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
|
||||
|
||||
console.assert(50 === root_child2.getComputedLeft(), "50 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
||||
console.assert(100 === root_child2.getComputedLeft(), "100 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
||||
console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
||||
console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
|
||||
console.assert(0 === root_child2.getComputedHeight(), "0 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
|
||||
|
||||
console.assert(50 === root_child3.getComputedLeft(), "50 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")");
|
||||
console.assert(100 === root_child3.getComputedLeft(), "100 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")");
|
||||
console.assert(0 === root_child3.getComputedTop(), "0 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")");
|
||||
console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")");
|
||||
console.assert(0 === root_child3.getComputedHeight(), "0 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")");
|
||||
|
||||
console.assert(50 === root_child4.getComputedLeft(), "50 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")");
|
||||
console.assert(100 === root_child4.getComputedLeft(), "100 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")");
|
||||
console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")");
|
||||
console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")");
|
||||
console.assert(0 === root_child4.getComputedHeight(), "0 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")");
|
||||
@@ -409,3 +412,207 @@ it("align_content_stretch", function () {
|
||||
(typeof gc !== "undefined") && gc();
|
||||
console.assert(0 === Yoga.getInstanceCount(), "0 === Yoga.getInstanceCount() (" + Yoga.getInstanceCount() + ")");
|
||||
});
|
||||
it("align_content_spacebetween", function () {
|
||||
var root = Yoga.Node.create();
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setAlignContent(Yoga.ALIGN_SPACE_BETWEEN);
|
||||
root.setFlexWrap(Yoga.WRAP_WRAP);
|
||||
root.setWidth(130);
|
||||
root.setHeight(100);
|
||||
|
||||
var root_child0 = Yoga.Node.create();
|
||||
root_child0.setWidth(50);
|
||||
root_child0.setHeight(10);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
var root_child1 = Yoga.Node.create();
|
||||
root_child1.setWidth(50);
|
||||
root_child1.setHeight(10);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
var root_child2 = Yoga.Node.create();
|
||||
root_child2.setWidth(50);
|
||||
root_child2.setHeight(10);
|
||||
root.insertChild(root_child2, 2);
|
||||
|
||||
var root_child3 = Yoga.Node.create();
|
||||
root_child3.setWidth(50);
|
||||
root_child3.setHeight(10);
|
||||
root.insertChild(root_child3, 3);
|
||||
|
||||
var root_child4 = Yoga.Node.create();
|
||||
root_child4.setWidth(50);
|
||||
root_child4.setHeight(10);
|
||||
root.insertChild(root_child4, 4);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
|
||||
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
||||
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
||||
console.assert(130 === root.getComputedWidth(), "130 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
||||
|
||||
console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
||||
console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
||||
|
||||
console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||
console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
||||
console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
|
||||
|
||||
console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
||||
console.assert(45 === root_child2.getComputedTop(), "45 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
||||
console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
|
||||
|
||||
console.assert(50 === root_child3.getComputedLeft(), "50 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")");
|
||||
console.assert(45 === root_child3.getComputedTop(), "45 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")");
|
||||
console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child3.getComputedHeight(), "10 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")");
|
||||
|
||||
console.assert(0 === root_child4.getComputedLeft(), "0 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")");
|
||||
console.assert(90 === root_child4.getComputedTop(), "90 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")");
|
||||
console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child4.getComputedHeight(), "10 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")");
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
|
||||
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
||||
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
||||
console.assert(130 === root.getComputedWidth(), "130 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
||||
|
||||
console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
||||
console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
||||
|
||||
console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||
console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
||||
console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
|
||||
|
||||
console.assert(80 === root_child2.getComputedLeft(), "80 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
||||
console.assert(45 === root_child2.getComputedTop(), "45 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
||||
console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
|
||||
|
||||
console.assert(30 === root_child3.getComputedLeft(), "30 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")");
|
||||
console.assert(45 === root_child3.getComputedTop(), "45 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")");
|
||||
console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child3.getComputedHeight(), "10 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")");
|
||||
|
||||
console.assert(80 === root_child4.getComputedLeft(), "80 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")");
|
||||
console.assert(90 === root_child4.getComputedTop(), "90 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")");
|
||||
console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child4.getComputedHeight(), "10 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")");
|
||||
|
||||
if (typeof root !== "undefined")
|
||||
root.freeRecursive();
|
||||
|
||||
(typeof gc !== "undefined") && gc();
|
||||
console.assert(0 === Yoga.getInstanceCount(), "0 === Yoga.getInstanceCount() (" + Yoga.getInstanceCount() + ")");
|
||||
});
|
||||
it("align_content_spacearound", function () {
|
||||
var root = Yoga.Node.create();
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setAlignContent(Yoga.ALIGN_SPACE_AROUND);
|
||||
root.setFlexWrap(Yoga.WRAP_WRAP);
|
||||
root.setWidth(140);
|
||||
root.setHeight(120);
|
||||
|
||||
var root_child0 = Yoga.Node.create();
|
||||
root_child0.setWidth(50);
|
||||
root_child0.setHeight(10);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
var root_child1 = Yoga.Node.create();
|
||||
root_child1.setWidth(50);
|
||||
root_child1.setHeight(10);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
var root_child2 = Yoga.Node.create();
|
||||
root_child2.setWidth(50);
|
||||
root_child2.setHeight(10);
|
||||
root.insertChild(root_child2, 2);
|
||||
|
||||
var root_child3 = Yoga.Node.create();
|
||||
root_child3.setWidth(50);
|
||||
root_child3.setHeight(10);
|
||||
root.insertChild(root_child3, 3);
|
||||
|
||||
var root_child4 = Yoga.Node.create();
|
||||
root_child4.setWidth(50);
|
||||
root_child4.setHeight(10);
|
||||
root.insertChild(root_child4, 4);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
|
||||
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
||||
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
||||
console.assert(140 === root.getComputedWidth(), "140 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||
console.assert(120 === root.getComputedHeight(), "120 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
||||
|
||||
console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||
console.assert(15 === root_child0.getComputedTop(), "15 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
||||
console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
||||
|
||||
console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||
console.assert(15 === root_child1.getComputedTop(), "15 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
||||
console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
|
||||
|
||||
console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
||||
console.assert(55 === root_child2.getComputedTop(), "55 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
||||
console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
|
||||
|
||||
console.assert(50 === root_child3.getComputedLeft(), "50 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")");
|
||||
console.assert(55 === root_child3.getComputedTop(), "55 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")");
|
||||
console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child3.getComputedHeight(), "10 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")");
|
||||
|
||||
console.assert(0 === root_child4.getComputedLeft(), "0 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")");
|
||||
console.assert(95 === root_child4.getComputedTop(), "95 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")");
|
||||
console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child4.getComputedHeight(), "10 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")");
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
|
||||
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
||||
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
||||
console.assert(140 === root.getComputedWidth(), "140 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||
console.assert(120 === root.getComputedHeight(), "120 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
||||
|
||||
console.assert(90 === root_child0.getComputedLeft(), "90 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||
console.assert(15 === root_child0.getComputedTop(), "15 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
||||
console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
||||
|
||||
console.assert(40 === root_child1.getComputedLeft(), "40 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||
console.assert(15 === root_child1.getComputedTop(), "15 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
||||
console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
|
||||
|
||||
console.assert(90 === root_child2.getComputedLeft(), "90 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
||||
console.assert(55 === root_child2.getComputedTop(), "55 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
||||
console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
|
||||
|
||||
console.assert(40 === root_child3.getComputedLeft(), "40 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")");
|
||||
console.assert(55 === root_child3.getComputedTop(), "55 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")");
|
||||
console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child3.getComputedHeight(), "10 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")");
|
||||
|
||||
console.assert(90 === root_child4.getComputedLeft(), "90 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")");
|
||||
console.assert(95 === root_child4.getComputedTop(), "95 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")");
|
||||
console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")");
|
||||
console.assert(10 === root_child4.getComputedHeight(), "10 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")");
|
||||
|
||||
if (typeof root !== "undefined")
|
||||
root.freeRecursive();
|
||||
|
||||
(typeof gc !== "undefined") && gc();
|
||||
console.assert(0 === Yoga.getInstanceCount(), "0 === Yoga.getInstanceCount() (" + Yoga.getInstanceCount() + ")");
|
||||
});
|
||||
|
@@ -14,8 +14,9 @@
|
||||
|
||||
TEST(YogaTest, align_content_flex_start) {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
YGNodeStyleSetFlexWrap(root, YGWrapWrap);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
YGNodeStyleSetWidth(root, 130);
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
@@ -46,7 +47,7 @@ TEST(YogaTest, align_content_flex_start) {
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(130, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||
@@ -54,23 +55,23 @@ TEST(YogaTest, align_content_flex_start) {
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child2));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child2));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child2));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child3));
|
||||
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetTop(root_child3));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child3));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child3));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child3));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child4));
|
||||
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child4));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child4));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child4));
|
||||
|
||||
@@ -78,31 +79,31 @@ TEST(YogaTest, align_content_flex_start) {
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(130, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child2));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child2));
|
||||
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child2));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child2));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child2));
|
||||
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child3));
|
||||
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetTop(root_child3));
|
||||
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetLeft(root_child3));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child3));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child3));
|
||||
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child4));
|
||||
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child4));
|
||||
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child4));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child4));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child4));
|
||||
|
||||
@@ -111,9 +112,10 @@ TEST(YogaTest, align_content_flex_start) {
|
||||
|
||||
TEST(YogaTest, align_content_flex_end) {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
YGNodeStyleSetAlignContent(root, YGAlignFlexEnd);
|
||||
YGNodeStyleSetFlexWrap(root, YGWrapWrap);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
YGNodeStyleSetWidth(root, 130);
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
@@ -144,31 +146,31 @@ TEST(YogaTest, align_content_flex_end) {
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(130, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(70, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(70, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child2));
|
||||
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetTop(root_child2));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child2));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child3));
|
||||
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetTop(root_child3));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child3));
|
||||
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetTop(root_child3));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child3));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child4));
|
||||
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child4));
|
||||
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetTop(root_child4));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child4));
|
||||
|
||||
@@ -176,31 +178,31 @@ TEST(YogaTest, align_content_flex_end) {
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(130, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(70, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(70, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child2));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child2));
|
||||
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child2));
|
||||
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetTop(root_child2));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child2));
|
||||
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child3));
|
||||
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetTop(root_child3));
|
||||
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetLeft(root_child3));
|
||||
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetTop(root_child3));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child3));
|
||||
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child4));
|
||||
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child4));
|
||||
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child4));
|
||||
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetTop(root_child4));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child4));
|
||||
|
||||
@@ -209,9 +211,10 @@ TEST(YogaTest, align_content_flex_end) {
|
||||
|
||||
TEST(YogaTest, align_content_center) {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
YGNodeStyleSetAlignContent(root, YGAlignCenter);
|
||||
YGNodeStyleSetFlexWrap(root, YGWrapWrap);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
YGNodeStyleSetWidth(root, 130);
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
@@ -242,31 +245,31 @@ TEST(YogaTest, align_content_center) {
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(130, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(35, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(35, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child2));
|
||||
ASSERT_FLOAT_EQ(45, YGNodeLayoutGetTop(root_child2));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child2));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child3));
|
||||
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetTop(root_child3));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child3));
|
||||
ASSERT_FLOAT_EQ(45, YGNodeLayoutGetTop(root_child3));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child3));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child4));
|
||||
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child4));
|
||||
ASSERT_FLOAT_EQ(55, YGNodeLayoutGetTop(root_child4));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child4));
|
||||
|
||||
@@ -274,31 +277,31 @@ TEST(YogaTest, align_content_center) {
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(130, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(35, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(35, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child2));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child2));
|
||||
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child2));
|
||||
ASSERT_FLOAT_EQ(45, YGNodeLayoutGetTop(root_child2));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child2));
|
||||
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child3));
|
||||
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetTop(root_child3));
|
||||
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetLeft(root_child3));
|
||||
ASSERT_FLOAT_EQ(45, YGNodeLayoutGetTop(root_child3));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child3));
|
||||
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child4));
|
||||
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child4));
|
||||
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child4));
|
||||
ASSERT_FLOAT_EQ(55, YGNodeLayoutGetTop(root_child4));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child4));
|
||||
|
||||
@@ -309,7 +312,7 @@ TEST(YogaTest, align_content_stretch) {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
YGNodeStyleSetAlignContent(root, YGAlignStretch);
|
||||
YGNodeStyleSetFlexWrap(root, YGWrapWrap);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
YGNodeStyleSetWidth(root, 150);
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
@@ -335,7 +338,7 @@ TEST(YogaTest, align_content_stretch) {
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||
@@ -367,33 +370,231 @@ TEST(YogaTest, align_content_stretch) {
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child2));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child2));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child2));
|
||||
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child3));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child3));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child3));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child3));
|
||||
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child4));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child4));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child4));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child4));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
}
|
||||
|
||||
TEST(YogaTest, align_content_spacebetween) {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
YGNodeStyleSetAlignContent(root, YGAlignSpaceBetween);
|
||||
YGNodeStyleSetFlexWrap(root, YGWrapWrap);
|
||||
YGNodeStyleSetWidth(root, 130);
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
YGNodeStyleSetWidth(root_child0, 50);
|
||||
YGNodeStyleSetHeight(root_child0, 10);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child1 = YGNodeNew();
|
||||
YGNodeStyleSetWidth(root_child1, 50);
|
||||
YGNodeStyleSetHeight(root_child1, 10);
|
||||
YGNodeInsertChild(root, root_child1, 1);
|
||||
|
||||
const YGNodeRef root_child2 = YGNodeNew();
|
||||
YGNodeStyleSetWidth(root_child2, 50);
|
||||
YGNodeStyleSetHeight(root_child2, 10);
|
||||
YGNodeInsertChild(root, root_child2, 2);
|
||||
|
||||
const YGNodeRef root_child3 = YGNodeNew();
|
||||
YGNodeStyleSetWidth(root_child3, 50);
|
||||
YGNodeStyleSetHeight(root_child3, 10);
|
||||
YGNodeInsertChild(root, root_child3, 3);
|
||||
|
||||
const YGNodeRef root_child4 = YGNodeNew();
|
||||
YGNodeStyleSetWidth(root_child4, 50);
|
||||
YGNodeStyleSetHeight(root_child4, 10);
|
||||
YGNodeInsertChild(root, root_child4, 4);
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(130, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
|
||||
ASSERT_FLOAT_EQ(45, YGNodeLayoutGetTop(root_child2));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child2));
|
||||
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child3));
|
||||
ASSERT_FLOAT_EQ(45, YGNodeLayoutGetTop(root_child3));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child3));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child4));
|
||||
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetTop(root_child4));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child4));
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(130, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child2));
|
||||
ASSERT_FLOAT_EQ(45, YGNodeLayoutGetTop(root_child2));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child2));
|
||||
|
||||
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetLeft(root_child3));
|
||||
ASSERT_FLOAT_EQ(45, YGNodeLayoutGetTop(root_child3));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child3));
|
||||
|
||||
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child4));
|
||||
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetTop(root_child4));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child4));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
}
|
||||
|
||||
TEST(YogaTest, align_content_spacearound) {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
YGNodeStyleSetAlignContent(root, YGAlignSpaceAround);
|
||||
YGNodeStyleSetFlexWrap(root, YGWrapWrap);
|
||||
YGNodeStyleSetWidth(root, 140);
|
||||
YGNodeStyleSetHeight(root, 120);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
YGNodeStyleSetWidth(root_child0, 50);
|
||||
YGNodeStyleSetHeight(root_child0, 10);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child1 = YGNodeNew();
|
||||
YGNodeStyleSetWidth(root_child1, 50);
|
||||
YGNodeStyleSetHeight(root_child1, 10);
|
||||
YGNodeInsertChild(root, root_child1, 1);
|
||||
|
||||
const YGNodeRef root_child2 = YGNodeNew();
|
||||
YGNodeStyleSetWidth(root_child2, 50);
|
||||
YGNodeStyleSetHeight(root_child2, 10);
|
||||
YGNodeInsertChild(root, root_child2, 2);
|
||||
|
||||
const YGNodeRef root_child3 = YGNodeNew();
|
||||
YGNodeStyleSetWidth(root_child3, 50);
|
||||
YGNodeStyleSetHeight(root_child3, 10);
|
||||
YGNodeInsertChild(root, root_child3, 3);
|
||||
|
||||
const YGNodeRef root_child4 = YGNodeNew();
|
||||
YGNodeStyleSetWidth(root_child4, 50);
|
||||
YGNodeStyleSetHeight(root_child4, 10);
|
||||
YGNodeInsertChild(root, root_child4, 4);
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(140, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(15, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(15, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
|
||||
ASSERT_FLOAT_EQ(55, YGNodeLayoutGetTop(root_child2));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child2));
|
||||
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child3));
|
||||
ASSERT_FLOAT_EQ(55, YGNodeLayoutGetTop(root_child3));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child3));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child4));
|
||||
ASSERT_FLOAT_EQ(95, YGNodeLayoutGetTop(root_child4));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child4));
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(140, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(15, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(15, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child2));
|
||||
ASSERT_FLOAT_EQ(55, YGNodeLayoutGetTop(root_child2));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child2));
|
||||
|
||||
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetLeft(root_child3));
|
||||
ASSERT_FLOAT_EQ(55, YGNodeLayoutGetTop(root_child3));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child3));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child3));
|
||||
|
||||
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child4));
|
||||
ASSERT_FLOAT_EQ(95, YGNodeLayoutGetTop(root_child4));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child4));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child4));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
}
|
||||
|
@@ -13,7 +13,7 @@
|
||||
|
||||
YG_EXTERN_C_BEGIN
|
||||
|
||||
#define YGAlignCount 6
|
||||
#define YGAlignCount 8
|
||||
typedef YG_ENUM_BEGIN(YGAlign) {
|
||||
YGAlignAuto,
|
||||
YGAlignFlexStart,
|
||||
@@ -21,6 +21,8 @@ typedef YG_ENUM_BEGIN(YGAlign) {
|
||||
YGAlignFlexEnd,
|
||||
YGAlignStretch,
|
||||
YGAlignBaseline,
|
||||
YGAlignSpaceBetween,
|
||||
YGAlignSpaceAround,
|
||||
} YG_ENUM_END(YGAlign);
|
||||
|
||||
#define YGDimensionCount 2
|
||||
|
19
yoga/Yoga.c
19
yoga/Yoga.c
@@ -2667,7 +2667,22 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
||||
break;
|
||||
case YGAlignStretch:
|
||||
if (availableInnerCrossDim > totalLineCrossDim) {
|
||||
crossDimLead = (remainingAlignContentDim / lineCount);
|
||||
crossDimLead = remainingAlignContentDim / lineCount;
|
||||
}
|
||||
break;
|
||||
case YGAlignSpaceAround:
|
||||
if (availableInnerCrossDim > totalLineCrossDim) {
|
||||
currentLead += remainingAlignContentDim / (2 * lineCount);
|
||||
if (lineCount > 1) {
|
||||
crossDimLead = remainingAlignContentDim / lineCount;
|
||||
}
|
||||
} else {
|
||||
currentLead += remainingAlignContentDim / 2;
|
||||
}
|
||||
break;
|
||||
case YGAlignSpaceBetween:
|
||||
if (availableInnerCrossDim > totalLineCrossDim && lineCount > 1) {
|
||||
crossDimLead = remainingAlignContentDim / (lineCount - 1);
|
||||
}
|
||||
break;
|
||||
case YGAlignAuto:
|
||||
@@ -2755,6 +2770,8 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
||||
break;
|
||||
}
|
||||
case YGAlignAuto:
|
||||
case YGAlignSpaceBetween:
|
||||
case YGAlignSpaceAround:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user