diff --git a/csharp/tests/Facebook.Yoga/YGFlexWrapTest.cs b/csharp/tests/Facebook.Yoga/YGFlexWrapTest.cs
index 877af508..148ffa8b 100644
--- a/csharp/tests/Facebook.Yoga/YGFlexWrapTest.cs
+++ b/csharp/tests/Facebook.Yoga/YGFlexWrapTest.cs
@@ -1643,5 +1643,103 @@ namespace Facebook.Yoga
Assert.AreEqual(40f, root_child0_child1_child0.LayoutHeight);
}
+ [Test]
+ public void Test_wrap_nodes_with_content_sizing_margin_cross()
+ {
+ YogaConfig config = new YogaConfig();
+
+ YogaNode root = new YogaNode(config);
+ root.Width = 500;
+ root.Height = 500;
+
+ YogaNode root_child0 = new YogaNode(config);
+ root_child0.FlexDirection = YogaFlexDirection.Row;
+ root_child0.Wrap = YogaWrap.Wrap;
+ root_child0.Width = 70;
+ root.Insert(0, root_child0);
+
+ YogaNode root_child0_child0 = new YogaNode(config);
+ root_child0.Insert(0, root_child0_child0);
+
+ YogaNode root_child0_child0_child0 = new YogaNode(config);
+ root_child0_child0_child0.Width = 40;
+ root_child0_child0_child0.Height = 40;
+ root_child0_child0.Insert(0, root_child0_child0_child0);
+
+ YogaNode root_child0_child1 = new YogaNode(config);
+ root_child0_child1.MarginTop = 10;
+ root_child0.Insert(1, root_child0_child1);
+
+ YogaNode root_child0_child1_child0 = new YogaNode(config);
+ root_child0_child1_child0.Width = 40;
+ root_child0_child1_child0.Height = 40;
+ root_child0_child1.Insert(0, root_child0_child1_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(70f, root_child0.LayoutWidth);
+ Assert.AreEqual(90f, root_child0.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child0_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0_child0.LayoutY);
+ Assert.AreEqual(40f, root_child0_child0.LayoutWidth);
+ Assert.AreEqual(40f, root_child0_child0.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child0_child0_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0_child0_child0.LayoutY);
+ Assert.AreEqual(40f, root_child0_child0_child0.LayoutWidth);
+ Assert.AreEqual(40f, root_child0_child0_child0.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child0_child1.LayoutX);
+ Assert.AreEqual(50f, root_child0_child1.LayoutY);
+ Assert.AreEqual(40f, root_child0_child1.LayoutWidth);
+ Assert.AreEqual(40f, root_child0_child1.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child0_child1_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0_child1_child0.LayoutY);
+ Assert.AreEqual(40f, root_child0_child1_child0.LayoutWidth);
+ Assert.AreEqual(40f, root_child0_child1_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(430f, root_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0.LayoutY);
+ Assert.AreEqual(70f, root_child0.LayoutWidth);
+ Assert.AreEqual(90f, root_child0.LayoutHeight);
+
+ Assert.AreEqual(30f, root_child0_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0_child0.LayoutY);
+ Assert.AreEqual(40f, root_child0_child0.LayoutWidth);
+ Assert.AreEqual(40f, root_child0_child0.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child0_child0_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0_child0_child0.LayoutY);
+ Assert.AreEqual(40f, root_child0_child0_child0.LayoutWidth);
+ Assert.AreEqual(40f, root_child0_child0_child0.LayoutHeight);
+
+ Assert.AreEqual(30f, root_child0_child1.LayoutX);
+ Assert.AreEqual(50f, root_child0_child1.LayoutY);
+ Assert.AreEqual(40f, root_child0_child1.LayoutWidth);
+ Assert.AreEqual(40f, root_child0_child1.LayoutHeight);
+
+ Assert.AreEqual(0f, root_child0_child1_child0.LayoutX);
+ Assert.AreEqual(0f, root_child0_child1_child0.LayoutY);
+ Assert.AreEqual(40f, root_child0_child1_child0.LayoutWidth);
+ Assert.AreEqual(40f, root_child0_child1_child0.LayoutHeight);
+ }
+
}
}
diff --git a/gentest/fixtures/YGFlexWrapTest.html b/gentest/fixtures/YGFlexWrapTest.html
index 97aa2959..5b0bb42a 100644
--- a/gentest/fixtures/YGFlexWrapTest.html
+++ b/gentest/fixtures/YGFlexWrapTest.html
@@ -136,3 +136,14 @@
+
+
diff --git a/java/tests/com/facebook/yoga/YGFlexWrapTest.java b/java/tests/com/facebook/yoga/YGFlexWrapTest.java
index bb184c69..5b564b9c 100644
--- a/java/tests/com/facebook/yoga/YGFlexWrapTest.java
+++ b/java/tests/com/facebook/yoga/YGFlexWrapTest.java
@@ -1623,4 +1623,101 @@ public class YGFlexWrapTest {
assertEquals(40f, root_child0_child1_child0.getLayoutHeight(), 0.0f);
}
+ @Test
+ public void test_wrap_nodes_with_content_sizing_margin_cross() {
+ 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.setFlexDirection(YogaFlexDirection.ROW);
+ root_child0.setWrap(YogaWrap.WRAP);
+ root_child0.setWidth(70f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = new YogaNode(config);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = new YogaNode(config);
+ root_child0_child0_child0.setWidth(40f);
+ root_child0_child0_child0.setHeight(40f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+
+ final YogaNode root_child0_child1 = new YogaNode(config);
+ root_child0_child1.setMargin(YogaEdge.TOP, 10f);
+ root_child0.addChildAt(root_child0_child1, 1);
+
+ final YogaNode root_child0_child1_child0 = new YogaNode(config);
+ root_child0_child1_child0.setWidth(40f);
+ root_child0_child1_child0.setHeight(40f);
+ root_child0_child1.addChildAt(root_child0_child1_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(70f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(90f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(40f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(40f, 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(40f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(40f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(40f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(40f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child1_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child1_child0.getLayoutY(), 0.0f);
+ assertEquals(40f, root_child0_child1_child0.getLayoutWidth(), 0.0f);
+ assertEquals(40f, root_child0_child1_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(430f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(70f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(90f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(30f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(40f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(40f, 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(40f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(40f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(30f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(40f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(40f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child1_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child1_child0.getLayoutY(), 0.0f);
+ assertEquals(40f, root_child0_child1_child0.getLayoutWidth(), 0.0f);
+ assertEquals(40f, root_child0_child1_child0.getLayoutHeight(), 0.0f);
+ }
+
}
diff --git a/javascript/tests/Facebook.Yoga/YGFlexWrapTest.js b/javascript/tests/Facebook.Yoga/YGFlexWrapTest.js
index add2eb0c..067ba8cc 100644
--- a/javascript/tests/Facebook.Yoga/YGFlexWrapTest.js
+++ b/javascript/tests/Facebook.Yoga/YGFlexWrapTest.js
@@ -1694,3 +1694,104 @@ it("wrap_nodes_with_content_sizing_overflowing_margin", function () {
config.free();
}
});
+it("wrap_nodes_with_content_sizing_margin_cross", 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.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
+ root_child0.setFlexWrap(Yoga.WRAP_WRAP);
+ root_child0.setWidth(70);
+ root.insertChild(root_child0, 0);
+
+ var root_child0_child0 = Yoga.Node.create(config);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ var root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setWidth(40);
+ root_child0_child0_child0.setHeight(40);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+
+ var root_child0_child1 = Yoga.Node.create(config);
+ root_child0_child1.setMargin(Yoga.EDGE_TOP, 10);
+ root_child0.insertChild(root_child0_child1, 1);
+
+ var root_child0_child1_child0 = Yoga.Node.create(config);
+ root_child0_child1_child0.setWidth(40);
+ root_child0_child1_child0.setHeight(40);
+ root_child0_child1.insertChild(root_child0_child1_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(70 === root_child0.getComputedWidth(), "70 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
+ console.assert(90 === root_child0.getComputedHeight(), "90 === 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(40 === root_child0_child0.getComputedWidth(), "40 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")");
+ console.assert(40 === root_child0_child0.getComputedHeight(), "40 === 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(40 === root_child0_child0_child0.getComputedWidth(), "40 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")");
+ console.assert(40 === root_child0_child0_child0.getComputedHeight(), "40 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")");
+
+ console.assert(0 === root_child0_child1.getComputedLeft(), "0 === root_child0_child1.getComputedLeft() (" + root_child0_child1.getComputedLeft() + ")");
+ console.assert(50 === root_child0_child1.getComputedTop(), "50 === root_child0_child1.getComputedTop() (" + root_child0_child1.getComputedTop() + ")");
+ console.assert(40 === root_child0_child1.getComputedWidth(), "40 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")");
+ console.assert(40 === root_child0_child1.getComputedHeight(), "40 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")");
+
+ console.assert(0 === root_child0_child1_child0.getComputedLeft(), "0 === root_child0_child1_child0.getComputedLeft() (" + root_child0_child1_child0.getComputedLeft() + ")");
+ console.assert(0 === root_child0_child1_child0.getComputedTop(), "0 === root_child0_child1_child0.getComputedTop() (" + root_child0_child1_child0.getComputedTop() + ")");
+ console.assert(40 === root_child0_child1_child0.getComputedWidth(), "40 === root_child0_child1_child0.getComputedWidth() (" + root_child0_child1_child0.getComputedWidth() + ")");
+ console.assert(40 === root_child0_child1_child0.getComputedHeight(), "40 === root_child0_child1_child0.getComputedHeight() (" + root_child0_child1_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(430 === root_child0.getComputedLeft(), "430 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
+ console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
+ console.assert(70 === root_child0.getComputedWidth(), "70 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
+ console.assert(90 === root_child0.getComputedHeight(), "90 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
+
+ console.assert(30 === root_child0_child0.getComputedLeft(), "30 === 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(40 === root_child0_child0.getComputedWidth(), "40 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")");
+ console.assert(40 === root_child0_child0.getComputedHeight(), "40 === 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(40 === root_child0_child0_child0.getComputedWidth(), "40 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")");
+ console.assert(40 === root_child0_child0_child0.getComputedHeight(), "40 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")");
+
+ console.assert(30 === root_child0_child1.getComputedLeft(), "30 === root_child0_child1.getComputedLeft() (" + root_child0_child1.getComputedLeft() + ")");
+ console.assert(50 === root_child0_child1.getComputedTop(), "50 === root_child0_child1.getComputedTop() (" + root_child0_child1.getComputedTop() + ")");
+ console.assert(40 === root_child0_child1.getComputedWidth(), "40 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")");
+ console.assert(40 === root_child0_child1.getComputedHeight(), "40 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")");
+
+ console.assert(0 === root_child0_child1_child0.getComputedLeft(), "0 === root_child0_child1_child0.getComputedLeft() (" + root_child0_child1_child0.getComputedLeft() + ")");
+ console.assert(0 === root_child0_child1_child0.getComputedTop(), "0 === root_child0_child1_child0.getComputedTop() (" + root_child0_child1_child0.getComputedTop() + ")");
+ console.assert(40 === root_child0_child1_child0.getComputedWidth(), "40 === root_child0_child1_child0.getComputedWidth() (" + root_child0_child1_child0.getComputedWidth() + ")");
+ console.assert(40 === root_child0_child1_child0.getComputedHeight(), "40 === root_child0_child1_child0.getComputedHeight() (" + root_child0_child1_child0.getComputedHeight() + ")");
+ } finally {
+ if (typeof root !== "undefined") {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
diff --git a/tests/YGFlexWrapTest.cpp b/tests/YGFlexWrapTest.cpp
index 3f950ec5..19782833 100644
--- a/tests/YGFlexWrapTest.cpp
+++ b/tests/YGFlexWrapTest.cpp
@@ -1637,3 +1637,101 @@ TEST(YogaTest, wrap_nodes_with_content_sizing_overflowing_margin) {
YGConfigFree(config);
}
+
+TEST(YogaTest, wrap_nodes_with_content_sizing_margin_cross) {
+ const YGConfigRef config = YGConfigNew();
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root, 500);
+ YGNodeStyleSetHeight(root, 500);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow);
+ YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap);
+ YGNodeStyleSetWidth(root_child0, 70);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child0_child0, 40);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 40);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+
+ const YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetMargin(root_child0_child1, YGEdgeTop, 10);
+ YGNodeInsertChild(root_child0, root_child0_child1, 1);
+
+ const YGNodeRef root_child0_child1_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child1_child0, 40);
+ YGNodeStyleSetHeight(root_child0_child1_child0, 40);
+ YGNodeInsertChild(root_child0_child1, root_child0_child1_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(70, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(90, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(40, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(40, 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(40, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(40, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1_child0));
+ ASSERT_FLOAT_EQ(40, YGNodeLayoutGetWidth(root_child0_child1_child0));
+ ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child0_child1_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(430, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(70, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(90, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(30, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(40, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(40, 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(40, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ ASSERT_FLOAT_EQ(30, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(40, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1_child0));
+ ASSERT_FLOAT_EQ(40, YGNodeLayoutGetWidth(root_child0_child1_child0));
+ ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child0_child1_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
diff --git a/yoga/Yoga.c b/yoga/Yoga.c
index 5fc7610e..a7dd3f78 100644
--- a/yoga/Yoga.c
+++ b/yoga/Yoga.c
@@ -2937,7 +2937,7 @@ static void YGNodelayoutImpl(const YGNodeRef node,
if (!YGNodeIsStyleDimDefined(child, crossAxis, availableInnerCrossDim)) {
const float childWidth =
isMainAxisRow ? (child->layout.measuredDimensions[YGDimensionWidth] +
- YGNodeMarginForAxis(child, crossAxis, availableInnerWidth))
+ YGNodeMarginForAxis(child, mainAxis, availableInnerWidth))
: lineHeight;
const float childHeight =