+
+
+
+
+
+
+
diff --git a/java/tests/com/facebook/yoga/YGGapTest.java b/java/tests/com/facebook/yoga/YGGapTest.java
index 48e6b2f5..b22d5656 100644
--- a/java/tests/com/facebook/yoga/YGGapTest.java
+++ b/java/tests/com/facebook/yoga/YGGapTest.java
@@ -25,7 +25,7 @@ public class YGGapTest {
@Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory;
@Test
- public void test_column_gap_flexable() {
+ public void test_column_gap_flexible() {
YogaConfig config = YogaConfigFactory.create();
final YogaNode root = createNode(config);
@@ -100,7 +100,7 @@ public class YGGapTest {
}
@Test
- public void test_column_gap_inflexbale() {
+ public void test_column_gap_inflexible() {
YogaConfig config = YogaConfigFactory.create();
final YogaNode root = createNode(config);
@@ -168,7 +168,7 @@ public class YGGapTest {
}
@Test
- public void test_column_gap_mixed_flexable() {
+ public void test_column_gap_mixed_flexible() {
YogaConfig config = YogaConfigFactory.create();
final YogaNode root = createNode(config);
@@ -237,6 +237,86 @@ public class YGGapTest {
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
}
+ @Test
+ public void test_column_gap_child_margins() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setFlexDirection(YogaFlexDirection.ROW);
+ root.setWidth(80f);
+ root.setHeight(100f);
+ root.setGap(YogaGutter.COLUMN, 10f);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setFlexGrow(1f);
+ root_child0.setFlexShrink(1f);
+ root_child0.setFlexBasisPercent(0f);
+ root_child0.setMargin(YogaEdge.LEFT, 2f);
+ root_child0.setMargin(YogaEdge.RIGHT, 2f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child1 = createNode(config);
+ root_child1.setFlexGrow(1f);
+ root_child1.setFlexShrink(1f);
+ root_child1.setFlexBasisPercent(0f);
+ root_child1.setMargin(YogaEdge.LEFT, 10f);
+ root_child1.setMargin(YogaEdge.RIGHT, 10f);
+ root.addChildAt(root_child1, 1);
+
+ final YogaNode root_child2 = createNode(config);
+ root_child2.setFlexGrow(1f);
+ root_child2.setFlexShrink(1f);
+ root_child2.setFlexBasisPercent(0f);
+ root_child2.setMargin(YogaEdge.LEFT, 15f);
+ root_child2.setMargin(YogaEdge.RIGHT, 15f);
+ root.addChildAt(root_child2, 2);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(80f, root.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(2f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(2f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(26f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(2f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(63f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(2f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child2.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(80f, root.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(76f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(2f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(52f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(2f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(15f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(2f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
+ }
+
@Test
public void test_column_row_gap_wrapping() {
YogaConfig config = YogaConfigFactory.create();
@@ -1735,6 +1815,160 @@ public class YGGapTest {
assertEquals(0f, root_child5.getLayoutHeight(), 0.0f);
}
+ @Test
+ public void test_row_gap_column_child_margins() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setWidth(100f);
+ root.setHeight(200f);
+ root.setGap(YogaGutter.ROW, 10f);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setFlexGrow(1f);
+ root_child0.setFlexShrink(1f);
+ root_child0.setFlexBasisPercent(0f);
+ root_child0.setMargin(YogaEdge.TOP, 2f);
+ root_child0.setMargin(YogaEdge.BOTTOM, 2f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child1 = createNode(config);
+ root_child1.setFlexGrow(1f);
+ root_child1.setFlexShrink(1f);
+ root_child1.setFlexBasisPercent(0f);
+ root_child1.setMargin(YogaEdge.TOP, 10f);
+ root_child1.setMargin(YogaEdge.BOTTOM, 10f);
+ root.addChildAt(root_child1, 1);
+
+ final YogaNode root_child2 = createNode(config);
+ root_child2.setFlexGrow(1f);
+ root_child2.setFlexShrink(1f);
+ root_child2.setFlexBasisPercent(0f);
+ root_child2.setMargin(YogaEdge.TOP, 15f);
+ root_child2.setMargin(YogaEdge.BOTTOM, 15f);
+ root.addChildAt(root_child2, 2);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(2f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(42f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(66f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(42f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(143f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(42f, root_child2.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(100f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(2f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(42f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(66f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(42f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(143f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(42f, root_child2.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ public void test_row_gap_row_wrap_child_margins() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setFlexDirection(YogaFlexDirection.ROW);
+ root.setWrap(YogaWrap.WRAP);
+ root.setWidth(100f);
+ root.setHeight(200f);
+ root.setGap(YogaGutter.ROW, 10f);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setMargin(YogaEdge.TOP, 2f);
+ root_child0.setMargin(YogaEdge.BOTTOM, 2f);
+ root_child0.setWidth(60f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child1 = createNode(config);
+ root_child1.setMargin(YogaEdge.TOP, 10f);
+ root_child1.setMargin(YogaEdge.BOTTOM, 10f);
+ root_child1.setWidth(60f);
+ root.addChildAt(root_child1, 1);
+
+ final YogaNode root_child2 = createNode(config);
+ root_child2.setMargin(YogaEdge.TOP, 15f);
+ root_child2.setMargin(YogaEdge.BOTTOM, 15f);
+ root_child2.setWidth(60f);
+ root.addChildAt(root_child2, 2);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(2f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(24f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(60f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(59f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(60f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(0f, root_child2.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(100f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(40f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(2f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(40f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(24f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(60f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(40f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(59f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(60f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(0f, root_child2.getLayoutHeight(), 0.0f);
+ }
+
private YogaNode createNode(YogaConfig config) {
return mNodeFactory.create(config);
}
diff --git a/javascript/tests/Facebook.Yoga/YGGapTest.js b/javascript/tests/Facebook.Yoga/YGGapTest.js
index 0b2d4439..07175f74 100644
--- a/javascript/tests/Facebook.Yoga/YGGapTest.js
+++ b/javascript/tests/Facebook.Yoga/YGGapTest.js
@@ -9,7 +9,7 @@
var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY);
-it("column_gap_flexable", function () {
+it("column_gap_flexible", function () {
var config = Yoga.Config.create();
try {
@@ -88,7 +88,7 @@ it("column_gap_flexable", function () {
config.free();
}
});
-it("column_gap_inflexbale", function () {
+it("column_gap_inflexible", function () {
var config = Yoga.Config.create();
try {
@@ -160,7 +160,7 @@ it("column_gap_inflexbale", function () {
config.free();
}
});
-it("column_gap_mixed_flexable", function () {
+it("column_gap_mixed_flexible", function () {
var config = Yoga.Config.create();
try {
@@ -234,6 +234,90 @@ it("column_gap_mixed_flexable", function () {
config.free();
}
});
+it("column_gap_child_margins", function () {
+ var config = Yoga.Config.create();
+
+ try {
+ var root = Yoga.Node.create(config);
+ root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
+ root.setWidth(80);
+ root.setHeight(100);
+ root.setGap(Yoga.GUTTER_COLUMN, 10);
+
+ var root_child0 = Yoga.Node.create(config);
+ root_child0.setFlexGrow(1);
+ root_child0.setFlexShrink(1);
+ root_child0.setFlexBasis("0%");
+ root_child0.setMargin(Yoga.EDGE_LEFT, 2);
+ root_child0.setMargin(Yoga.EDGE_RIGHT, 2);
+ root.insertChild(root_child0, 0);
+
+ var root_child1 = Yoga.Node.create(config);
+ root_child1.setFlexGrow(1);
+ root_child1.setFlexShrink(1);
+ root_child1.setFlexBasis("0%");
+ root_child1.setMargin(Yoga.EDGE_LEFT, 10);
+ root_child1.setMargin(Yoga.EDGE_RIGHT, 10);
+ root.insertChild(root_child1, 1);
+
+ var root_child2 = Yoga.Node.create(config);
+ root_child2.setFlexGrow(1);
+ root_child2.setFlexShrink(1);
+ root_child2.setFlexBasis("0%");
+ root_child2.setMargin(Yoga.EDGE_LEFT, 15);
+ root_child2.setMargin(Yoga.EDGE_RIGHT, 15);
+ root.insertChild(root_child2, 2);
+ 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(80 === root.getComputedWidth(), "80 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
+ console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
+
+ console.assert(2 === root_child0.getComputedLeft(), "2 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
+ console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
+ console.assert(2 === root_child0.getComputedWidth(), "2 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
+ console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
+
+ console.assert(26 === root_child1.getComputedLeft(), "26 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
+ console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
+ console.assert(2 === root_child1.getComputedWidth(), "2 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
+ console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
+
+ console.assert(63 === root_child2.getComputedLeft(), "63 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
+ console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
+ console.assert(2 === root_child2.getComputedWidth(), "2 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
+ console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.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(80 === root.getComputedWidth(), "80 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
+ console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
+
+ console.assert(76 === root_child0.getComputedLeft(), "76 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
+ console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
+ console.assert(2 === root_child0.getComputedWidth(), "2 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
+ console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
+
+ console.assert(52 === root_child1.getComputedLeft(), "52 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
+ console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
+ console.assert(2 === root_child1.getComputedWidth(), "2 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
+ console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
+
+ console.assert(15 === root_child2.getComputedLeft(), "15 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
+ console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
+ console.assert(2 === root_child2.getComputedWidth(), "2 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
+ console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
+ } finally {
+ if (typeof root !== "undefined") {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
it("column_row_gap_wrapping", function () {
var config = Yoga.Config.create();
@@ -1792,3 +1876,165 @@ it("row_gap_align_items_end", function () {
config.free();
}
});
+it("row_gap_column_child_margins", function () {
+ var config = Yoga.Config.create();
+
+ try {
+ var root = Yoga.Node.create(config);
+ root.setWidth(100);
+ root.setHeight(200);
+ root.setGap(Yoga.GUTTER_ROW, 10);
+
+ var root_child0 = Yoga.Node.create(config);
+ root_child0.setFlexGrow(1);
+ root_child0.setFlexShrink(1);
+ root_child0.setFlexBasis("0%");
+ root_child0.setMargin(Yoga.EDGE_TOP, 2);
+ root_child0.setMargin(Yoga.EDGE_BOTTOM, 2);
+ root.insertChild(root_child0, 0);
+
+ var root_child1 = Yoga.Node.create(config);
+ root_child1.setFlexGrow(1);
+ root_child1.setFlexShrink(1);
+ root_child1.setFlexBasis("0%");
+ root_child1.setMargin(Yoga.EDGE_TOP, 10);
+ root_child1.setMargin(Yoga.EDGE_BOTTOM, 10);
+ root.insertChild(root_child1, 1);
+
+ var root_child2 = Yoga.Node.create(config);
+ root_child2.setFlexGrow(1);
+ root_child2.setFlexShrink(1);
+ root_child2.setFlexBasis("0%");
+ root_child2.setMargin(Yoga.EDGE_TOP, 15);
+ root_child2.setMargin(Yoga.EDGE_BOTTOM, 15);
+ root.insertChild(root_child2, 2);
+ 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(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
+ console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
+
+ console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
+ console.assert(2 === root_child0.getComputedTop(), "2 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
+ console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
+ console.assert(42 === root_child0.getComputedHeight(), "42 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
+
+ console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
+ console.assert(66 === root_child1.getComputedTop(), "66 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
+ console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
+ console.assert(42 === root_child1.getComputedHeight(), "42 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
+
+ console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
+ console.assert(143 === root_child2.getComputedTop(), "143 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
+ console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
+ console.assert(42 === root_child2.getComputedHeight(), "42 === root_child2.getComputedHeight() (" + root_child2.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(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
+ console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
+
+ console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
+ console.assert(2 === root_child0.getComputedTop(), "2 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
+ console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
+ console.assert(42 === root_child0.getComputedHeight(), "42 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
+
+ console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
+ console.assert(66 === root_child1.getComputedTop(), "66 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
+ console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
+ console.assert(42 === root_child1.getComputedHeight(), "42 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
+
+ console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
+ console.assert(143 === root_child2.getComputedTop(), "143 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
+ console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
+ console.assert(42 === root_child2.getComputedHeight(), "42 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
+ } finally {
+ if (typeof root !== "undefined") {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+it("row_gap_row_wrap_child_margins", function () {
+ var config = Yoga.Config.create();
+
+ try {
+ var root = Yoga.Node.create(config);
+ root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
+ root.setFlexWrap(Yoga.WRAP_WRAP);
+ root.setWidth(100);
+ root.setHeight(200);
+ root.setGap(Yoga.GUTTER_ROW, 10);
+
+ var root_child0 = Yoga.Node.create(config);
+ root_child0.setMargin(Yoga.EDGE_TOP, 2);
+ root_child0.setMargin(Yoga.EDGE_BOTTOM, 2);
+ root_child0.setWidth(60);
+ root.insertChild(root_child0, 0);
+
+ var root_child1 = Yoga.Node.create(config);
+ root_child1.setMargin(Yoga.EDGE_TOP, 10);
+ root_child1.setMargin(Yoga.EDGE_BOTTOM, 10);
+ root_child1.setWidth(60);
+ root.insertChild(root_child1, 1);
+
+ var root_child2 = Yoga.Node.create(config);
+ root_child2.setMargin(Yoga.EDGE_TOP, 15);
+ root_child2.setMargin(Yoga.EDGE_BOTTOM, 15);
+ root_child2.setWidth(60);
+ root.insertChild(root_child2, 2);
+ 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(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
+ console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
+
+ console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
+ console.assert(2 === root_child0.getComputedTop(), "2 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
+ console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
+ console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
+
+ console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
+ console.assert(24 === root_child1.getComputedTop(), "24 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
+ console.assert(60 === root_child1.getComputedWidth(), "60 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
+ console.assert(0 === root_child1.getComputedHeight(), "0 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
+
+ console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
+ console.assert(59 === root_child2.getComputedTop(), "59 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
+ console.assert(60 === root_child2.getComputedWidth(), "60 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
+ console.assert(0 === root_child2.getComputedHeight(), "0 === root_child2.getComputedHeight() (" + root_child2.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(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
+ console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
+
+ console.assert(40 === root_child0.getComputedLeft(), "40 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
+ console.assert(2 === root_child0.getComputedTop(), "2 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
+ console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
+ console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
+
+ console.assert(40 === root_child1.getComputedLeft(), "40 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
+ console.assert(24 === root_child1.getComputedTop(), "24 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
+ console.assert(60 === root_child1.getComputedWidth(), "60 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
+ console.assert(0 === root_child1.getComputedHeight(), "0 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
+
+ console.assert(40 === root_child2.getComputedLeft(), "40 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
+ console.assert(59 === root_child2.getComputedTop(), "59 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
+ console.assert(60 === root_child2.getComputedWidth(), "60 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
+ console.assert(0 === root_child2.getComputedHeight(), "0 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
+ } finally {
+ if (typeof root !== "undefined") {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
diff --git a/tests/YGGapTest.cpp b/tests/YGGapTest.cpp
index 3faceb38..982721bc 100644
--- a/tests/YGGapTest.cpp
+++ b/tests/YGGapTest.cpp
@@ -11,7 +11,7 @@
#include
#include
-TEST(YogaTest, column_gap_flexable) {
+TEST(YogaTest, column_gap_flexible) {
const YGConfigRef config = YGConfigNew();
const YGNodeRef root = YGNodeNewWithConfig(config);
@@ -87,7 +87,7 @@ TEST(YogaTest, column_gap_flexable) {
YGConfigFree(config);
}
-TEST(YogaTest, column_gap_inflexbale) {
+TEST(YogaTest, column_gap_inflexible) {
const YGConfigRef config = YGConfigNew();
const YGNodeRef root = YGNodeNewWithConfig(config);
@@ -156,7 +156,7 @@ TEST(YogaTest, column_gap_inflexbale) {
YGConfigFree(config);
}
-TEST(YogaTest, column_gap_mixed_flexable) {
+TEST(YogaTest, column_gap_mixed_flexible) {
const YGConfigRef config = YGConfigNew();
const YGNodeRef root = YGNodeNewWithConfig(config);
@@ -227,6 +227,87 @@ TEST(YogaTest, column_gap_mixed_flexable) {
YGConfigFree(config);
}
+TEST(YogaTest, column_gap_child_margins) {
+ const YGConfigRef config = YGConfigNew();
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
+ YGNodeStyleSetWidth(root, 80);
+ YGNodeStyleSetHeight(root, 100);
+ YGNodeStyleSetGap(root, YGGutterColumn, 10);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexGrow(root_child0, 1);
+ YGNodeStyleSetFlexShrink(root_child0, 1);
+ YGNodeStyleSetFlexBasisPercent(root_child0, 0);
+ YGNodeStyleSetMargin(root_child0, YGEdgeLeft, 2);
+ YGNodeStyleSetMargin(root_child0, YGEdgeRight, 2);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexGrow(root_child1, 1);
+ YGNodeStyleSetFlexShrink(root_child1, 1);
+ YGNodeStyleSetFlexBasisPercent(root_child1, 0);
+ YGNodeStyleSetMargin(root_child1, YGEdgeLeft, 10);
+ YGNodeStyleSetMargin(root_child1, YGEdgeRight, 10);
+ YGNodeInsertChild(root, root_child1, 1);
+
+ const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexGrow(root_child2, 1);
+ YGNodeStyleSetFlexShrink(root_child2, 1);
+ YGNodeStyleSetFlexBasisPercent(root_child2, 0);
+ YGNodeStyleSetMargin(root_child2, YGEdgeLeft, 15);
+ YGNodeStyleSetMargin(root_child2, YGEdgeRight, 15);
+ YGNodeInsertChild(root, root_child2, 2);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(80, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(2, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(2, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(26, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(2, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(63, YGNodeLayoutGetLeft(root_child2));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
+ ASSERT_FLOAT_EQ(2, YGNodeLayoutGetWidth(root_child2));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child2));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(80, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(76, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(2, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(52, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(2, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(15, YGNodeLayoutGetLeft(root_child2));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
+ ASSERT_FLOAT_EQ(2, YGNodeLayoutGetWidth(root_child2));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child2));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
TEST(YogaTest, column_row_gap_wrapping) {
const YGConfigRef config = YGConfigNew();
@@ -1739,3 +1820,159 @@ TEST(YogaTest, row_gap_align_items_end) {
YGConfigFree(config);
}
+
+TEST(YogaTest, row_gap_column_child_margins) {
+ const YGConfigRef config = YGConfigNew();
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root, 100);
+ YGNodeStyleSetHeight(root, 200);
+ YGNodeStyleSetGap(root, YGGutterRow, 10);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexGrow(root_child0, 1);
+ YGNodeStyleSetFlexShrink(root_child0, 1);
+ YGNodeStyleSetFlexBasisPercent(root_child0, 0);
+ YGNodeStyleSetMargin(root_child0, YGEdgeTop, 2);
+ YGNodeStyleSetMargin(root_child0, YGEdgeBottom, 2);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexGrow(root_child1, 1);
+ YGNodeStyleSetFlexShrink(root_child1, 1);
+ YGNodeStyleSetFlexBasisPercent(root_child1, 0);
+ YGNodeStyleSetMargin(root_child1, YGEdgeTop, 10);
+ YGNodeStyleSetMargin(root_child1, YGEdgeBottom, 10);
+ YGNodeInsertChild(root, root_child1, 1);
+
+ const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexGrow(root_child2, 1);
+ YGNodeStyleSetFlexShrink(root_child2, 1);
+ YGNodeStyleSetFlexBasisPercent(root_child2, 0);
+ YGNodeStyleSetMargin(root_child2, YGEdgeTop, 15);
+ YGNodeStyleSetMargin(root_child2, YGEdgeBottom, 15);
+ YGNodeInsertChild(root, root_child2, 2);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(2, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(42, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(66, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(42, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
+ ASSERT_FLOAT_EQ(143, YGNodeLayoutGetTop(root_child2));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child2));
+ ASSERT_FLOAT_EQ(42, YGNodeLayoutGetHeight(root_child2));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(2, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(42, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(66, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(42, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
+ ASSERT_FLOAT_EQ(143, YGNodeLayoutGetTop(root_child2));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child2));
+ ASSERT_FLOAT_EQ(42, YGNodeLayoutGetHeight(root_child2));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, row_gap_row_wrap_child_margins) {
+ const YGConfigRef config = YGConfigNew();
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
+ YGNodeStyleSetFlexWrap(root, YGWrapWrap);
+ YGNodeStyleSetWidth(root, 100);
+ YGNodeStyleSetHeight(root, 200);
+ YGNodeStyleSetGap(root, YGGutterRow, 10);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetMargin(root_child0, YGEdgeTop, 2);
+ YGNodeStyleSetMargin(root_child0, YGEdgeBottom, 2);
+ YGNodeStyleSetWidth(root_child0, 60);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetMargin(root_child1, YGEdgeTop, 10);
+ YGNodeStyleSetMargin(root_child1, YGEdgeBottom, 10);
+ YGNodeStyleSetWidth(root_child1, 60);
+ YGNodeInsertChild(root, root_child1, 1);
+
+ const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetMargin(root_child2, YGEdgeTop, 15);
+ YGNodeStyleSetMargin(root_child2, YGEdgeBottom, 15);
+ YGNodeStyleSetWidth(root_child2, 60);
+ YGNodeInsertChild(root, root_child2, 2);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(2, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(60, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(24, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(60, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
+ ASSERT_FLOAT_EQ(59, YGNodeLayoutGetTop(root_child2));
+ ASSERT_FLOAT_EQ(60, YGNodeLayoutGetWidth(root_child2));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child2));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(40, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(2, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(60, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(40, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(24, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(60, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(40, YGNodeLayoutGetLeft(root_child2));
+ ASSERT_FLOAT_EQ(59, YGNodeLayoutGetTop(root_child2));
+ ASSERT_FLOAT_EQ(60, YGNodeLayoutGetWidth(root_child2));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child2));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}