diff --git a/csharp/tests/Facebook.Yoga/YGAlignItemsTest.cs b/csharp/tests/Facebook.Yoga/YGAlignItemsTest.cs
index 9515bdffa6..febfb33f87 100644
--- a/csharp/tests/Facebook.Yoga/YGAlignItemsTest.cs
+++ b/csharp/tests/Facebook.Yoga/YGAlignItemsTest.cs
@@ -1959,7 +1959,144 @@ public void Test_align_strech_should_size_based_on_parent()
}
[Test]
- public void Test_align_flex_start_with_shrinkin_children()
+ public void Test_align_flex_start_with_shrinking_children()
+ {
+ YogaConfig config = new YogaConfig();
+
+ YogaNode root = new YogaNode(config);
+ root.Width = 500;
+ root.Height = 500;
+
+ YogaNode root_child0 = new YogaNode(config);
+ root_child0.AlignItems = YogaAlign.FlexStart;
+ root.Insert(0, root_child0);
+
+ YogaNode root_child0_child0 = new YogaNode(config);
+ root_child0_child0.FlexGrow = 1;
+ root_child0_child0.FlexShrink = 1;
+ root_child0.Insert(0, root_child0_child0);
+
+ YogaNode root_child0_child0_child0 = new YogaNode(config);
+ root_child0_child0_child0.FlexGrow = 1;
+ root_child0_child0_child0.FlexShrink = 1;
+ root_child0_child0.Insert(0, root_child0_child0_child0);
+ root.StyleDirection = YogaDirection.LTR;
+ root.CalculateLayout();
+
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(500f, root.LayoutWidth);
+ Assert.AreEqual(500f, root.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(500f, root_child0.LayoutWidth);
+ Assert.AreEqual(0f, root_child0.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child0_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0_child0.LayoutY);
+ Assert.AreEqual(0f, root_child0_child0.LayoutWidth);
+ Assert.AreEqual(0f, root_child0_child0.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child0_child0_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0_child0_child0.LayoutY);
+ Assert.AreEqual(0f, root_child0_child0_child0.LayoutWidth);
+ Assert.AreEqual(0f, root_child0_child0_child0.LayoutHeight);
+
+ root.StyleDirection = YogaDirection.RTL;
+ root.CalculateLayout();
+
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(500f, root.LayoutWidth);
+ Assert.AreEqual(500f, root.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(500f, root_child0.LayoutWidth);
+ Assert.AreEqual(0f, root_child0.LayoutHeight);
+
+ Assert.AreEqual(500f, root_child0_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0_child0.LayoutY);
+ Assert.AreEqual(0f, root_child0_child0.LayoutWidth);
+ Assert.AreEqual(0f, root_child0_child0.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child0_child0_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0_child0_child0.LayoutY);
+ Assert.AreEqual(0f, root_child0_child0_child0.LayoutWidth);
+ Assert.AreEqual(0f, root_child0_child0_child0.LayoutHeight);
+ }
+
+ [Test]
+ public void Test_align_flex_start_with_stretching_children()
+ {
+ YogaConfig config = new YogaConfig();
+
+ YogaNode root = new YogaNode(config);
+ root.Width = 500;
+ root.Height = 500;
+
+ YogaNode root_child0 = new YogaNode(config);
+ root.Insert(0, root_child0);
+
+ YogaNode root_child0_child0 = new YogaNode(config);
+ root_child0_child0.FlexGrow = 1;
+ root_child0_child0.FlexShrink = 1;
+ root_child0.Insert(0, root_child0_child0);
+
+ YogaNode root_child0_child0_child0 = new YogaNode(config);
+ root_child0_child0_child0.FlexGrow = 1;
+ root_child0_child0_child0.FlexShrink = 1;
+ root_child0_child0.Insert(0, root_child0_child0_child0);
+ root.StyleDirection = YogaDirection.LTR;
+ root.CalculateLayout();
+
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(500f, root.LayoutWidth);
+ Assert.AreEqual(500f, root.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(500f, root_child0.LayoutWidth);
+ Assert.AreEqual(0f, root_child0.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child0_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0_child0.LayoutY);
+ Assert.AreEqual(500f, root_child0_child0.LayoutWidth);
+ Assert.AreEqual(0f, root_child0_child0.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child0_child0_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0_child0_child0.LayoutY);
+ Assert.AreEqual(500f, root_child0_child0_child0.LayoutWidth);
+ Assert.AreEqual(0f, root_child0_child0_child0.LayoutHeight);
+
+ root.StyleDirection = YogaDirection.RTL;
+ root.CalculateLayout();
+
+ Assert.AreEqual(0f, root.LayoutX);
+ Assert.AreEqual(0f, root.LayoutY);
+ Assert.AreEqual(500f, root.LayoutWidth);
+ Assert.AreEqual(500f, root.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(500f, root_child0.LayoutWidth);
+ Assert.AreEqual(0f, root_child0.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child0_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0_child0.LayoutY);
+ Assert.AreEqual(500f, root_child0_child0.LayoutWidth);
+ Assert.AreEqual(0f, root_child0_child0.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child0_child0_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0_child0_child0.LayoutY);
+ Assert.AreEqual(500f, root_child0_child0_child0.LayoutWidth);
+ Assert.AreEqual(0f, root_child0_child0_child0.LayoutHeight);
+ }
+
+ [Test]
+ public void Test_align_flex_start_with_shrinking_children_with_stretch()
{
YogaConfig config = new YogaConfig();
diff --git a/gentest/fixtures/YGAlignItemsTest.html b/gentest/fixtures/YGAlignItemsTest.html
index d3605cd577..fa043673c2 100644
--- a/gentest/fixtures/YGAlignItemsTest.html
+++ b/gentest/fixtures/YGAlignItemsTest.html
@@ -184,10 +184,26 @@
-
+
+
+
+
+
\ No newline at end of file
diff --git a/java/tests/com/facebook/yoga/YGAlignItemsTest.java b/java/tests/com/facebook/yoga/YGAlignItemsTest.java
index 8a1dfeccfa..b571f13b9e 100644
--- a/java/tests/com/facebook/yoga/YGAlignItemsTest.java
+++ b/java/tests/com/facebook/yoga/YGAlignItemsTest.java
@@ -1933,7 +1933,142 @@ public void test_align_strech_should_size_based_on_parent() {
}
@Test
- public void test_align_flex_start_with_shrinkin_children() {
+ public void test_align_flex_start_with_shrinking_children() {
+ YogaConfig config = new YogaConfig();
+
+ final YogaNode root = new YogaNode(config);
+ root.setWidth(500f);
+ root.setHeight(500f);
+
+ final YogaNode root_child0 = new YogaNode(config);
+ root_child0.setAlignItems(YogaAlign.FLEX_START);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = new YogaNode(config);
+ root_child0_child0.setFlexGrow(1f);
+ root_child0_child0.setFlexShrink(1f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = new YogaNode(config);
+ root_child0_child0_child0.setFlexGrow(1f);
+ root_child0_child0_child0.setFlexShrink(1f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
+ assertEquals(500f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.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(500f, root.getLayoutWidth(), 0.0f);
+ assertEquals(500f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(500f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ public void test_align_flex_start_with_stretching_children() {
+ YogaConfig config = new YogaConfig();
+
+ final YogaNode root = new YogaNode(config);
+ root.setWidth(500f);
+ root.setHeight(500f);
+
+ final YogaNode root_child0 = new YogaNode(config);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = new YogaNode(config);
+ root_child0_child0.setFlexGrow(1f);
+ root_child0_child0.setFlexShrink(1f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = new YogaNode(config);
+ root_child0_child0_child0.setFlexGrow(1f);
+ root_child0_child0_child0.setFlexShrink(1f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
+ assertEquals(500f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.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(500f, root.getLayoutWidth(), 0.0f);
+ assertEquals(500f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ public void test_align_flex_start_with_shrinking_children_with_stretch() {
YogaConfig config = new YogaConfig();
final YogaNode root = new YogaNode(config);
diff --git a/javascript/tests/Facebook.Yoga/YGAlignItemsTest.js b/javascript/tests/Facebook.Yoga/YGAlignItemsTest.js
index 88fce0b9ea..b9c8cc77b7 100644
--- a/javascript/tests/Facebook.Yoga/YGAlignItemsTest.js
+++ b/javascript/tests/Facebook.Yoga/YGAlignItemsTest.js
@@ -2027,7 +2027,150 @@ it("align_strech_should_size_based_on_parent", function () {
config.free();
}
});
-it("align_flex_start_with_shrinkin_children", function () {
+it("align_flex_start_with_shrinking_children", function () {
+ var config = Yoga.Config.create();
+
+ try {
+ var root = Yoga.Node.create(config);
+ root.setWidth(500);
+ root.setHeight(500);
+
+ var root_child0 = Yoga.Node.create(config);
+ root_child0.setAlignItems(Yoga.ALIGN_FLEX_START);
+ root.insertChild(root_child0, 0);
+
+ var root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setFlexGrow(1);
+ root_child0_child0.setFlexShrink(1);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ var root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setFlexGrow(1);
+ root_child0_child0_child0.setFlexShrink(1);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ 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(500 === root.getComputedWidth(), "500 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
+ console.assert(500 === root.getComputedHeight(), "500 === 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(500 === root_child0.getComputedWidth(), "500 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
+ console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
+
+ console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")");
+ console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")");
+ console.assert(0 === root_child0_child0.getComputedWidth(), "0 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")");
+ console.assert(0 === root_child0_child0.getComputedHeight(), "0 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")");
+
+ console.assert(0 === root_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")");
+ console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")");
+ console.assert(0 === root_child0_child0_child0.getComputedWidth(), "0 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")");
+ console.assert(0 === root_child0_child0_child0.getComputedHeight(), "0 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.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(500 === root.getComputedWidth(), "500 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
+ console.assert(500 === root.getComputedHeight(), "500 === 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(500 === root_child0.getComputedWidth(), "500 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
+ console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
+
+ console.assert(500 === root_child0_child0.getComputedLeft(), "500 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")");
+ console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")");
+ console.assert(0 === root_child0_child0.getComputedWidth(), "0 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")");
+ console.assert(0 === root_child0_child0.getComputedHeight(), "0 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")");
+
+ console.assert(0 === root_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")");
+ console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")");
+ console.assert(0 === root_child0_child0_child0.getComputedWidth(), "0 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")");
+ console.assert(0 === root_child0_child0_child0.getComputedHeight(), "0 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")");
+ } finally {
+ if (typeof root !== "undefined") {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+it("align_flex_start_with_stretching_children", function () {
+ var config = Yoga.Config.create();
+
+ try {
+ var root = Yoga.Node.create(config);
+ root.setWidth(500);
+ root.setHeight(500);
+
+ var root_child0 = Yoga.Node.create(config);
+ root.insertChild(root_child0, 0);
+
+ var root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setFlexGrow(1);
+ root_child0_child0.setFlexShrink(1);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ var root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setFlexGrow(1);
+ root_child0_child0_child0.setFlexShrink(1);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ 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(500 === root.getComputedWidth(), "500 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
+ console.assert(500 === root.getComputedHeight(), "500 === 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(500 === root_child0.getComputedWidth(), "500 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
+ console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
+
+ console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")");
+ console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")");
+ console.assert(500 === root_child0_child0.getComputedWidth(), "500 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")");
+ console.assert(0 === root_child0_child0.getComputedHeight(), "0 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")");
+
+ console.assert(0 === root_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")");
+ console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")");
+ console.assert(500 === root_child0_child0_child0.getComputedWidth(), "500 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")");
+ console.assert(0 === root_child0_child0_child0.getComputedHeight(), "0 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.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(500 === root.getComputedWidth(), "500 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
+ console.assert(500 === root.getComputedHeight(), "500 === 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(500 === root_child0.getComputedWidth(), "500 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
+ console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
+
+ console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")");
+ console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")");
+ console.assert(500 === root_child0_child0.getComputedWidth(), "500 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")");
+ console.assert(0 === root_child0_child0.getComputedHeight(), "0 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")");
+
+ console.assert(0 === root_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")");
+ console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")");
+ console.assert(500 === root_child0_child0_child0.getComputedWidth(), "500 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")");
+ console.assert(0 === root_child0_child0_child0.getComputedHeight(), "0 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")");
+ } finally {
+ if (typeof root !== "undefined") {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+it("align_flex_start_with_shrinking_children_with_stretch", function () {
var config = Yoga.Config.create();
try {
diff --git a/tests/YGAlignItemsTest.cpp b/tests/YGAlignItemsTest.cpp
index 3bdc844215..5575c3abe2 100644
--- a/tests/YGAlignItemsTest.cpp
+++ b/tests/YGAlignItemsTest.cpp
@@ -1953,7 +1953,144 @@ TEST(YogaTest, align_strech_should_size_based_on_parent) {
YGConfigFree(config);
}
-TEST(YogaTest, align_flex_start_with_shrinkin_children) {
+TEST(YogaTest, align_flex_start_with_shrinking_children) {
+ const YGConfigRef config = YGConfigNew();
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root, 500);
+ YGNodeStyleSetHeight(root, 500);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetAlignItems(root_child0, YGAlignFlexStart);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexGrow(root_child0_child0, 1);
+ YGNodeStyleSetFlexShrink(root_child0_child0, 1);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexGrow(root_child0_child0_child0, 1);
+ YGNodeStyleSetFlexShrink(root_child0_child0_child0, 1);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, align_flex_start_with_stretching_children) {
+ const YGConfigRef config = YGConfigNew();
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root, 500);
+ YGNodeStyleSetHeight(root, 500);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexGrow(root_child0_child0, 1);
+ YGNodeStyleSetFlexShrink(root_child0_child0, 1);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexGrow(root_child0_child0_child0, 1);
+ YGNodeStyleSetFlexShrink(root_child0_child0_child0, 1);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, align_flex_start_with_shrinking_children_with_stretch) {
const YGConfigRef config = YGConfigNew();
const YGNodeRef root = YGNodeNewWithConfig(config);
diff --git a/tests/YGDefaultValuesTest.cpp b/tests/YGDefaultValuesTest.cpp
index bc2ea2eb9a..ce73068b22 100644
--- a/tests/YGDefaultValuesTest.cpp
+++ b/tests/YGDefaultValuesTest.cpp
@@ -117,3 +117,50 @@ TEST(YogaTest, assert_webdefault_values_reset) {
YGNodeFreeRecursive(root);
YGConfigFree(config);
}
+
+TEST(YogaTest, assert_legacy_stretch_behaviour) {
+ YGConfig *config = YGConfigNew();
+ YGConfigSetUseLegacyStretchBehaviour(config, true);
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root, 500);
+ YGNodeStyleSetHeight(root, 500);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetAlignItems(root_child0, YGAlignFlexStart);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexGrow(root_child0_child0, 1);
+ YGNodeStyleSetFlexShrink(root_child0_child0, 1);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexGrow(root_child0_child0_child0, 1);
+ YGNodeStyleSetFlexShrink(root_child0_child0_child0, 1);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
diff --git a/yoga/Yoga.c b/yoga/Yoga.c
index 26489faace..12046646de 100644
--- a/yoga/Yoga.c
+++ b/yoga/Yoga.c
@@ -2323,7 +2323,7 @@ static void YGNodelayoutImpl(const YGNodeRef node,
// space we've used is all space we need. Root node also should be shrunk to minimum
availableInnerMainDim = sizeConsumedOnCurrentLine;
}
- sizeBasedOnContent = true;
+ sizeBasedOnContent = !node->config->useLegacyStretchBehaviour;
}
}