From 8a901baab071e2a03df1ff22f4c8ff87bf5f1bbc Mon Sep 17 00:00:00 2001 From: Joe Vilches Date: Wed, 20 Nov 2024 17:41:11 -0800 Subject: [PATCH] Surround some intrinsic sizing tests in non-relative container Summary: Some of these were specified as relative but that makes the `top` value of layout incorrect. Surrounding in a div which is absolute so they all layout in the top left. Differential Revision: D66275587 --- gentest/fixtures/YGIntrinsicSizeTest.html | 265 +-- .../facebook/yoga/YGIntrinsicSizeTest.java | 1539 +++++++++------- .../generated/YGIntrinsicSizeTest.test.ts | 1540 ++++++++++------- tests/generated/YGIntrinsicSizeTest.cpp | 1496 +++++++++------- 4 files changed, 2775 insertions(+), 2065 deletions(-) diff --git a/gentest/fixtures/YGIntrinsicSizeTest.html b/gentest/fixtures/YGIntrinsicSizeTest.html index 587b1b8506..40859d3739 100644 --- a/gentest/fixtures/YGIntrinsicSizeTest.html +++ b/gentest/fixtures/YGIntrinsicSizeTest.html @@ -229,24 +229,28 @@ -
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
@@ -260,24 +264,28 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
@@ -291,29 +299,34 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+
@@ -322,29 +335,34 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+
@@ -353,29 +371,34 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+
@@ -384,24 +407,28 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
@@ -415,24 +442,28 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
@@ -446,24 +477,28 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/java/tests/generated/com/facebook/yoga/YGIntrinsicSizeTest.java b/java/tests/generated/com/facebook/yoga/YGIntrinsicSizeTest.java index 7ff0d0f096..aedbe88b60 100644 --- a/java/tests/generated/com/facebook/yoga/YGIntrinsicSizeTest.java +++ b/java/tests/generated/com/facebook/yoga/YGIntrinsicSizeTest.java @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<1610045e3d68262896d841906a8fe1a7>> + * @generated SignedSource<<5db36093f3123b75b40f7a4084fb099f>> * generated by gentest/gentest-driver.ts from gentest/fixtures/YGIntrinsicSizeTest.html */ @@ -576,28 +576,32 @@ public void test_fit_content_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); - root.setWidth(90f); + root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); - root_child0.setFlexDirection(YogaFlexDirection.ROW); - root_child0.setWrap(YogaWrap.WRAP); - root_child0.setWidthFitContent(); + root_child0.setWidth(90f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); - root_child0_child0.setWidth(50f); - root_child0_child0.setHeight(50f); + root_child0_child0.setFlexDirection(YogaFlexDirection.ROW); + root_child0_child0.setWrap(YogaWrap.WRAP); + root_child0_child0.setWidthFitContent(); root_child0.addChildAt(root_child0_child0, 0); - final YogaNode root_child0_child1 = createNode(config); - root_child0_child1.setWidth(100f); - root_child0_child1.setHeight(50f); - root_child0.addChildAt(root_child0_child1, 1); + final YogaNode root_child0_child0_child0 = createNode(config); + root_child0_child0_child0.setWidth(50f); + root_child0_child0_child0.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child0, 0); - final YogaNode root_child0_child2 = createNode(config); - root_child0_child2.setWidth(25f); - root_child0_child2.setHeight(50f); - root_child0.addChildAt(root_child0_child2, 2); + final YogaNode root_child0_child0_child1 = createNode(config); + root_child0_child0_child1.setWidth(100f); + root_child0_child0_child1.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child1, 1); + + final YogaNode root_child0_child0_child2 = createNode(config); + root_child0_child0_child2.setWidth(25f); + root_child0_child0_child2.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child2, 2); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); @@ -608,23 +612,28 @@ public void test_fit_content_width() { assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); - assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(90f, root_child0.getLayoutWidth(), 0.0f); assertEquals(150f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); + assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(150f, 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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); + assertEquals(0f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutHeight(), 0.0f); - assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(0f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(100f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); @@ -634,25 +643,30 @@ public void test_fit_content_width() { assertEquals(90f, root.getLayoutWidth(), 0.0f); assertEquals(150f, root.getLayoutHeight(), 0.0f); - assertEquals(-10f, root_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); - assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(90f, root_child0.getLayoutWidth(), 0.0f); assertEquals(150f, root_child0.getLayoutHeight(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(-10f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); - - assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); - - assertEquals(75f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(150f, root_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutHeight(), 0.0f); + + assertEquals(75f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(100f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutHeight(), 0.0f); } @Test @@ -661,33 +675,37 @@ public void test_stretch_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); - root.setWidth(500f); + root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); - root_child0.setFlexDirection(YogaFlexDirection.ROW); - root_child0.setWrap(YogaWrap.WRAP); - root_child0.setWidthStretch(); + root_child0.setWidth(500f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); - root_child0_child0.setWidth(50f); - root_child0_child0.setHeight(50f); + root_child0_child0.setFlexDirection(YogaFlexDirection.ROW); + root_child0_child0.setWrap(YogaWrap.WRAP); + root_child0_child0.setWidthStretch(); root_child0.addChildAt(root_child0_child0, 0); - final YogaNode root_child0_child1 = createNode(config); - root_child0_child1.setWidth(100f); - root_child0_child1.setHeight(50f); - root_child0.addChildAt(root_child0_child1, 1); + final YogaNode root_child0_child0_child0 = createNode(config); + root_child0_child0_child0.setWidth(50f); + root_child0_child0_child0.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child0, 0); - final YogaNode root_child0_child2 = createNode(config); - root_child0_child2.setWidth(25f); - root_child0_child2.setHeight(50f); - root_child0.addChildAt(root_child0_child2, 2); + final YogaNode root_child0_child0_child1 = createNode(config); + root_child0_child0_child1.setWidth(100f); + root_child0_child0_child1.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child1, 1); + + final YogaNode root_child0_child0_child2 = createNode(config); + root_child0_child0_child2.setWidth(25f); + root_child0_child0_child2.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child2, 2); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(150f, root.getLayoutY(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(500f, root.getLayoutWidth(), 0.0f); assertEquals(50f, root.getLayoutHeight(), 0.0f); @@ -698,24 +716,29 @@ public void test_stretch_width() { assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(500f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); + assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(150f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutHeight(), 0.0f); + + assertEquals(150f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(150f, root.getLayoutY(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(500f, root.getLayoutWidth(), 0.0f); assertEquals(50f, root.getLayoutHeight(), 0.0f); @@ -724,20 +747,25 @@ public void test_stretch_width() { assertEquals(500f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); - assertEquals(450f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(500f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(350f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); + assertEquals(450f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(325f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(350f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutHeight(), 0.0f); + + assertEquals(325f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutHeight(), 0.0f); } @Test @@ -816,82 +844,96 @@ public void test_fit_content_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); - root.setHeight(90f); + root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); - root_child0.setWrap(YogaWrap.WRAP); - root_child0.setHeightFitContent(); + root_child0.setHeight(90f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); - root_child0_child0.setWidth(50f); - root_child0_child0.setHeight(50f); + root_child0_child0.setWrap(YogaWrap.WRAP); + root_child0_child0.setHeightFitContent(); root_child0.addChildAt(root_child0_child0, 0); - final YogaNode root_child0_child1 = createNode(config); - root_child0_child1.setWidth(50f); - root_child0_child1.setHeight(100f); - root_child0.addChildAt(root_child0_child1, 1); + final YogaNode root_child0_child0_child0 = createNode(config); + root_child0_child0_child0.setWidth(50f); + root_child0_child0_child0.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child0, 0); + + final YogaNode root_child0_child0_child1 = createNode(config); + root_child0_child0_child1.setWidth(50f); + root_child0_child0_child1.setHeight(100f); + root_child0_child0.addChildAt(root_child0_child0_child1, 1); - final YogaNode root_child0_child2 = createNode(config); - root_child0_child2.setWidth(50f); - root_child0_child2.setHeight(25f); - root_child0.addChildAt(root_child0_child2, 2); + final YogaNode root_child0_child0_child2 = createNode(config); + root_child0_child0_child2.setWidth(50f); + root_child0_child0_child2.setHeight(25f); + root_child0_child0.addChildAt(root_child0_child0_child2, 2); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(200f, root.getLayoutY(), 0.0f); - assertEquals(500f, root.getLayoutWidth(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(50f, root.getLayoutWidth(), 0.0f); assertEquals(90f, 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(175f, root_child0.getLayoutHeight(), 0.0f); + assertEquals(50f, 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(50f, root_child0_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); + assertEquals(175f, root_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); + assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(0f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(150f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(200f, root.getLayoutY(), 0.0f); - assertEquals(500f, root.getLayoutWidth(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(50f, root.getLayoutWidth(), 0.0f); assertEquals(90f, 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(175f, root_child0.getLayoutHeight(), 0.0f); + assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(90f, root_child0.getLayoutHeight(), 0.0f); - assertEquals(450f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); - - assertEquals(450f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); - - assertEquals(450f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(175f, 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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(150f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutHeight(), 0.0f); } @Test @@ -900,82 +942,96 @@ public void test_stretch_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); - root.setHeight(500f); + root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); - root_child0.setWrap(YogaWrap.WRAP); - root_child0.setHeightStretch(); + root_child0.setHeight(500f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); - root_child0_child0.setWidth(50f); - root_child0_child0.setHeight(50f); + root_child0_child0.setWrap(YogaWrap.WRAP); + root_child0_child0.setHeightStretch(); root_child0.addChildAt(root_child0_child0, 0); - final YogaNode root_child0_child1 = createNode(config); - root_child0_child1.setWidth(50f); - root_child0_child1.setHeight(100f); - root_child0.addChildAt(root_child0_child1, 1); + final YogaNode root_child0_child0_child0 = createNode(config); + root_child0_child0_child0.setWidth(50f); + root_child0_child0_child0.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child0, 0); - final YogaNode root_child0_child2 = createNode(config); - root_child0_child2.setWidth(50f); - root_child0_child2.setHeight(25f); - root_child0.addChildAt(root_child0_child2, 2); + final YogaNode root_child0_child0_child1 = createNode(config); + root_child0_child0_child1.setWidth(50f); + root_child0_child0_child1.setHeight(100f); + root_child0_child0.addChildAt(root_child0_child0_child1, 1); + + final YogaNode root_child0_child0_child2 = createNode(config); + root_child0_child0_child2.setWidth(50f); + root_child0_child0_child2.setHeight(25f); + root_child0_child0.addChildAt(root_child0_child0_child2, 2); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(290f, root.getLayoutY(), 0.0f); - assertEquals(500f, root.getLayoutWidth(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(50f, 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(175f, root_child0.getLayoutHeight(), 0.0f); + assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); + assertEquals(175f, 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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); + assertEquals(0f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutHeight(), 0.0f); - assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(0f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(150f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(290f, root.getLayoutY(), 0.0f); - assertEquals(500f, root.getLayoutWidth(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(50f, 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(175f, root_child0.getLayoutHeight(), 0.0f); + assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); - assertEquals(450f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); - - assertEquals(450f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); - - assertEquals(450f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(175f, 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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(150f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutHeight(), 0.0f); } @Test @@ -1054,82 +1110,96 @@ public void test_fit_content_flex_basis_column() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); - root.setHeight(90f); + root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); - root_child0.setWrap(YogaWrap.WRAP); - root_child0.setFlexBasisFitContent(); + root_child0.setHeight(90f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); - root_child0_child0.setWidth(50f); - root_child0_child0.setHeight(50f); + root_child0_child0.setWrap(YogaWrap.WRAP); + root_child0_child0.setFlexBasisFitContent(); root_child0.addChildAt(root_child0_child0, 0); - final YogaNode root_child0_child1 = createNode(config); - root_child0_child1.setWidth(50f); - root_child0_child1.setHeight(100f); - root_child0.addChildAt(root_child0_child1, 1); + final YogaNode root_child0_child0_child0 = createNode(config); + root_child0_child0_child0.setWidth(50f); + root_child0_child0_child0.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child0, 0); - final YogaNode root_child0_child2 = createNode(config); - root_child0_child2.setWidth(50f); - root_child0_child2.setHeight(25f); - root_child0.addChildAt(root_child0_child2, 2); + final YogaNode root_child0_child0_child1 = createNode(config); + root_child0_child0_child1.setWidth(50f); + root_child0_child0_child1.setHeight(100f); + root_child0_child0.addChildAt(root_child0_child0_child1, 1); + + final YogaNode root_child0_child0_child2 = createNode(config); + root_child0_child0_child2.setWidth(50f); + root_child0_child0_child2.setHeight(25f); + root_child0_child0.addChildAt(root_child0_child0_child2, 2); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(790f, root.getLayoutY(), 0.0f); - assertEquals(500f, root.getLayoutWidth(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(50f, root.getLayoutWidth(), 0.0f); assertEquals(90f, 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(175f, root_child0.getLayoutHeight(), 0.0f); + assertEquals(50f, 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(50f, root_child0_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); + assertEquals(175f, root_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); + assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(0f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(150f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(790f, root.getLayoutY(), 0.0f); - assertEquals(500f, root.getLayoutWidth(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(50f, root.getLayoutWidth(), 0.0f); assertEquals(90f, 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(175f, root_child0.getLayoutHeight(), 0.0f); + assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(90f, root_child0.getLayoutHeight(), 0.0f); - assertEquals(450f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); - - assertEquals(450f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); - - assertEquals(450f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(175f, 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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(150f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutHeight(), 0.0f); } @Test @@ -1138,84 +1208,99 @@ public void test_stretch_flex_basis_column() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); - root.setHeight(500f); + root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); - root_child0.setWrap(YogaWrap.WRAP); + root_child0.setHeight(500f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); - root_child0_child0.setWidth(50f); - root_child0_child0.setHeight(50f); + root_child0_child0.setWrap(YogaWrap.WRAP); root_child0.addChildAt(root_child0_child0, 0); - final YogaNode root_child0_child1 = createNode(config); - root_child0_child1.setWidth(50f); - root_child0_child1.setHeight(100f); - root_child0.addChildAt(root_child0_child1, 1); + final YogaNode root_child0_child0_child0 = createNode(config); + root_child0_child0_child0.setWidth(50f); + root_child0_child0_child0.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child0, 0); + + final YogaNode root_child0_child0_child1 = createNode(config); + root_child0_child0_child1.setWidth(50f); + root_child0_child0_child1.setHeight(100f); + root_child0_child0.addChildAt(root_child0_child0_child1, 1); - final YogaNode root_child0_child2 = createNode(config); - root_child0_child2.setWidth(50f); - root_child0_child2.setHeight(25f); - root_child0.addChildAt(root_child0_child2, 2); + final YogaNode root_child0_child0_child2 = createNode(config); + root_child0_child0_child2.setWidth(50f); + root_child0_child0_child2.setHeight(25f); + root_child0_child0.addChildAt(root_child0_child0_child2, 2); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(880f, root.getLayoutY(), 0.0f); - assertEquals(500f, root.getLayoutWidth(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(50f, 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(175f, root_child0.getLayoutHeight(), 0.0f); + assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); + assertEquals(175f, 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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); + assertEquals(0f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutHeight(), 0.0f); - assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(0f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(150f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(880f, root.getLayoutY(), 0.0f); - assertEquals(500f, root.getLayoutWidth(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(50f, 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(175f, root_child0.getLayoutHeight(), 0.0f); + assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); - assertEquals(450f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); - - assertEquals(450f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); - - assertEquals(450f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(175f, 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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(150f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutHeight(), 0.0f); } @Test + @Ignore public void test_max_content_flex_basis_row() { YogaConfig config = YogaConfigFactory.create(); @@ -1244,21 +1329,21 @@ public void test_max_content_flex_basis_row() { assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); - assertEquals(175f, root.getLayoutWidth(), 0.0f); - assertEquals(500f, root.getLayoutHeight(), 0.0f); + assertEquals(100f, root.getLayoutWidth(), 0.0f); + assertEquals(600f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); - assertEquals(50f, root_child1.getLayoutX(), 0.0f); - assertEquals(0f, root_child1.getLayoutY(), 0.0f); + assertEquals(0f, root_child1.getLayoutX(), 0.0f); + assertEquals(50f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(500f, root_child1.getLayoutHeight(), 0.0f); - assertEquals(150f, root_child2.getLayoutX(), 0.0f); - assertEquals(0f, root_child2.getLayoutY(), 0.0f); + assertEquals(0f, root_child2.getLayoutX(), 0.0f); + assertEquals(550f, root_child2.getLayoutY(), 0.0f); assertEquals(25f, root_child2.getLayoutWidth(), 0.0f); assertEquals(50f, root_child2.getLayoutHeight(), 0.0f); @@ -1267,21 +1352,21 @@ public void test_max_content_flex_basis_row() { assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); - assertEquals(175f, root.getLayoutWidth(), 0.0f); - assertEquals(500f, root.getLayoutHeight(), 0.0f); + assertEquals(100f, root.getLayoutWidth(), 0.0f); + assertEquals(600f, root.getLayoutHeight(), 0.0f); - assertEquals(125f, root_child0.getLayoutX(), 0.0f); + assertEquals(50f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); - assertEquals(25f, root_child1.getLayoutX(), 0.0f); - assertEquals(0f, root_child1.getLayoutY(), 0.0f); + assertEquals(0f, root_child1.getLayoutX(), 0.0f); + assertEquals(50f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(500f, root_child1.getLayoutHeight(), 0.0f); - assertEquals(0f, root_child2.getLayoutX(), 0.0f); - assertEquals(0f, root_child2.getLayoutY(), 0.0f); + assertEquals(75f, root_child2.getLayoutX(), 0.0f); + assertEquals(550f, root_child2.getLayoutY(), 0.0f); assertEquals(25f, root_child2.getLayoutWidth(), 0.0f); assertEquals(50f, root_child2.getLayoutHeight(), 0.0f); } @@ -1292,33 +1377,37 @@ public void test_fit_content_flex_basis_row() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); - root.setWidth(90f); + root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); - root_child0.setFlexDirection(YogaFlexDirection.ROW); - root_child0.setWrap(YogaWrap.WRAP); - root_child0.setFlexBasisFitContent(); + root_child0.setWidth(90f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); - root_child0_child0.setWidth(50f); - root_child0_child0.setHeight(50f); + root_child0_child0.setFlexDirection(YogaFlexDirection.ROW); + root_child0_child0.setWrap(YogaWrap.WRAP); + root_child0_child0.setFlexBasisFitContent(); root_child0.addChildAt(root_child0_child0, 0); - final YogaNode root_child0_child1 = createNode(config); - root_child0_child1.setWidth(100f); - root_child0_child1.setHeight(50f); - root_child0.addChildAt(root_child0_child1, 1); + final YogaNode root_child0_child0_child0 = createNode(config); + root_child0_child0_child0.setWidth(50f); + root_child0_child0_child0.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child0, 0); + + final YogaNode root_child0_child0_child1 = createNode(config); + root_child0_child0_child1.setWidth(100f); + root_child0_child0_child1.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child1, 1); - final YogaNode root_child0_child2 = createNode(config); - root_child0_child2.setWidth(25f); - root_child0_child2.setHeight(50f); - root_child0.addChildAt(root_child0_child2, 2); + final YogaNode root_child0_child0_child2 = createNode(config); + root_child0_child0_child2.setWidth(25f); + root_child0_child0_child2.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child2, 2); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(1380f, root.getLayoutY(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(90f, root.getLayoutWidth(), 0.0f); assertEquals(150f, root.getLayoutHeight(), 0.0f); @@ -1329,24 +1418,29 @@ public void test_fit_content_flex_basis_row() { assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); + assertEquals(90f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(150f, 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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); + assertEquals(0f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutHeight(), 0.0f); - assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(0f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(100f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(1380f, root.getLayoutY(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(90f, root.getLayoutWidth(), 0.0f); assertEquals(150f, root.getLayoutHeight(), 0.0f); @@ -1355,20 +1449,25 @@ public void test_fit_content_flex_basis_row() { assertEquals(90f, root_child0.getLayoutWidth(), 0.0f); assertEquals(150f, root_child0.getLayoutHeight(), 0.0f); - assertEquals(40f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); - - assertEquals(-10f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); - - assertEquals(65f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(90f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(150f, root_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(40f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(-10f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutHeight(), 0.0f); + + assertEquals(65f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(100f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutHeight(), 0.0f); } @Test @@ -1377,32 +1476,36 @@ public void test_stretch_flex_basis_row() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); - root.setWidth(500f); + root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); - root_child0.setFlexDirection(YogaFlexDirection.ROW); - root_child0.setWrap(YogaWrap.WRAP); + root_child0.setWidth(500f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); - root_child0_child0.setWidth(50f); - root_child0_child0.setHeight(50f); + root_child0_child0.setFlexDirection(YogaFlexDirection.ROW); + root_child0_child0.setWrap(YogaWrap.WRAP); root_child0.addChildAt(root_child0_child0, 0); - final YogaNode root_child0_child1 = createNode(config); - root_child0_child1.setWidth(100f); - root_child0_child1.setHeight(50f); - root_child0.addChildAt(root_child0_child1, 1); + final YogaNode root_child0_child0_child0 = createNode(config); + root_child0_child0_child0.setWidth(50f); + root_child0_child0_child0.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child0, 0); - final YogaNode root_child0_child2 = createNode(config); - root_child0_child2.setWidth(25f); - root_child0_child2.setHeight(50f); - root_child0.addChildAt(root_child0_child2, 2); + final YogaNode root_child0_child0_child1 = createNode(config); + root_child0_child0_child1.setWidth(100f); + root_child0_child0_child1.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child1, 1); + + final YogaNode root_child0_child0_child2 = createNode(config); + root_child0_child0_child2.setWidth(25f); + root_child0_child0_child2.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child2, 2); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(1530f, root.getLayoutY(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(500f, root.getLayoutWidth(), 0.0f); assertEquals(50f, root.getLayoutHeight(), 0.0f); @@ -1413,24 +1516,29 @@ public void test_stretch_flex_basis_row() { assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(500f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); + assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(50f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutHeight(), 0.0f); - assertEquals(150f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(150f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(1530f, root.getLayoutY(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(500f, root.getLayoutWidth(), 0.0f); assertEquals(50f, root.getLayoutHeight(), 0.0f); @@ -1439,20 +1547,25 @@ public void test_stretch_flex_basis_row() { assertEquals(500f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); - assertEquals(450f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(500f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(350f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); + assertEquals(450f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(325f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(350f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutHeight(), 0.0f); + + assertEquals(325f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutHeight(), 0.0f); } @Test @@ -1534,84 +1647,98 @@ public void test_fit_content_max_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); - root.setWidth(90f); + root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); - root_child0.setFlexDirection(YogaFlexDirection.ROW); - root_child0.setWrap(YogaWrap.WRAP); - root_child0.setWidth(110f); - root_child0.setMaxWidthFitContent(); + root_child0.setWidth(90f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); - root_child0_child0.setWidth(50f); - root_child0_child0.setHeight(50f); + root_child0_child0.setFlexDirection(YogaFlexDirection.ROW); + root_child0_child0.setWrap(YogaWrap.WRAP); + root_child0_child0.setWidth(110f); + root_child0_child0.setMaxWidthFitContent(); root_child0.addChildAt(root_child0_child0, 0); - final YogaNode root_child0_child1 = createNode(config); - root_child0_child1.setWidth(100f); - root_child0_child1.setHeight(50f); - root_child0.addChildAt(root_child0_child1, 1); + final YogaNode root_child0_child0_child0 = createNode(config); + root_child0_child0_child0.setWidth(50f); + root_child0_child0_child0.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child0, 0); - final YogaNode root_child0_child2 = createNode(config); - root_child0_child2.setWidth(25f); - root_child0_child2.setHeight(50f); - root_child0.addChildAt(root_child0_child2, 2); + final YogaNode root_child0_child0_child1 = createNode(config); + root_child0_child0_child1.setWidth(100f); + root_child0_child0_child1.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child1, 1); + + final YogaNode root_child0_child0_child2 = createNode(config); + root_child0_child0_child2.setWidth(25f); + root_child0_child0_child2.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child2, 2); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(1580f, root.getLayoutY(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(90f, root.getLayoutWidth(), 0.0f); assertEquals(150f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); - assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(90f, root_child0.getLayoutWidth(), 0.0f); assertEquals(150f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); + assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(150f, root_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); + assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(0f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(100f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(1580f, root.getLayoutY(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(90f, root.getLayoutWidth(), 0.0f); assertEquals(150f, root.getLayoutHeight(), 0.0f); - assertEquals(-10f, root_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); - assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(90f, root_child0.getLayoutWidth(), 0.0f); assertEquals(150f, root_child0.getLayoutHeight(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(-10f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); - - assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); - - assertEquals(75f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(150f, root_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutHeight(), 0.0f); + + assertEquals(75f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(100f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutHeight(), 0.0f); } @Test @@ -1620,34 +1747,38 @@ public void test_stretch_max_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); - root.setWidth(500f); + root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); - root_child0.setFlexDirection(YogaFlexDirection.ROW); - root_child0.setWrap(YogaWrap.WRAP); - root_child0.setWidth(600f); - root_child0.setMaxWidthStretch(); + root_child0.setWidth(500f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); - root_child0_child0.setWidth(50f); - root_child0_child0.setHeight(50f); + root_child0_child0.setFlexDirection(YogaFlexDirection.ROW); + root_child0_child0.setWrap(YogaWrap.WRAP); + root_child0_child0.setWidth(600f); + root_child0_child0.setMaxWidthStretch(); root_child0.addChildAt(root_child0_child0, 0); - final YogaNode root_child0_child1 = createNode(config); - root_child0_child1.setWidth(100f); - root_child0_child1.setHeight(50f); - root_child0.addChildAt(root_child0_child1, 1); + final YogaNode root_child0_child0_child0 = createNode(config); + root_child0_child0_child0.setWidth(50f); + root_child0_child0_child0.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child0, 0); - final YogaNode root_child0_child2 = createNode(config); - root_child0_child2.setWidth(25f); - root_child0_child2.setHeight(50f); - root_child0.addChildAt(root_child0_child2, 2); + final YogaNode root_child0_child0_child1 = createNode(config); + root_child0_child0_child1.setWidth(100f); + root_child0_child0_child1.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child1, 1); + + final YogaNode root_child0_child0_child2 = createNode(config); + root_child0_child0_child2.setWidth(25f); + root_child0_child0_child2.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child2, 2); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(1730f, root.getLayoutY(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(500f, root.getLayoutWidth(), 0.0f); assertEquals(50f, root.getLayoutHeight(), 0.0f); @@ -1658,24 +1789,29 @@ public void test_stretch_max_width() { assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(500f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); + assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(50f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutHeight(), 0.0f); - assertEquals(150f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(150f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(1730f, root.getLayoutY(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(500f, root.getLayoutWidth(), 0.0f); assertEquals(50f, root.getLayoutHeight(), 0.0f); @@ -1684,20 +1820,25 @@ public void test_stretch_max_width() { assertEquals(500f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); - assertEquals(450f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(500f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(350f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); + assertEquals(450f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(350f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutHeight(), 0.0f); - assertEquals(325f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(325f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutHeight(), 0.0f); } @Test @@ -1779,84 +1920,98 @@ public void test_fit_content_min_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); - root.setWidth(90f); + root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); - root_child0.setFlexDirection(YogaFlexDirection.ROW); - root_child0.setWrap(YogaWrap.WRAP); root_child0.setWidth(90f); - root_child0.setMinWidthFitContent(); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); - root_child0_child0.setWidth(50f); - root_child0_child0.setHeight(50f); + root_child0_child0.setFlexDirection(YogaFlexDirection.ROW); + root_child0_child0.setWrap(YogaWrap.WRAP); + root_child0_child0.setWidth(90f); + root_child0_child0.setMinWidthFitContent(); root_child0.addChildAt(root_child0_child0, 0); - final YogaNode root_child0_child1 = createNode(config); - root_child0_child1.setWidth(100f); - root_child0_child1.setHeight(50f); - root_child0.addChildAt(root_child0_child1, 1); + final YogaNode root_child0_child0_child0 = createNode(config); + root_child0_child0_child0.setWidth(50f); + root_child0_child0_child0.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child0, 0); + + final YogaNode root_child0_child0_child1 = createNode(config); + root_child0_child0_child1.setWidth(100f); + root_child0_child0_child1.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child1, 1); - final YogaNode root_child0_child2 = createNode(config); - root_child0_child2.setWidth(25f); - root_child0_child2.setHeight(50f); - root_child0.addChildAt(root_child0_child2, 2); + final YogaNode root_child0_child0_child2 = createNode(config); + root_child0_child0_child2.setWidth(25f); + root_child0_child0_child2.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child2, 2); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(1780f, root.getLayoutY(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(90f, root.getLayoutWidth(), 0.0f); assertEquals(150f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); - assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(90f, root_child0.getLayoutWidth(), 0.0f); assertEquals(150f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); + assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(150f, 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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); + assertEquals(0f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutHeight(), 0.0f); - assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(0f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(100f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(1780f, root.getLayoutY(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(90f, root.getLayoutWidth(), 0.0f); assertEquals(150f, root.getLayoutHeight(), 0.0f); - assertEquals(-10f, root_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); - assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(90f, root_child0.getLayoutWidth(), 0.0f); assertEquals(150f, root_child0.getLayoutHeight(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(-10f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); - - assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); - - assertEquals(75f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(150f, root_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutHeight(), 0.0f); + + assertEquals(75f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(100f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutHeight(), 0.0f); } @Test @@ -1865,34 +2020,38 @@ public void test_stretch_min_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); - root.setWidth(500f); + root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); - root_child0.setFlexDirection(YogaFlexDirection.ROW); - root_child0.setWrap(YogaWrap.WRAP); - root_child0.setWidth(400f); - root_child0.setMinWidthStretch(); + root_child0.setWidth(500f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); - root_child0_child0.setWidth(50f); - root_child0_child0.setHeight(50f); + root_child0_child0.setFlexDirection(YogaFlexDirection.ROW); + root_child0_child0.setWrap(YogaWrap.WRAP); + root_child0_child0.setWidth(400f); + root_child0_child0.setMinWidthStretch(); root_child0.addChildAt(root_child0_child0, 0); - final YogaNode root_child0_child1 = createNode(config); - root_child0_child1.setWidth(100f); - root_child0_child1.setHeight(50f); - root_child0.addChildAt(root_child0_child1, 1); + final YogaNode root_child0_child0_child0 = createNode(config); + root_child0_child0_child0.setWidth(50f); + root_child0_child0_child0.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child0, 0); + + final YogaNode root_child0_child0_child1 = createNode(config); + root_child0_child0_child1.setWidth(100f); + root_child0_child0_child1.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child1, 1); - final YogaNode root_child0_child2 = createNode(config); - root_child0_child2.setWidth(25f); - root_child0_child2.setHeight(50f); - root_child0.addChildAt(root_child0_child2, 2); + final YogaNode root_child0_child0_child2 = createNode(config); + root_child0_child0_child2.setWidth(25f); + root_child0_child0_child2.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child2, 2); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(1930f, root.getLayoutY(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(500f, root.getLayoutWidth(), 0.0f); assertEquals(50f, root.getLayoutHeight(), 0.0f); @@ -1903,24 +2062,29 @@ public void test_stretch_min_width() { assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(500f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); + assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(150f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutHeight(), 0.0f); + + assertEquals(150f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(1930f, root.getLayoutY(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(500f, root.getLayoutWidth(), 0.0f); assertEquals(50f, root.getLayoutHeight(), 0.0f); @@ -1929,20 +2093,25 @@ public void test_stretch_min_width() { assertEquals(500f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); - assertEquals(450f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(500f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(350f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); + assertEquals(450f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(325f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(350f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutHeight(), 0.0f); + + assertEquals(325f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutHeight(), 0.0f); } @Test @@ -2023,83 +2192,97 @@ public void test_fit_content_max_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); - root.setHeight(90f); + root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); - root_child0.setWrap(YogaWrap.WRAP); - root_child0.setHeight(110f); - root_child0.setMaxHeightFitContent(); + root_child0.setHeight(90f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); - root_child0_child0.setWidth(50f); - root_child0_child0.setHeight(50f); + root_child0_child0.setWrap(YogaWrap.WRAP); + root_child0_child0.setHeight(110f); + root_child0_child0.setMaxHeightFitContent(); root_child0.addChildAt(root_child0_child0, 0); - final YogaNode root_child0_child1 = createNode(config); - root_child0_child1.setWidth(50f); - root_child0_child1.setHeight(100f); - root_child0.addChildAt(root_child0_child1, 1); + final YogaNode root_child0_child0_child0 = createNode(config); + root_child0_child0_child0.setWidth(50f); + root_child0_child0_child0.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child0, 0); + + final YogaNode root_child0_child0_child1 = createNode(config); + root_child0_child0_child1.setWidth(50f); + root_child0_child0_child1.setHeight(100f); + root_child0_child0.addChildAt(root_child0_child0_child1, 1); - final YogaNode root_child0_child2 = createNode(config); - root_child0_child2.setWidth(50f); - root_child0_child2.setHeight(25f); - root_child0.addChildAt(root_child0_child2, 2); + final YogaNode root_child0_child0_child2 = createNode(config); + root_child0_child0_child2.setWidth(50f); + root_child0_child0_child2.setHeight(25f); + root_child0_child0.addChildAt(root_child0_child0_child2, 2); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(1980f, root.getLayoutY(), 0.0f); - assertEquals(500f, root.getLayoutWidth(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(50f, root.getLayoutWidth(), 0.0f); assertEquals(90f, 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(100f, root_child0.getLayoutHeight(), 0.0f); + assertEquals(50f, 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(50f, root_child0_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); + assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); + assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(100f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutHeight(), 0.0f); + + assertEquals(100f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(1980f, root.getLayoutY(), 0.0f); - assertEquals(500f, root.getLayoutWidth(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(50f, root.getLayoutWidth(), 0.0f); assertEquals(90f, 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(100f, root_child0.getLayoutHeight(), 0.0f); + assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(90f, root_child0.getLayoutHeight(), 0.0f); - assertEquals(450f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); - - assertEquals(400f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); - - assertEquals(350f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(100f, 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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(-50f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutHeight(), 0.0f); + + assertEquals(-100f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutHeight(), 0.0f); } @Test @@ -2108,83 +2291,97 @@ public void test_stretch_max_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); - root.setHeight(500f); + root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); - root_child0.setWrap(YogaWrap.WRAP); - root_child0.setHeight(600f); - root_child0.setMaxHeightStretch(); + root_child0.setHeight(500f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); - root_child0_child0.setWidth(50f); - root_child0_child0.setHeight(50f); + root_child0_child0.setWrap(YogaWrap.WRAP); + root_child0_child0.setHeight(600f); + root_child0_child0.setMaxHeightStretch(); root_child0.addChildAt(root_child0_child0, 0); - final YogaNode root_child0_child1 = createNode(config); - root_child0_child1.setWidth(50f); - root_child0_child1.setHeight(100f); - root_child0.addChildAt(root_child0_child1, 1); + final YogaNode root_child0_child0_child0 = createNode(config); + root_child0_child0_child0.setWidth(50f); + root_child0_child0_child0.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child0, 0); - final YogaNode root_child0_child2 = createNode(config); - root_child0_child2.setWidth(50f); - root_child0_child2.setHeight(25f); - root_child0.addChildAt(root_child0_child2, 2); + final YogaNode root_child0_child0_child1 = createNode(config); + root_child0_child0_child1.setWidth(50f); + root_child0_child0_child1.setHeight(100f); + root_child0_child0.addChildAt(root_child0_child0_child1, 1); + + final YogaNode root_child0_child0_child2 = createNode(config); + root_child0_child0_child2.setWidth(50f); + root_child0_child0_child2.setHeight(25f); + root_child0_child0.addChildAt(root_child0_child0_child2, 2); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(2070f, root.getLayoutY(), 0.0f); - assertEquals(500f, root.getLayoutWidth(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(50f, 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(600f, root_child0.getLayoutHeight(), 0.0f); + assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); + assertEquals(600f, root_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); + assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(0f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(150f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(2070f, root.getLayoutY(), 0.0f); - assertEquals(500f, root.getLayoutWidth(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(50f, 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(600f, root_child0.getLayoutHeight(), 0.0f); + assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); - assertEquals(450f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); - - assertEquals(450f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); - - assertEquals(450f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(600f, 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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(150f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutHeight(), 0.0f); } @Test @@ -2265,83 +2462,97 @@ public void test_fit_content_min_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); - root.setHeight(90f); + root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); - root_child0.setWrap(YogaWrap.WRAP); root_child0.setHeight(90f); - root_child0.setMinHeightFitContent(); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); - root_child0_child0.setWidth(50f); - root_child0_child0.setHeight(50f); + root_child0_child0.setWrap(YogaWrap.WRAP); + root_child0_child0.setHeight(90f); + root_child0_child0.setMinHeightFitContent(); root_child0.addChildAt(root_child0_child0, 0); - final YogaNode root_child0_child1 = createNode(config); - root_child0_child1.setWidth(50f); - root_child0_child1.setHeight(100f); - root_child0.addChildAt(root_child0_child1, 1); + final YogaNode root_child0_child0_child0 = createNode(config); + root_child0_child0_child0.setWidth(50f); + root_child0_child0_child0.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child0, 0); + + final YogaNode root_child0_child0_child1 = createNode(config); + root_child0_child0_child1.setWidth(50f); + root_child0_child0_child1.setHeight(100f); + root_child0_child0.addChildAt(root_child0_child0_child1, 1); - final YogaNode root_child0_child2 = createNode(config); - root_child0_child2.setWidth(50f); - root_child0_child2.setHeight(25f); - root_child0.addChildAt(root_child0_child2, 2); + final YogaNode root_child0_child0_child2 = createNode(config); + root_child0_child0_child2.setWidth(50f); + root_child0_child0_child2.setHeight(25f); + root_child0_child0.addChildAt(root_child0_child0_child2, 2); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(2570f, root.getLayoutY(), 0.0f); - assertEquals(500f, root.getLayoutWidth(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(50f, root.getLayoutWidth(), 0.0f); assertEquals(90f, 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(175f, root_child0.getLayoutHeight(), 0.0f); + assertEquals(50f, 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(50f, root_child0_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); + assertEquals(175f, 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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); + assertEquals(0f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutHeight(), 0.0f); - assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(0f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(150f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(2570f, root.getLayoutY(), 0.0f); - assertEquals(500f, root.getLayoutWidth(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(50f, root.getLayoutWidth(), 0.0f); assertEquals(90f, 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(175f, root_child0.getLayoutHeight(), 0.0f); + assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(90f, root_child0.getLayoutHeight(), 0.0f); - assertEquals(450f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); - - assertEquals(450f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); - - assertEquals(450f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(175f, 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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(150f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutHeight(), 0.0f); } @Test @@ -2350,83 +2561,97 @@ public void test_stretch_min_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); - root.setHeight(500f); + root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); - root_child0.setWrap(YogaWrap.WRAP); - root_child0.setHeight(400f); - root_child0.setMinHeightStretch(); + root_child0.setHeight(500f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); - root_child0_child0.setWidth(50f); - root_child0_child0.setHeight(50f); + root_child0_child0.setWrap(YogaWrap.WRAP); + root_child0_child0.setHeight(400f); + root_child0_child0.setMinHeightStretch(); root_child0.addChildAt(root_child0_child0, 0); - final YogaNode root_child0_child1 = createNode(config); - root_child0_child1.setWidth(50f); - root_child0_child1.setHeight(100f); - root_child0.addChildAt(root_child0_child1, 1); + final YogaNode root_child0_child0_child0 = createNode(config); + root_child0_child0_child0.setWidth(50f); + root_child0_child0_child0.setHeight(50f); + root_child0_child0.addChildAt(root_child0_child0_child0, 0); - final YogaNode root_child0_child2 = createNode(config); - root_child0_child2.setWidth(50f); - root_child0_child2.setHeight(25f); - root_child0.addChildAt(root_child0_child2, 2); + final YogaNode root_child0_child0_child1 = createNode(config); + root_child0_child0_child1.setWidth(50f); + root_child0_child0_child1.setHeight(100f); + root_child0_child0.addChildAt(root_child0_child0_child1, 1); + + final YogaNode root_child0_child0_child2 = createNode(config); + root_child0_child0_child2.setWidth(50f); + root_child0_child0_child2.setHeight(25f); + root_child0_child0.addChildAt(root_child0_child0_child2, 2); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(2660f, root.getLayoutY(), 0.0f); - assertEquals(500f, root.getLayoutWidth(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(50f, 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(400f, root_child0.getLayoutHeight(), 0.0f); + assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); + assertEquals(400f, root_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); + assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(0f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(150f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(2660f, root.getLayoutY(), 0.0f); - assertEquals(500f, root.getLayoutWidth(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(50f, 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(400f, root_child0.getLayoutHeight(), 0.0f); + assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); - assertEquals(450f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); - - assertEquals(450f, root_child0_child1.getLayoutX(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); - - assertEquals(450f, root_child0_child2.getLayoutX(), 0.0f); - assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f); - assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(400f, 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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(100f, root_child0_child0_child1.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(150f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(50f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(25f, root_child0_child0_child2.getLayoutHeight(), 0.0f); } private YogaNode createNode(YogaConfig config) { diff --git a/javascript/tests/generated/YGIntrinsicSizeTest.test.ts b/javascript/tests/generated/YGIntrinsicSizeTest.test.ts index b6367b6134..14d2013be8 100644 --- a/javascript/tests/generated/YGIntrinsicSizeTest.test.ts +++ b/javascript/tests/generated/YGIntrinsicSizeTest.test.ts @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<> * generated by gentest/gentest-driver.ts from gentest/fixtures/YGIntrinsicSizeTest.html */ @@ -626,28 +626,32 @@ test.skip('fit_content_width', () => { try { root = Yoga.Node.create(config); - root.setWidth(90); + root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); - root_child0.setFlexDirection(FlexDirection.Row); - root_child0.setFlexWrap(Wrap.Wrap); - root_child0.setWidth("fit-content"); + root_child0.setWidth(90); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); - root_child0_child0.setWidth(50); - root_child0_child0.setHeight(50); + root_child0_child0.setFlexDirection(FlexDirection.Row); + root_child0_child0.setFlexWrap(Wrap.Wrap); + root_child0_child0.setWidth("fit-content"); root_child0.insertChild(root_child0_child0, 0); - const root_child0_child1 = Yoga.Node.create(config); - root_child0_child1.setWidth(100); - root_child0_child1.setHeight(50); - root_child0.insertChild(root_child0_child1, 1); + const root_child0_child0_child0 = Yoga.Node.create(config); + root_child0_child0_child0.setWidth(50); + root_child0_child0_child0.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child0, 0); - const root_child0_child2 = Yoga.Node.create(config); - root_child0_child2.setWidth(25); - root_child0_child2.setHeight(50); - root_child0.insertChild(root_child0_child2, 2); + const root_child0_child0_child1 = Yoga.Node.create(config); + root_child0_child0_child1.setWidth(100); + root_child0_child0_child1.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child1, 1); + + const root_child0_child0_child2 = Yoga.Node.create(config); + root_child0_child0_child2.setWidth(25); + root_child0_child0_child2.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); @@ -657,23 +661,28 @@ test.skip('fit_content_width', () => { expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); - expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedWidth()).toBe(90); expect(root_child0.getComputedHeight()).toBe(150); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); - expect(root_child0_child0.getComputedWidth()).toBe(50); - expect(root_child0_child0.getComputedHeight()).toBe(50); + expect(root_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0.getComputedHeight()).toBe(150); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); - expect(root_child0_child1.getComputedLeft()).toBe(0); - expect(root_child0_child1.getComputedTop()).toBe(50); - expect(root_child0_child1.getComputedWidth()).toBe(100); - expect(root_child0_child1.getComputedHeight()).toBe(50); + expect(root_child0_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child0_child1.getComputedTop()).toBe(50); + expect(root_child0_child0_child1.getComputedWidth()).toBe(100); + expect(root_child0_child0_child1.getComputedHeight()).toBe(50); - expect(root_child0_child2.getComputedLeft()).toBe(0); - expect(root_child0_child2.getComputedTop()).toBe(100); - expect(root_child0_child2.getComputedWidth()).toBe(25); - expect(root_child0_child2.getComputedHeight()).toBe(50); + expect(root_child0_child0_child2.getComputedLeft()).toBe(0); + expect(root_child0_child0_child2.getComputedTop()).toBe(100); + expect(root_child0_child0_child2.getComputedWidth()).toBe(25); + expect(root_child0_child0_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); @@ -682,25 +691,30 @@ test.skip('fit_content_width', () => { expect(root.getComputedWidth()).toBe(90); expect(root.getComputedHeight()).toBe(150); - expect(root_child0.getComputedLeft()).toBe(-10); + expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); - expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedWidth()).toBe(90); expect(root_child0.getComputedHeight()).toBe(150); - expect(root_child0_child0.getComputedLeft()).toBe(50); + expect(root_child0_child0.getComputedLeft()).toBe(-10); expect(root_child0_child0.getComputedTop()).toBe(0); - expect(root_child0_child0.getComputedWidth()).toBe(50); - expect(root_child0_child0.getComputedHeight()).toBe(50); - - expect(root_child0_child1.getComputedLeft()).toBe(0); - expect(root_child0_child1.getComputedTop()).toBe(50); - expect(root_child0_child1.getComputedWidth()).toBe(100); - expect(root_child0_child1.getComputedHeight()).toBe(50); - - expect(root_child0_child2.getComputedLeft()).toBe(75); - expect(root_child0_child2.getComputedTop()).toBe(100); - expect(root_child0_child2.getComputedWidth()).toBe(25); - expect(root_child0_child2.getComputedHeight()).toBe(50); + expect(root_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0.getComputedHeight()).toBe(150); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(50); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child0_child1.getComputedTop()).toBe(50); + expect(root_child0_child0_child1.getComputedWidth()).toBe(100); + expect(root_child0_child0_child1.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child2.getComputedLeft()).toBe(75); + expect(root_child0_child0_child2.getComputedTop()).toBe(100); + expect(root_child0_child0_child2.getComputedWidth()).toBe(25); + expect(root_child0_child0_child2.getComputedHeight()).toBe(50); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); @@ -715,32 +729,36 @@ test.skip('stretch_width', () => { try { root = Yoga.Node.create(config); - root.setWidth(500); + root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); - root_child0.setFlexDirection(FlexDirection.Row); - root_child0.setFlexWrap(Wrap.Wrap); - root_child0.setWidth("stretch"); + root_child0.setWidth(500); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); - root_child0_child0.setWidth(50); - root_child0_child0.setHeight(50); + root_child0_child0.setFlexDirection(FlexDirection.Row); + root_child0_child0.setFlexWrap(Wrap.Wrap); + root_child0_child0.setWidth("stretch"); root_child0.insertChild(root_child0_child0, 0); - const root_child0_child1 = Yoga.Node.create(config); - root_child0_child1.setWidth(100); - root_child0_child1.setHeight(50); - root_child0.insertChild(root_child0_child1, 1); + const root_child0_child0_child0 = Yoga.Node.create(config); + root_child0_child0_child0.setWidth(50); + root_child0_child0_child0.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child0, 0); + + const root_child0_child0_child1 = Yoga.Node.create(config); + root_child0_child0_child1.setWidth(100); + root_child0_child0_child1.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child1, 1); - const root_child0_child2 = Yoga.Node.create(config); - root_child0_child2.setWidth(25); - root_child0_child2.setHeight(50); - root_child0.insertChild(root_child0_child2, 2); + const root_child0_child0_child2 = Yoga.Node.create(config); + root_child0_child0_child2.setWidth(25); + root_child0_child0_child2.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(150); + expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(50); @@ -751,23 +769,28 @@ test.skip('stretch_width', () => { expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); - expect(root_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0.getComputedWidth()).toBe(500); expect(root_child0_child0.getComputedHeight()).toBe(50); - expect(root_child0_child1.getComputedLeft()).toBe(50); - expect(root_child0_child1.getComputedTop()).toBe(0); - expect(root_child0_child1.getComputedWidth()).toBe(100); - expect(root_child0_child1.getComputedHeight()).toBe(50); + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child1.getComputedLeft()).toBe(50); + expect(root_child0_child0_child1.getComputedTop()).toBe(0); + expect(root_child0_child0_child1.getComputedWidth()).toBe(100); + expect(root_child0_child0_child1.getComputedHeight()).toBe(50); - expect(root_child0_child2.getComputedLeft()).toBe(150); - expect(root_child0_child2.getComputedTop()).toBe(0); - expect(root_child0_child2.getComputedWidth()).toBe(25); - expect(root_child0_child2.getComputedHeight()).toBe(50); + expect(root_child0_child0_child2.getComputedLeft()).toBe(150); + expect(root_child0_child0_child2.getComputedTop()).toBe(0); + expect(root_child0_child0_child2.getComputedWidth()).toBe(25); + expect(root_child0_child0_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(150); + expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(50); @@ -776,20 +799,25 @@ test.skip('stretch_width', () => { expect(root_child0.getComputedWidth()).toBe(500); expect(root_child0.getComputedHeight()).toBe(50); - expect(root_child0_child0.getComputedLeft()).toBe(450); + expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); - expect(root_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0.getComputedWidth()).toBe(500); expect(root_child0_child0.getComputedHeight()).toBe(50); - expect(root_child0_child1.getComputedLeft()).toBe(350); - expect(root_child0_child1.getComputedTop()).toBe(0); - expect(root_child0_child1.getComputedWidth()).toBe(100); - expect(root_child0_child1.getComputedHeight()).toBe(50); + expect(root_child0_child0_child0.getComputedLeft()).toBe(450); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child1.getComputedLeft()).toBe(350); + expect(root_child0_child0_child1.getComputedTop()).toBe(0); + expect(root_child0_child0_child1.getComputedWidth()).toBe(100); + expect(root_child0_child0_child1.getComputedHeight()).toBe(50); - expect(root_child0_child2.getComputedLeft()).toBe(325); - expect(root_child0_child2.getComputedTop()).toBe(0); - expect(root_child0_child2.getComputedWidth()).toBe(25); - expect(root_child0_child2.getComputedHeight()).toBe(50); + expect(root_child0_child0_child2.getComputedLeft()).toBe(325); + expect(root_child0_child0_child2.getComputedTop()).toBe(0); + expect(root_child0_child0_child2.getComputedWidth()).toBe(25); + expect(root_child0_child0_child2.getComputedHeight()).toBe(50); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); @@ -879,80 +907,94 @@ test.skip('fit_content_height', () => { try { root = Yoga.Node.create(config); - root.setHeight(90); + root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); - root_child0.setFlexWrap(Wrap.Wrap); - root_child0.setHeight("fit-content"); + root_child0.setHeight(90); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); - root_child0_child0.setWidth(50); - root_child0_child0.setHeight(50); + root_child0_child0.setFlexWrap(Wrap.Wrap); + root_child0_child0.setHeight("fit-content"); root_child0.insertChild(root_child0_child0, 0); - const root_child0_child1 = Yoga.Node.create(config); - root_child0_child1.setWidth(50); - root_child0_child1.setHeight(100); - root_child0.insertChild(root_child0_child1, 1); + const root_child0_child0_child0 = Yoga.Node.create(config); + root_child0_child0_child0.setWidth(50); + root_child0_child0_child0.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child0, 0); - const root_child0_child2 = Yoga.Node.create(config); - root_child0_child2.setWidth(50); - root_child0_child2.setHeight(25); - root_child0.insertChild(root_child0_child2, 2); + const root_child0_child0_child1 = Yoga.Node.create(config); + root_child0_child0_child1.setWidth(50); + root_child0_child0_child1.setHeight(100); + root_child0_child0.insertChild(root_child0_child0_child1, 1); + + const root_child0_child0_child2 = Yoga.Node.create(config); + root_child0_child0_child2.setWidth(50); + root_child0_child0_child2.setHeight(25); + root_child0_child0.insertChild(root_child0_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(200); - expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(90); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); - expect(root_child0.getComputedWidth()).toBe(500); - expect(root_child0.getComputedHeight()).toBe(175); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(90); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); - expect(root_child0_child0.getComputedHeight()).toBe(50); + expect(root_child0_child0.getComputedHeight()).toBe(175); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); - expect(root_child0_child1.getComputedLeft()).toBe(0); - expect(root_child0_child1.getComputedTop()).toBe(50); - expect(root_child0_child1.getComputedWidth()).toBe(50); - expect(root_child0_child1.getComputedHeight()).toBe(100); + expect(root_child0_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child0_child1.getComputedTop()).toBe(50); + expect(root_child0_child0_child1.getComputedWidth()).toBe(50); + expect(root_child0_child0_child1.getComputedHeight()).toBe(100); - expect(root_child0_child2.getComputedLeft()).toBe(0); - expect(root_child0_child2.getComputedTop()).toBe(150); - expect(root_child0_child2.getComputedWidth()).toBe(50); - expect(root_child0_child2.getComputedHeight()).toBe(25); + expect(root_child0_child0_child2.getComputedLeft()).toBe(0); + expect(root_child0_child0_child2.getComputedTop()).toBe(150); + expect(root_child0_child0_child2.getComputedWidth()).toBe(50); + expect(root_child0_child0_child2.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(200); - expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(90); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); - expect(root_child0.getComputedWidth()).toBe(500); - expect(root_child0.getComputedHeight()).toBe(175); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(90); - expect(root_child0_child0.getComputedLeft()).toBe(450); + expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); - expect(root_child0_child0.getComputedHeight()).toBe(50); - - expect(root_child0_child1.getComputedLeft()).toBe(450); - expect(root_child0_child1.getComputedTop()).toBe(50); - expect(root_child0_child1.getComputedWidth()).toBe(50); - expect(root_child0_child1.getComputedHeight()).toBe(100); - - expect(root_child0_child2.getComputedLeft()).toBe(450); - expect(root_child0_child2.getComputedTop()).toBe(150); - expect(root_child0_child2.getComputedWidth()).toBe(50); - expect(root_child0_child2.getComputedHeight()).toBe(25); + expect(root_child0_child0.getComputedHeight()).toBe(175); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child0_child1.getComputedTop()).toBe(50); + expect(root_child0_child0_child1.getComputedWidth()).toBe(50); + expect(root_child0_child0_child1.getComputedHeight()).toBe(100); + + expect(root_child0_child0_child2.getComputedLeft()).toBe(0); + expect(root_child0_child0_child2.getComputedTop()).toBe(150); + expect(root_child0_child0_child2.getComputedWidth()).toBe(50); + expect(root_child0_child0_child2.getComputedHeight()).toBe(25); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); @@ -967,80 +1009,94 @@ test.skip('stretch_height', () => { try { root = Yoga.Node.create(config); - root.setHeight(500); + root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); - root_child0.setFlexWrap(Wrap.Wrap); - root_child0.setHeight("stretch"); + root_child0.setHeight(500); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); - root_child0_child0.setWidth(50); - root_child0_child0.setHeight(50); + root_child0_child0.setFlexWrap(Wrap.Wrap); + root_child0_child0.setHeight("stretch"); root_child0.insertChild(root_child0_child0, 0); - const root_child0_child1 = Yoga.Node.create(config); - root_child0_child1.setWidth(50); - root_child0_child1.setHeight(100); - root_child0.insertChild(root_child0_child1, 1); + const root_child0_child0_child0 = Yoga.Node.create(config); + root_child0_child0_child0.setWidth(50); + root_child0_child0_child0.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child0, 0); + + const root_child0_child0_child1 = Yoga.Node.create(config); + root_child0_child0_child1.setWidth(50); + root_child0_child0_child1.setHeight(100); + root_child0_child0.insertChild(root_child0_child0_child1, 1); - const root_child0_child2 = Yoga.Node.create(config); - root_child0_child2.setWidth(50); - root_child0_child2.setHeight(25); - root_child0.insertChild(root_child0_child2, 2); + const root_child0_child0_child2 = Yoga.Node.create(config); + root_child0_child0_child2.setWidth(50); + root_child0_child0_child2.setHeight(25); + root_child0_child0.insertChild(root_child0_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(290); - expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); - expect(root_child0.getComputedWidth()).toBe(500); - expect(root_child0.getComputedHeight()).toBe(175); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(500); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); - expect(root_child0_child0.getComputedHeight()).toBe(50); + expect(root_child0_child0.getComputedHeight()).toBe(175); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); - expect(root_child0_child1.getComputedLeft()).toBe(0); - expect(root_child0_child1.getComputedTop()).toBe(50); - expect(root_child0_child1.getComputedWidth()).toBe(50); - expect(root_child0_child1.getComputedHeight()).toBe(100); + expect(root_child0_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child0_child1.getComputedTop()).toBe(50); + expect(root_child0_child0_child1.getComputedWidth()).toBe(50); + expect(root_child0_child0_child1.getComputedHeight()).toBe(100); - expect(root_child0_child2.getComputedLeft()).toBe(0); - expect(root_child0_child2.getComputedTop()).toBe(150); - expect(root_child0_child2.getComputedWidth()).toBe(50); - expect(root_child0_child2.getComputedHeight()).toBe(25); + expect(root_child0_child0_child2.getComputedLeft()).toBe(0); + expect(root_child0_child0_child2.getComputedTop()).toBe(150); + expect(root_child0_child0_child2.getComputedWidth()).toBe(50); + expect(root_child0_child0_child2.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(290); - expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); - expect(root_child0.getComputedWidth()).toBe(500); - expect(root_child0.getComputedHeight()).toBe(175); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(500); - expect(root_child0_child0.getComputedLeft()).toBe(450); + expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); - expect(root_child0_child0.getComputedHeight()).toBe(50); - - expect(root_child0_child1.getComputedLeft()).toBe(450); - expect(root_child0_child1.getComputedTop()).toBe(50); - expect(root_child0_child1.getComputedWidth()).toBe(50); - expect(root_child0_child1.getComputedHeight()).toBe(100); - - expect(root_child0_child2.getComputedLeft()).toBe(450); - expect(root_child0_child2.getComputedTop()).toBe(150); - expect(root_child0_child2.getComputedWidth()).toBe(50); - expect(root_child0_child2.getComputedHeight()).toBe(25); + expect(root_child0_child0.getComputedHeight()).toBe(175); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child0_child1.getComputedTop()).toBe(50); + expect(root_child0_child0_child1.getComputedWidth()).toBe(50); + expect(root_child0_child0_child1.getComputedHeight()).toBe(100); + + expect(root_child0_child0_child2.getComputedLeft()).toBe(0); + expect(root_child0_child0_child2.getComputedTop()).toBe(150); + expect(root_child0_child0_child2.getComputedWidth()).toBe(50); + expect(root_child0_child0_child2.getComputedHeight()).toBe(25); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); @@ -1130,80 +1186,94 @@ test.skip('fit_content_flex_basis_column', () => { try { root = Yoga.Node.create(config); - root.setHeight(90); + root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); - root_child0.setFlexWrap(Wrap.Wrap); - root_child0.setFlexBasis("fit-content"); + root_child0.setHeight(90); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); - root_child0_child0.setWidth(50); - root_child0_child0.setHeight(50); + root_child0_child0.setFlexWrap(Wrap.Wrap); + root_child0_child0.setFlexBasis("fit-content"); root_child0.insertChild(root_child0_child0, 0); - const root_child0_child1 = Yoga.Node.create(config); - root_child0_child1.setWidth(50); - root_child0_child1.setHeight(100); - root_child0.insertChild(root_child0_child1, 1); + const root_child0_child0_child0 = Yoga.Node.create(config); + root_child0_child0_child0.setWidth(50); + root_child0_child0_child0.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child0, 0); + + const root_child0_child0_child1 = Yoga.Node.create(config); + root_child0_child0_child1.setWidth(50); + root_child0_child0_child1.setHeight(100); + root_child0_child0.insertChild(root_child0_child0_child1, 1); - const root_child0_child2 = Yoga.Node.create(config); - root_child0_child2.setWidth(50); - root_child0_child2.setHeight(25); - root_child0.insertChild(root_child0_child2, 2); + const root_child0_child0_child2 = Yoga.Node.create(config); + root_child0_child0_child2.setWidth(50); + root_child0_child0_child2.setHeight(25); + root_child0_child0.insertChild(root_child0_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(790); - expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(90); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); - expect(root_child0.getComputedWidth()).toBe(500); - expect(root_child0.getComputedHeight()).toBe(175); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(90); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); - expect(root_child0_child0.getComputedHeight()).toBe(50); + expect(root_child0_child0.getComputedHeight()).toBe(175); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); - expect(root_child0_child1.getComputedLeft()).toBe(0); - expect(root_child0_child1.getComputedTop()).toBe(50); - expect(root_child0_child1.getComputedWidth()).toBe(50); - expect(root_child0_child1.getComputedHeight()).toBe(100); + expect(root_child0_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child0_child1.getComputedTop()).toBe(50); + expect(root_child0_child0_child1.getComputedWidth()).toBe(50); + expect(root_child0_child0_child1.getComputedHeight()).toBe(100); - expect(root_child0_child2.getComputedLeft()).toBe(0); - expect(root_child0_child2.getComputedTop()).toBe(150); - expect(root_child0_child2.getComputedWidth()).toBe(50); - expect(root_child0_child2.getComputedHeight()).toBe(25); + expect(root_child0_child0_child2.getComputedLeft()).toBe(0); + expect(root_child0_child0_child2.getComputedTop()).toBe(150); + expect(root_child0_child0_child2.getComputedWidth()).toBe(50); + expect(root_child0_child0_child2.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(790); - expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(90); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); - expect(root_child0.getComputedWidth()).toBe(500); - expect(root_child0.getComputedHeight()).toBe(175); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(90); - expect(root_child0_child0.getComputedLeft()).toBe(450); + expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); - expect(root_child0_child0.getComputedHeight()).toBe(50); - - expect(root_child0_child1.getComputedLeft()).toBe(450); - expect(root_child0_child1.getComputedTop()).toBe(50); - expect(root_child0_child1.getComputedWidth()).toBe(50); - expect(root_child0_child1.getComputedHeight()).toBe(100); - - expect(root_child0_child2.getComputedLeft()).toBe(450); - expect(root_child0_child2.getComputedTop()).toBe(150); - expect(root_child0_child2.getComputedWidth()).toBe(50); - expect(root_child0_child2.getComputedHeight()).toBe(25); + expect(root_child0_child0.getComputedHeight()).toBe(175); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child0_child1.getComputedTop()).toBe(50); + expect(root_child0_child0_child1.getComputedWidth()).toBe(50); + expect(root_child0_child0_child1.getComputedHeight()).toBe(100); + + expect(root_child0_child0_child2.getComputedLeft()).toBe(0); + expect(root_child0_child0_child2.getComputedTop()).toBe(150); + expect(root_child0_child0_child2.getComputedWidth()).toBe(50); + expect(root_child0_child0_child2.getComputedHeight()).toBe(25); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); @@ -1218,79 +1288,93 @@ test.skip('stretch_flex_basis_column', () => { try { root = Yoga.Node.create(config); - root.setHeight(500); + root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); - root_child0.setFlexWrap(Wrap.Wrap); + root_child0.setHeight(500); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); - root_child0_child0.setWidth(50); - root_child0_child0.setHeight(50); + root_child0_child0.setFlexWrap(Wrap.Wrap); root_child0.insertChild(root_child0_child0, 0); - const root_child0_child1 = Yoga.Node.create(config); - root_child0_child1.setWidth(50); - root_child0_child1.setHeight(100); - root_child0.insertChild(root_child0_child1, 1); + const root_child0_child0_child0 = Yoga.Node.create(config); + root_child0_child0_child0.setWidth(50); + root_child0_child0_child0.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child0, 0); - const root_child0_child2 = Yoga.Node.create(config); - root_child0_child2.setWidth(50); - root_child0_child2.setHeight(25); - root_child0.insertChild(root_child0_child2, 2); + const root_child0_child0_child1 = Yoga.Node.create(config); + root_child0_child0_child1.setWidth(50); + root_child0_child0_child1.setHeight(100); + root_child0_child0.insertChild(root_child0_child0_child1, 1); + + const root_child0_child0_child2 = Yoga.Node.create(config); + root_child0_child0_child2.setWidth(50); + root_child0_child0_child2.setHeight(25); + root_child0_child0.insertChild(root_child0_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(880); - expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); - expect(root_child0.getComputedWidth()).toBe(500); - expect(root_child0.getComputedHeight()).toBe(175); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(500); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); - expect(root_child0_child0.getComputedHeight()).toBe(50); + expect(root_child0_child0.getComputedHeight()).toBe(175); - expect(root_child0_child1.getComputedLeft()).toBe(0); - expect(root_child0_child1.getComputedTop()).toBe(50); - expect(root_child0_child1.getComputedWidth()).toBe(50); - expect(root_child0_child1.getComputedHeight()).toBe(100); + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); - expect(root_child0_child2.getComputedLeft()).toBe(0); - expect(root_child0_child2.getComputedTop()).toBe(150); - expect(root_child0_child2.getComputedWidth()).toBe(50); - expect(root_child0_child2.getComputedHeight()).toBe(25); + expect(root_child0_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child0_child1.getComputedTop()).toBe(50); + expect(root_child0_child0_child1.getComputedWidth()).toBe(50); + expect(root_child0_child0_child1.getComputedHeight()).toBe(100); + + expect(root_child0_child0_child2.getComputedLeft()).toBe(0); + expect(root_child0_child0_child2.getComputedTop()).toBe(150); + expect(root_child0_child0_child2.getComputedWidth()).toBe(50); + expect(root_child0_child0_child2.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(880); - expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); - expect(root_child0.getComputedWidth()).toBe(500); - expect(root_child0.getComputedHeight()).toBe(175); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(500); - expect(root_child0_child0.getComputedLeft()).toBe(450); + expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); - expect(root_child0_child0.getComputedHeight()).toBe(50); - - expect(root_child0_child1.getComputedLeft()).toBe(450); - expect(root_child0_child1.getComputedTop()).toBe(50); - expect(root_child0_child1.getComputedWidth()).toBe(50); - expect(root_child0_child1.getComputedHeight()).toBe(100); - - expect(root_child0_child2.getComputedLeft()).toBe(450); - expect(root_child0_child2.getComputedTop()).toBe(150); - expect(root_child0_child2.getComputedWidth()).toBe(50); - expect(root_child0_child2.getComputedHeight()).toBe(25); + expect(root_child0_child0.getComputedHeight()).toBe(175); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child0_child1.getComputedTop()).toBe(50); + expect(root_child0_child0_child1.getComputedWidth()).toBe(50); + expect(root_child0_child0_child1.getComputedHeight()).toBe(100); + + expect(root_child0_child0_child2.getComputedLeft()).toBe(0); + expect(root_child0_child0_child2.getComputedTop()).toBe(150); + expect(root_child0_child0_child2.getComputedWidth()).toBe(50); + expect(root_child0_child0_child2.getComputedHeight()).toBe(25); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); @@ -1299,7 +1383,7 @@ test.skip('stretch_flex_basis_column', () => { config.free(); } }); -test('max_content_flex_basis_row', () => { +test.skip('max_content_flex_basis_row', () => { const config = Yoga.Config.create(); let root; @@ -1328,21 +1412,21 @@ test('max_content_flex_basis_row', () => { expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); - expect(root.getComputedWidth()).toBe(175); - expect(root.getComputedHeight()).toBe(500); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(600); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); - expect(root_child1.getComputedLeft()).toBe(50); - expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(500); - expect(root_child2.getComputedLeft()).toBe(150); - expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(550); expect(root_child2.getComputedWidth()).toBe(25); expect(root_child2.getComputedHeight()).toBe(50); @@ -1350,21 +1434,21 @@ test('max_content_flex_basis_row', () => { expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); - expect(root.getComputedWidth()).toBe(175); - expect(root.getComputedHeight()).toBe(500); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(600); - expect(root_child0.getComputedLeft()).toBe(125); + expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); - expect(root_child1.getComputedLeft()).toBe(25); - expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(500); - expect(root_child2.getComputedLeft()).toBe(0); - expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedLeft()).toBe(75); + expect(root_child2.getComputedTop()).toBe(550); expect(root_child2.getComputedWidth()).toBe(25); expect(root_child2.getComputedHeight()).toBe(50); } finally { @@ -1381,32 +1465,36 @@ test.skip('fit_content_flex_basis_row', () => { try { root = Yoga.Node.create(config); - root.setWidth(90); + root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); - root_child0.setFlexDirection(FlexDirection.Row); - root_child0.setFlexWrap(Wrap.Wrap); - root_child0.setFlexBasis("fit-content"); + root_child0.setWidth(90); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); - root_child0_child0.setWidth(50); - root_child0_child0.setHeight(50); + root_child0_child0.setFlexDirection(FlexDirection.Row); + root_child0_child0.setFlexWrap(Wrap.Wrap); + root_child0_child0.setFlexBasis("fit-content"); root_child0.insertChild(root_child0_child0, 0); - const root_child0_child1 = Yoga.Node.create(config); - root_child0_child1.setWidth(100); - root_child0_child1.setHeight(50); - root_child0.insertChild(root_child0_child1, 1); + const root_child0_child0_child0 = Yoga.Node.create(config); + root_child0_child0_child0.setWidth(50); + root_child0_child0_child0.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child0, 0); + + const root_child0_child0_child1 = Yoga.Node.create(config); + root_child0_child0_child1.setWidth(100); + root_child0_child0_child1.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child1, 1); - const root_child0_child2 = Yoga.Node.create(config); - root_child0_child2.setWidth(25); - root_child0_child2.setHeight(50); - root_child0.insertChild(root_child0_child2, 2); + const root_child0_child0_child2 = Yoga.Node.create(config); + root_child0_child0_child2.setWidth(25); + root_child0_child0_child2.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(1380); + expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(90); expect(root.getComputedHeight()).toBe(150); @@ -1417,23 +1505,28 @@ test.skip('fit_content_flex_basis_row', () => { expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); - expect(root_child0_child0.getComputedWidth()).toBe(50); - expect(root_child0_child0.getComputedHeight()).toBe(50); + expect(root_child0_child0.getComputedWidth()).toBe(90); + expect(root_child0_child0.getComputedHeight()).toBe(150); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); - expect(root_child0_child1.getComputedLeft()).toBe(0); - expect(root_child0_child1.getComputedTop()).toBe(50); - expect(root_child0_child1.getComputedWidth()).toBe(100); - expect(root_child0_child1.getComputedHeight()).toBe(50); + expect(root_child0_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child0_child1.getComputedTop()).toBe(50); + expect(root_child0_child0_child1.getComputedWidth()).toBe(100); + expect(root_child0_child0_child1.getComputedHeight()).toBe(50); - expect(root_child0_child2.getComputedLeft()).toBe(0); - expect(root_child0_child2.getComputedTop()).toBe(100); - expect(root_child0_child2.getComputedWidth()).toBe(25); - expect(root_child0_child2.getComputedHeight()).toBe(50); + expect(root_child0_child0_child2.getComputedLeft()).toBe(0); + expect(root_child0_child0_child2.getComputedTop()).toBe(100); + expect(root_child0_child0_child2.getComputedWidth()).toBe(25); + expect(root_child0_child0_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(1380); + expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(90); expect(root.getComputedHeight()).toBe(150); @@ -1442,20 +1535,25 @@ test.skip('fit_content_flex_basis_row', () => { expect(root_child0.getComputedWidth()).toBe(90); expect(root_child0.getComputedHeight()).toBe(150); - expect(root_child0_child0.getComputedLeft()).toBe(40); + expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); - expect(root_child0_child0.getComputedWidth()).toBe(50); - expect(root_child0_child0.getComputedHeight()).toBe(50); - - expect(root_child0_child1.getComputedLeft()).toBe(-10); - expect(root_child0_child1.getComputedTop()).toBe(50); - expect(root_child0_child1.getComputedWidth()).toBe(100); - expect(root_child0_child1.getComputedHeight()).toBe(50); - - expect(root_child0_child2.getComputedLeft()).toBe(65); - expect(root_child0_child2.getComputedTop()).toBe(100); - expect(root_child0_child2.getComputedWidth()).toBe(25); - expect(root_child0_child2.getComputedHeight()).toBe(50); + expect(root_child0_child0.getComputedWidth()).toBe(90); + expect(root_child0_child0.getComputedHeight()).toBe(150); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(40); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child1.getComputedLeft()).toBe(-10); + expect(root_child0_child0_child1.getComputedTop()).toBe(50); + expect(root_child0_child0_child1.getComputedWidth()).toBe(100); + expect(root_child0_child0_child1.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child2.getComputedLeft()).toBe(65); + expect(root_child0_child0_child2.getComputedTop()).toBe(100); + expect(root_child0_child0_child2.getComputedWidth()).toBe(25); + expect(root_child0_child0_child2.getComputedHeight()).toBe(50); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); @@ -1470,31 +1568,35 @@ test.skip('stretch_flex_basis_row', () => { try { root = Yoga.Node.create(config); - root.setWidth(500); + root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); - root_child0.setFlexDirection(FlexDirection.Row); - root_child0.setFlexWrap(Wrap.Wrap); + root_child0.setWidth(500); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); - root_child0_child0.setWidth(50); - root_child0_child0.setHeight(50); + root_child0_child0.setFlexDirection(FlexDirection.Row); + root_child0_child0.setFlexWrap(Wrap.Wrap); root_child0.insertChild(root_child0_child0, 0); - const root_child0_child1 = Yoga.Node.create(config); - root_child0_child1.setWidth(100); - root_child0_child1.setHeight(50); - root_child0.insertChild(root_child0_child1, 1); + const root_child0_child0_child0 = Yoga.Node.create(config); + root_child0_child0_child0.setWidth(50); + root_child0_child0_child0.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child0, 0); - const root_child0_child2 = Yoga.Node.create(config); - root_child0_child2.setWidth(25); - root_child0_child2.setHeight(50); - root_child0.insertChild(root_child0_child2, 2); + const root_child0_child0_child1 = Yoga.Node.create(config); + root_child0_child0_child1.setWidth(100); + root_child0_child0_child1.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child1, 1); + + const root_child0_child0_child2 = Yoga.Node.create(config); + root_child0_child0_child2.setWidth(25); + root_child0_child0_child2.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(1530); + expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(50); @@ -1505,23 +1607,28 @@ test.skip('stretch_flex_basis_row', () => { expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); - expect(root_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0.getComputedWidth()).toBe(500); expect(root_child0_child0.getComputedHeight()).toBe(50); - expect(root_child0_child1.getComputedLeft()).toBe(50); - expect(root_child0_child1.getComputedTop()).toBe(0); - expect(root_child0_child1.getComputedWidth()).toBe(100); - expect(root_child0_child1.getComputedHeight()).toBe(50); + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child1.getComputedLeft()).toBe(50); + expect(root_child0_child0_child1.getComputedTop()).toBe(0); + expect(root_child0_child0_child1.getComputedWidth()).toBe(100); + expect(root_child0_child0_child1.getComputedHeight()).toBe(50); - expect(root_child0_child2.getComputedLeft()).toBe(150); - expect(root_child0_child2.getComputedTop()).toBe(0); - expect(root_child0_child2.getComputedWidth()).toBe(25); - expect(root_child0_child2.getComputedHeight()).toBe(50); + expect(root_child0_child0_child2.getComputedLeft()).toBe(150); + expect(root_child0_child0_child2.getComputedTop()).toBe(0); + expect(root_child0_child0_child2.getComputedWidth()).toBe(25); + expect(root_child0_child0_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(1530); + expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(50); @@ -1530,20 +1637,25 @@ test.skip('stretch_flex_basis_row', () => { expect(root_child0.getComputedWidth()).toBe(500); expect(root_child0.getComputedHeight()).toBe(50); - expect(root_child0_child0.getComputedLeft()).toBe(450); + expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); - expect(root_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0.getComputedWidth()).toBe(500); expect(root_child0_child0.getComputedHeight()).toBe(50); - expect(root_child0_child1.getComputedLeft()).toBe(350); - expect(root_child0_child1.getComputedTop()).toBe(0); - expect(root_child0_child1.getComputedWidth()).toBe(100); - expect(root_child0_child1.getComputedHeight()).toBe(50); + expect(root_child0_child0_child0.getComputedLeft()).toBe(450); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); - expect(root_child0_child2.getComputedLeft()).toBe(325); - expect(root_child0_child2.getComputedTop()).toBe(0); - expect(root_child0_child2.getComputedWidth()).toBe(25); - expect(root_child0_child2.getComputedHeight()).toBe(50); + expect(root_child0_child0_child1.getComputedLeft()).toBe(350); + expect(root_child0_child0_child1.getComputedTop()).toBe(0); + expect(root_child0_child0_child1.getComputedWidth()).toBe(100); + expect(root_child0_child0_child1.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child2.getComputedLeft()).toBe(325); + expect(root_child0_child0_child2.getComputedTop()).toBe(0); + expect(root_child0_child0_child2.getComputedWidth()).toBe(25); + expect(root_child0_child0_child2.getComputedHeight()).toBe(50); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); @@ -1635,82 +1747,96 @@ test.skip('fit_content_max_width', () => { try { root = Yoga.Node.create(config); - root.setWidth(90); + root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); - root_child0.setFlexDirection(FlexDirection.Row); - root_child0.setFlexWrap(Wrap.Wrap); - root_child0.setWidth(110); - root_child0.setMaxWidth("fit-content"); + root_child0.setWidth(90); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); - root_child0_child0.setWidth(50); - root_child0_child0.setHeight(50); + root_child0_child0.setFlexDirection(FlexDirection.Row); + root_child0_child0.setFlexWrap(Wrap.Wrap); + root_child0_child0.setWidth(110); + root_child0_child0.setMaxWidth("fit-content"); root_child0.insertChild(root_child0_child0, 0); - const root_child0_child1 = Yoga.Node.create(config); - root_child0_child1.setWidth(100); - root_child0_child1.setHeight(50); - root_child0.insertChild(root_child0_child1, 1); + const root_child0_child0_child0 = Yoga.Node.create(config); + root_child0_child0_child0.setWidth(50); + root_child0_child0_child0.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child0, 0); - const root_child0_child2 = Yoga.Node.create(config); - root_child0_child2.setWidth(25); - root_child0_child2.setHeight(50); - root_child0.insertChild(root_child0_child2, 2); + const root_child0_child0_child1 = Yoga.Node.create(config); + root_child0_child0_child1.setWidth(100); + root_child0_child0_child1.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child1, 1); + + const root_child0_child0_child2 = Yoga.Node.create(config); + root_child0_child0_child2.setWidth(25); + root_child0_child0_child2.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(1580); + expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(90); expect(root.getComputedHeight()).toBe(150); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); - expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedWidth()).toBe(90); expect(root_child0.getComputedHeight()).toBe(150); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); - expect(root_child0_child0.getComputedWidth()).toBe(50); - expect(root_child0_child0.getComputedHeight()).toBe(50); + expect(root_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0.getComputedHeight()).toBe(150); - expect(root_child0_child1.getComputedLeft()).toBe(0); - expect(root_child0_child1.getComputedTop()).toBe(50); - expect(root_child0_child1.getComputedWidth()).toBe(100); - expect(root_child0_child1.getComputedHeight()).toBe(50); + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); - expect(root_child0_child2.getComputedLeft()).toBe(0); - expect(root_child0_child2.getComputedTop()).toBe(100); - expect(root_child0_child2.getComputedWidth()).toBe(25); - expect(root_child0_child2.getComputedHeight()).toBe(50); + expect(root_child0_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child0_child1.getComputedTop()).toBe(50); + expect(root_child0_child0_child1.getComputedWidth()).toBe(100); + expect(root_child0_child0_child1.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child2.getComputedLeft()).toBe(0); + expect(root_child0_child0_child2.getComputedTop()).toBe(100); + expect(root_child0_child0_child2.getComputedWidth()).toBe(25); + expect(root_child0_child0_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(1580); + expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(90); expect(root.getComputedHeight()).toBe(150); - expect(root_child0.getComputedLeft()).toBe(-10); + expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); - expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedWidth()).toBe(90); expect(root_child0.getComputedHeight()).toBe(150); - expect(root_child0_child0.getComputedLeft()).toBe(50); + expect(root_child0_child0.getComputedLeft()).toBe(-10); expect(root_child0_child0.getComputedTop()).toBe(0); - expect(root_child0_child0.getComputedWidth()).toBe(50); - expect(root_child0_child0.getComputedHeight()).toBe(50); - - expect(root_child0_child1.getComputedLeft()).toBe(0); - expect(root_child0_child1.getComputedTop()).toBe(50); - expect(root_child0_child1.getComputedWidth()).toBe(100); - expect(root_child0_child1.getComputedHeight()).toBe(50); - - expect(root_child0_child2.getComputedLeft()).toBe(75); - expect(root_child0_child2.getComputedTop()).toBe(100); - expect(root_child0_child2.getComputedWidth()).toBe(25); - expect(root_child0_child2.getComputedHeight()).toBe(50); + expect(root_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0.getComputedHeight()).toBe(150); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(50); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child0_child1.getComputedTop()).toBe(50); + expect(root_child0_child0_child1.getComputedWidth()).toBe(100); + expect(root_child0_child0_child1.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child2.getComputedLeft()).toBe(75); + expect(root_child0_child0_child2.getComputedTop()).toBe(100); + expect(root_child0_child0_child2.getComputedWidth()).toBe(25); + expect(root_child0_child0_child2.getComputedHeight()).toBe(50); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); @@ -1725,33 +1851,37 @@ test.skip('stretch_max_width', () => { try { root = Yoga.Node.create(config); - root.setWidth(500); + root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); - root_child0.setFlexDirection(FlexDirection.Row); - root_child0.setFlexWrap(Wrap.Wrap); - root_child0.setWidth(600); - root_child0.setMaxWidth("stretch"); + root_child0.setWidth(500); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); - root_child0_child0.setWidth(50); - root_child0_child0.setHeight(50); + root_child0_child0.setFlexDirection(FlexDirection.Row); + root_child0_child0.setFlexWrap(Wrap.Wrap); + root_child0_child0.setWidth(600); + root_child0_child0.setMaxWidth("stretch"); root_child0.insertChild(root_child0_child0, 0); - const root_child0_child1 = Yoga.Node.create(config); - root_child0_child1.setWidth(100); - root_child0_child1.setHeight(50); - root_child0.insertChild(root_child0_child1, 1); + const root_child0_child0_child0 = Yoga.Node.create(config); + root_child0_child0_child0.setWidth(50); + root_child0_child0_child0.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child0, 0); - const root_child0_child2 = Yoga.Node.create(config); - root_child0_child2.setWidth(25); - root_child0_child2.setHeight(50); - root_child0.insertChild(root_child0_child2, 2); + const root_child0_child0_child1 = Yoga.Node.create(config); + root_child0_child0_child1.setWidth(100); + root_child0_child0_child1.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child1, 1); + + const root_child0_child0_child2 = Yoga.Node.create(config); + root_child0_child0_child2.setWidth(25); + root_child0_child0_child2.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(1730); + expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(50); @@ -1762,23 +1892,28 @@ test.skip('stretch_max_width', () => { expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); - expect(root_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0.getComputedWidth()).toBe(500); expect(root_child0_child0.getComputedHeight()).toBe(50); - expect(root_child0_child1.getComputedLeft()).toBe(50); - expect(root_child0_child1.getComputedTop()).toBe(0); - expect(root_child0_child1.getComputedWidth()).toBe(100); - expect(root_child0_child1.getComputedHeight()).toBe(50); + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child1.getComputedLeft()).toBe(50); + expect(root_child0_child0_child1.getComputedTop()).toBe(0); + expect(root_child0_child0_child1.getComputedWidth()).toBe(100); + expect(root_child0_child0_child1.getComputedHeight()).toBe(50); - expect(root_child0_child2.getComputedLeft()).toBe(150); - expect(root_child0_child2.getComputedTop()).toBe(0); - expect(root_child0_child2.getComputedWidth()).toBe(25); - expect(root_child0_child2.getComputedHeight()).toBe(50); + expect(root_child0_child0_child2.getComputedLeft()).toBe(150); + expect(root_child0_child0_child2.getComputedTop()).toBe(0); + expect(root_child0_child0_child2.getComputedWidth()).toBe(25); + expect(root_child0_child0_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(1730); + expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(50); @@ -1787,20 +1922,25 @@ test.skip('stretch_max_width', () => { expect(root_child0.getComputedWidth()).toBe(500); expect(root_child0.getComputedHeight()).toBe(50); - expect(root_child0_child0.getComputedLeft()).toBe(450); + expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); - expect(root_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0.getComputedWidth()).toBe(500); expect(root_child0_child0.getComputedHeight()).toBe(50); - expect(root_child0_child1.getComputedLeft()).toBe(350); - expect(root_child0_child1.getComputedTop()).toBe(0); - expect(root_child0_child1.getComputedWidth()).toBe(100); - expect(root_child0_child1.getComputedHeight()).toBe(50); + expect(root_child0_child0_child0.getComputedLeft()).toBe(450); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child1.getComputedLeft()).toBe(350); + expect(root_child0_child0_child1.getComputedTop()).toBe(0); + expect(root_child0_child0_child1.getComputedWidth()).toBe(100); + expect(root_child0_child0_child1.getComputedHeight()).toBe(50); - expect(root_child0_child2.getComputedLeft()).toBe(325); - expect(root_child0_child2.getComputedTop()).toBe(0); - expect(root_child0_child2.getComputedWidth()).toBe(25); - expect(root_child0_child2.getComputedHeight()).toBe(50); + expect(root_child0_child0_child2.getComputedLeft()).toBe(325); + expect(root_child0_child0_child2.getComputedTop()).toBe(0); + expect(root_child0_child0_child2.getComputedWidth()).toBe(25); + expect(root_child0_child0_child2.getComputedHeight()).toBe(50); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); @@ -1892,82 +2032,96 @@ test.skip('fit_content_min_width', () => { try { root = Yoga.Node.create(config); - root.setWidth(90); + root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); - root_child0.setFlexDirection(FlexDirection.Row); - root_child0.setFlexWrap(Wrap.Wrap); root_child0.setWidth(90); - root_child0.setMinWidth("fit-content"); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); - root_child0_child0.setWidth(50); - root_child0_child0.setHeight(50); + root_child0_child0.setFlexDirection(FlexDirection.Row); + root_child0_child0.setFlexWrap(Wrap.Wrap); + root_child0_child0.setWidth(90); + root_child0_child0.setMinWidth("fit-content"); root_child0.insertChild(root_child0_child0, 0); - const root_child0_child1 = Yoga.Node.create(config); - root_child0_child1.setWidth(100); - root_child0_child1.setHeight(50); - root_child0.insertChild(root_child0_child1, 1); + const root_child0_child0_child0 = Yoga.Node.create(config); + root_child0_child0_child0.setWidth(50); + root_child0_child0_child0.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child0, 0); + + const root_child0_child0_child1 = Yoga.Node.create(config); + root_child0_child0_child1.setWidth(100); + root_child0_child0_child1.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child1, 1); - const root_child0_child2 = Yoga.Node.create(config); - root_child0_child2.setWidth(25); - root_child0_child2.setHeight(50); - root_child0.insertChild(root_child0_child2, 2); + const root_child0_child0_child2 = Yoga.Node.create(config); + root_child0_child0_child2.setWidth(25); + root_child0_child0_child2.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(1780); + expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(90); expect(root.getComputedHeight()).toBe(150); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); - expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedWidth()).toBe(90); expect(root_child0.getComputedHeight()).toBe(150); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); - expect(root_child0_child0.getComputedWidth()).toBe(50); - expect(root_child0_child0.getComputedHeight()).toBe(50); + expect(root_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0.getComputedHeight()).toBe(150); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); - expect(root_child0_child1.getComputedLeft()).toBe(0); - expect(root_child0_child1.getComputedTop()).toBe(50); - expect(root_child0_child1.getComputedWidth()).toBe(100); - expect(root_child0_child1.getComputedHeight()).toBe(50); + expect(root_child0_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child0_child1.getComputedTop()).toBe(50); + expect(root_child0_child0_child1.getComputedWidth()).toBe(100); + expect(root_child0_child0_child1.getComputedHeight()).toBe(50); - expect(root_child0_child2.getComputedLeft()).toBe(0); - expect(root_child0_child2.getComputedTop()).toBe(100); - expect(root_child0_child2.getComputedWidth()).toBe(25); - expect(root_child0_child2.getComputedHeight()).toBe(50); + expect(root_child0_child0_child2.getComputedLeft()).toBe(0); + expect(root_child0_child0_child2.getComputedTop()).toBe(100); + expect(root_child0_child0_child2.getComputedWidth()).toBe(25); + expect(root_child0_child0_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(1780); + expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(90); expect(root.getComputedHeight()).toBe(150); - expect(root_child0.getComputedLeft()).toBe(-10); + expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); - expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedWidth()).toBe(90); expect(root_child0.getComputedHeight()).toBe(150); - expect(root_child0_child0.getComputedLeft()).toBe(50); + expect(root_child0_child0.getComputedLeft()).toBe(-10); expect(root_child0_child0.getComputedTop()).toBe(0); - expect(root_child0_child0.getComputedWidth()).toBe(50); - expect(root_child0_child0.getComputedHeight()).toBe(50); - - expect(root_child0_child1.getComputedLeft()).toBe(0); - expect(root_child0_child1.getComputedTop()).toBe(50); - expect(root_child0_child1.getComputedWidth()).toBe(100); - expect(root_child0_child1.getComputedHeight()).toBe(50); - - expect(root_child0_child2.getComputedLeft()).toBe(75); - expect(root_child0_child2.getComputedTop()).toBe(100); - expect(root_child0_child2.getComputedWidth()).toBe(25); - expect(root_child0_child2.getComputedHeight()).toBe(50); + expect(root_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0.getComputedHeight()).toBe(150); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(50); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child0_child1.getComputedTop()).toBe(50); + expect(root_child0_child0_child1.getComputedWidth()).toBe(100); + expect(root_child0_child0_child1.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child2.getComputedLeft()).toBe(75); + expect(root_child0_child0_child2.getComputedTop()).toBe(100); + expect(root_child0_child0_child2.getComputedWidth()).toBe(25); + expect(root_child0_child0_child2.getComputedHeight()).toBe(50); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); @@ -1982,33 +2136,37 @@ test.skip('stretch_min_width', () => { try { root = Yoga.Node.create(config); - root.setWidth(500); + root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); - root_child0.setFlexDirection(FlexDirection.Row); - root_child0.setFlexWrap(Wrap.Wrap); - root_child0.setWidth(400); - root_child0.setMinWidth("stretch"); + root_child0.setWidth(500); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); - root_child0_child0.setWidth(50); - root_child0_child0.setHeight(50); + root_child0_child0.setFlexDirection(FlexDirection.Row); + root_child0_child0.setFlexWrap(Wrap.Wrap); + root_child0_child0.setWidth(400); + root_child0_child0.setMinWidth("stretch"); root_child0.insertChild(root_child0_child0, 0); - const root_child0_child1 = Yoga.Node.create(config); - root_child0_child1.setWidth(100); - root_child0_child1.setHeight(50); - root_child0.insertChild(root_child0_child1, 1); + const root_child0_child0_child0 = Yoga.Node.create(config); + root_child0_child0_child0.setWidth(50); + root_child0_child0_child0.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child0, 0); + + const root_child0_child0_child1 = Yoga.Node.create(config); + root_child0_child0_child1.setWidth(100); + root_child0_child0_child1.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child1, 1); - const root_child0_child2 = Yoga.Node.create(config); - root_child0_child2.setWidth(25); - root_child0_child2.setHeight(50); - root_child0.insertChild(root_child0_child2, 2); + const root_child0_child0_child2 = Yoga.Node.create(config); + root_child0_child0_child2.setWidth(25); + root_child0_child0_child2.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(1930); + expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(50); @@ -2019,23 +2177,28 @@ test.skip('stretch_min_width', () => { expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); - expect(root_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0.getComputedWidth()).toBe(500); expect(root_child0_child0.getComputedHeight()).toBe(50); - expect(root_child0_child1.getComputedLeft()).toBe(50); - expect(root_child0_child1.getComputedTop()).toBe(0); - expect(root_child0_child1.getComputedWidth()).toBe(100); - expect(root_child0_child1.getComputedHeight()).toBe(50); + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); - expect(root_child0_child2.getComputedLeft()).toBe(150); - expect(root_child0_child2.getComputedTop()).toBe(0); - expect(root_child0_child2.getComputedWidth()).toBe(25); - expect(root_child0_child2.getComputedHeight()).toBe(50); + expect(root_child0_child0_child1.getComputedLeft()).toBe(50); + expect(root_child0_child0_child1.getComputedTop()).toBe(0); + expect(root_child0_child0_child1.getComputedWidth()).toBe(100); + expect(root_child0_child0_child1.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child2.getComputedLeft()).toBe(150); + expect(root_child0_child0_child2.getComputedTop()).toBe(0); + expect(root_child0_child0_child2.getComputedWidth()).toBe(25); + expect(root_child0_child0_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(1930); + expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(50); @@ -2044,20 +2207,25 @@ test.skip('stretch_min_width', () => { expect(root_child0.getComputedWidth()).toBe(500); expect(root_child0.getComputedHeight()).toBe(50); - expect(root_child0_child0.getComputedLeft()).toBe(450); + expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); - expect(root_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0.getComputedWidth()).toBe(500); expect(root_child0_child0.getComputedHeight()).toBe(50); - expect(root_child0_child1.getComputedLeft()).toBe(350); - expect(root_child0_child1.getComputedTop()).toBe(0); - expect(root_child0_child1.getComputedWidth()).toBe(100); - expect(root_child0_child1.getComputedHeight()).toBe(50); + expect(root_child0_child0_child0.getComputedLeft()).toBe(450); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); - expect(root_child0_child2.getComputedLeft()).toBe(325); - expect(root_child0_child2.getComputedTop()).toBe(0); - expect(root_child0_child2.getComputedWidth()).toBe(25); - expect(root_child0_child2.getComputedHeight()).toBe(50); + expect(root_child0_child0_child1.getComputedLeft()).toBe(350); + expect(root_child0_child0_child1.getComputedTop()).toBe(0); + expect(root_child0_child0_child1.getComputedWidth()).toBe(100); + expect(root_child0_child0_child1.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child2.getComputedLeft()).toBe(325); + expect(root_child0_child0_child2.getComputedTop()).toBe(0); + expect(root_child0_child0_child2.getComputedWidth()).toBe(25); + expect(root_child0_child0_child2.getComputedHeight()).toBe(50); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); @@ -2148,81 +2316,95 @@ test.skip('fit_content_max_height', () => { try { root = Yoga.Node.create(config); - root.setHeight(90); + root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); - root_child0.setFlexWrap(Wrap.Wrap); - root_child0.setHeight(110); - root_child0.setMaxHeight("fit-content"); + root_child0.setHeight(90); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); - root_child0_child0.setWidth(50); - root_child0_child0.setHeight(50); + root_child0_child0.setFlexWrap(Wrap.Wrap); + root_child0_child0.setHeight(110); + root_child0_child0.setMaxHeight("fit-content"); root_child0.insertChild(root_child0_child0, 0); - const root_child0_child1 = Yoga.Node.create(config); - root_child0_child1.setWidth(50); - root_child0_child1.setHeight(100); - root_child0.insertChild(root_child0_child1, 1); + const root_child0_child0_child0 = Yoga.Node.create(config); + root_child0_child0_child0.setWidth(50); + root_child0_child0_child0.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child0, 0); + + const root_child0_child0_child1 = Yoga.Node.create(config); + root_child0_child0_child1.setWidth(50); + root_child0_child0_child1.setHeight(100); + root_child0_child0.insertChild(root_child0_child0_child1, 1); - const root_child0_child2 = Yoga.Node.create(config); - root_child0_child2.setWidth(50); - root_child0_child2.setHeight(25); - root_child0.insertChild(root_child0_child2, 2); + const root_child0_child0_child2 = Yoga.Node.create(config); + root_child0_child0_child2.setWidth(50); + root_child0_child0_child2.setHeight(25); + root_child0_child0.insertChild(root_child0_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(1980); - expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(90); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); - expect(root_child0.getComputedWidth()).toBe(500); - expect(root_child0.getComputedHeight()).toBe(100); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(90); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); - expect(root_child0_child0.getComputedHeight()).toBe(50); + expect(root_child0_child0.getComputedHeight()).toBe(100); - expect(root_child0_child1.getComputedLeft()).toBe(50); - expect(root_child0_child1.getComputedTop()).toBe(0); - expect(root_child0_child1.getComputedWidth()).toBe(50); - expect(root_child0_child1.getComputedHeight()).toBe(100); + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); - expect(root_child0_child2.getComputedLeft()).toBe(100); - expect(root_child0_child2.getComputedTop()).toBe(0); - expect(root_child0_child2.getComputedWidth()).toBe(50); - expect(root_child0_child2.getComputedHeight()).toBe(25); + expect(root_child0_child0_child1.getComputedLeft()).toBe(50); + expect(root_child0_child0_child1.getComputedTop()).toBe(0); + expect(root_child0_child0_child1.getComputedWidth()).toBe(50); + expect(root_child0_child0_child1.getComputedHeight()).toBe(100); + + expect(root_child0_child0_child2.getComputedLeft()).toBe(100); + expect(root_child0_child0_child2.getComputedTop()).toBe(0); + expect(root_child0_child0_child2.getComputedWidth()).toBe(50); + expect(root_child0_child0_child2.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(1980); - expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(90); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); - expect(root_child0.getComputedWidth()).toBe(500); - expect(root_child0.getComputedHeight()).toBe(100); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(90); - expect(root_child0_child0.getComputedLeft()).toBe(450); + expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); - expect(root_child0_child0.getComputedHeight()).toBe(50); - - expect(root_child0_child1.getComputedLeft()).toBe(400); - expect(root_child0_child1.getComputedTop()).toBe(0); - expect(root_child0_child1.getComputedWidth()).toBe(50); - expect(root_child0_child1.getComputedHeight()).toBe(100); - - expect(root_child0_child2.getComputedLeft()).toBe(350); - expect(root_child0_child2.getComputedTop()).toBe(0); - expect(root_child0_child2.getComputedWidth()).toBe(50); - expect(root_child0_child2.getComputedHeight()).toBe(25); + expect(root_child0_child0.getComputedHeight()).toBe(100); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child1.getComputedLeft()).toBe(-50); + expect(root_child0_child0_child1.getComputedTop()).toBe(0); + expect(root_child0_child0_child1.getComputedWidth()).toBe(50); + expect(root_child0_child0_child1.getComputedHeight()).toBe(100); + + expect(root_child0_child0_child2.getComputedLeft()).toBe(-100); + expect(root_child0_child0_child2.getComputedTop()).toBe(0); + expect(root_child0_child0_child2.getComputedWidth()).toBe(50); + expect(root_child0_child0_child2.getComputedHeight()).toBe(25); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); @@ -2237,81 +2419,95 @@ test.skip('stretch_max_height', () => { try { root = Yoga.Node.create(config); - root.setHeight(500); + root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); - root_child0.setFlexWrap(Wrap.Wrap); - root_child0.setHeight(600); - root_child0.setMaxHeight("stretch"); + root_child0.setHeight(500); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); - root_child0_child0.setWidth(50); - root_child0_child0.setHeight(50); + root_child0_child0.setFlexWrap(Wrap.Wrap); + root_child0_child0.setHeight(600); + root_child0_child0.setMaxHeight("stretch"); root_child0.insertChild(root_child0_child0, 0); - const root_child0_child1 = Yoga.Node.create(config); - root_child0_child1.setWidth(50); - root_child0_child1.setHeight(100); - root_child0.insertChild(root_child0_child1, 1); + const root_child0_child0_child0 = Yoga.Node.create(config); + root_child0_child0_child0.setWidth(50); + root_child0_child0_child0.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child0, 0); - const root_child0_child2 = Yoga.Node.create(config); - root_child0_child2.setWidth(50); - root_child0_child2.setHeight(25); - root_child0.insertChild(root_child0_child2, 2); + const root_child0_child0_child1 = Yoga.Node.create(config); + root_child0_child0_child1.setWidth(50); + root_child0_child0_child1.setHeight(100); + root_child0_child0.insertChild(root_child0_child0_child1, 1); + + const root_child0_child0_child2 = Yoga.Node.create(config); + root_child0_child0_child2.setWidth(50); + root_child0_child0_child2.setHeight(25); + root_child0_child0.insertChild(root_child0_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(2070); - expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); - expect(root_child0.getComputedWidth()).toBe(500); - expect(root_child0.getComputedHeight()).toBe(600); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(500); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); - expect(root_child0_child0.getComputedHeight()).toBe(50); + expect(root_child0_child0.getComputedHeight()).toBe(600); - expect(root_child0_child1.getComputedLeft()).toBe(0); - expect(root_child0_child1.getComputedTop()).toBe(50); - expect(root_child0_child1.getComputedWidth()).toBe(50); - expect(root_child0_child1.getComputedHeight()).toBe(100); + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); - expect(root_child0_child2.getComputedLeft()).toBe(0); - expect(root_child0_child2.getComputedTop()).toBe(150); - expect(root_child0_child2.getComputedWidth()).toBe(50); - expect(root_child0_child2.getComputedHeight()).toBe(25); + expect(root_child0_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child0_child1.getComputedTop()).toBe(50); + expect(root_child0_child0_child1.getComputedWidth()).toBe(50); + expect(root_child0_child0_child1.getComputedHeight()).toBe(100); + + expect(root_child0_child0_child2.getComputedLeft()).toBe(0); + expect(root_child0_child0_child2.getComputedTop()).toBe(150); + expect(root_child0_child0_child2.getComputedWidth()).toBe(50); + expect(root_child0_child0_child2.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(2070); - expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); - expect(root_child0.getComputedWidth()).toBe(500); - expect(root_child0.getComputedHeight()).toBe(600); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(500); - expect(root_child0_child0.getComputedLeft()).toBe(450); + expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); - expect(root_child0_child0.getComputedHeight()).toBe(50); - - expect(root_child0_child1.getComputedLeft()).toBe(450); - expect(root_child0_child1.getComputedTop()).toBe(50); - expect(root_child0_child1.getComputedWidth()).toBe(50); - expect(root_child0_child1.getComputedHeight()).toBe(100); - - expect(root_child0_child2.getComputedLeft()).toBe(450); - expect(root_child0_child2.getComputedTop()).toBe(150); - expect(root_child0_child2.getComputedWidth()).toBe(50); - expect(root_child0_child2.getComputedHeight()).toBe(25); + expect(root_child0_child0.getComputedHeight()).toBe(600); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child0_child1.getComputedTop()).toBe(50); + expect(root_child0_child0_child1.getComputedWidth()).toBe(50); + expect(root_child0_child0_child1.getComputedHeight()).toBe(100); + + expect(root_child0_child0_child2.getComputedLeft()).toBe(0); + expect(root_child0_child0_child2.getComputedTop()).toBe(150); + expect(root_child0_child0_child2.getComputedWidth()).toBe(50); + expect(root_child0_child0_child2.getComputedHeight()).toBe(25); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); @@ -2402,81 +2598,95 @@ test.skip('fit_content_min_height', () => { try { root = Yoga.Node.create(config); - root.setHeight(90); + root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); - root_child0.setFlexWrap(Wrap.Wrap); root_child0.setHeight(90); - root_child0.setMinHeight("fit-content"); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); - root_child0_child0.setWidth(50); - root_child0_child0.setHeight(50); + root_child0_child0.setFlexWrap(Wrap.Wrap); + root_child0_child0.setHeight(90); + root_child0_child0.setMinHeight("fit-content"); root_child0.insertChild(root_child0_child0, 0); - const root_child0_child1 = Yoga.Node.create(config); - root_child0_child1.setWidth(50); - root_child0_child1.setHeight(100); - root_child0.insertChild(root_child0_child1, 1); + const root_child0_child0_child0 = Yoga.Node.create(config); + root_child0_child0_child0.setWidth(50); + root_child0_child0_child0.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child0, 0); + + const root_child0_child0_child1 = Yoga.Node.create(config); + root_child0_child0_child1.setWidth(50); + root_child0_child0_child1.setHeight(100); + root_child0_child0.insertChild(root_child0_child0_child1, 1); - const root_child0_child2 = Yoga.Node.create(config); - root_child0_child2.setWidth(50); - root_child0_child2.setHeight(25); - root_child0.insertChild(root_child0_child2, 2); + const root_child0_child0_child2 = Yoga.Node.create(config); + root_child0_child0_child2.setWidth(50); + root_child0_child0_child2.setHeight(25); + root_child0_child0.insertChild(root_child0_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(2570); - expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(90); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); - expect(root_child0.getComputedWidth()).toBe(500); - expect(root_child0.getComputedHeight()).toBe(175); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(90); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); - expect(root_child0_child0.getComputedHeight()).toBe(50); + expect(root_child0_child0.getComputedHeight()).toBe(175); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); - expect(root_child0_child1.getComputedLeft()).toBe(0); - expect(root_child0_child1.getComputedTop()).toBe(50); - expect(root_child0_child1.getComputedWidth()).toBe(50); - expect(root_child0_child1.getComputedHeight()).toBe(100); + expect(root_child0_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child0_child1.getComputedTop()).toBe(50); + expect(root_child0_child0_child1.getComputedWidth()).toBe(50); + expect(root_child0_child0_child1.getComputedHeight()).toBe(100); - expect(root_child0_child2.getComputedLeft()).toBe(0); - expect(root_child0_child2.getComputedTop()).toBe(150); - expect(root_child0_child2.getComputedWidth()).toBe(50); - expect(root_child0_child2.getComputedHeight()).toBe(25); + expect(root_child0_child0_child2.getComputedLeft()).toBe(0); + expect(root_child0_child0_child2.getComputedTop()).toBe(150); + expect(root_child0_child0_child2.getComputedWidth()).toBe(50); + expect(root_child0_child0_child2.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(2570); - expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(90); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); - expect(root_child0.getComputedWidth()).toBe(500); - expect(root_child0.getComputedHeight()).toBe(175); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(90); - expect(root_child0_child0.getComputedLeft()).toBe(450); + expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); - expect(root_child0_child0.getComputedHeight()).toBe(50); - - expect(root_child0_child1.getComputedLeft()).toBe(450); - expect(root_child0_child1.getComputedTop()).toBe(50); - expect(root_child0_child1.getComputedWidth()).toBe(50); - expect(root_child0_child1.getComputedHeight()).toBe(100); - - expect(root_child0_child2.getComputedLeft()).toBe(450); - expect(root_child0_child2.getComputedTop()).toBe(150); - expect(root_child0_child2.getComputedWidth()).toBe(50); - expect(root_child0_child2.getComputedHeight()).toBe(25); + expect(root_child0_child0.getComputedHeight()).toBe(175); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child0_child1.getComputedTop()).toBe(50); + expect(root_child0_child0_child1.getComputedWidth()).toBe(50); + expect(root_child0_child0_child1.getComputedHeight()).toBe(100); + + expect(root_child0_child0_child2.getComputedLeft()).toBe(0); + expect(root_child0_child0_child2.getComputedTop()).toBe(150); + expect(root_child0_child0_child2.getComputedWidth()).toBe(50); + expect(root_child0_child0_child2.getComputedHeight()).toBe(25); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); @@ -2491,81 +2701,95 @@ test.skip('stretch_min_height', () => { try { root = Yoga.Node.create(config); - root.setHeight(500); + root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); - root_child0.setFlexWrap(Wrap.Wrap); - root_child0.setHeight(400); - root_child0.setMinHeight("stretch"); + root_child0.setHeight(500); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); - root_child0_child0.setWidth(50); - root_child0_child0.setHeight(50); + root_child0_child0.setFlexWrap(Wrap.Wrap); + root_child0_child0.setHeight(400); + root_child0_child0.setMinHeight("stretch"); root_child0.insertChild(root_child0_child0, 0); - const root_child0_child1 = Yoga.Node.create(config); - root_child0_child1.setWidth(50); - root_child0_child1.setHeight(100); - root_child0.insertChild(root_child0_child1, 1); + const root_child0_child0_child0 = Yoga.Node.create(config); + root_child0_child0_child0.setWidth(50); + root_child0_child0_child0.setHeight(50); + root_child0_child0.insertChild(root_child0_child0_child0, 0); - const root_child0_child2 = Yoga.Node.create(config); - root_child0_child2.setWidth(50); - root_child0_child2.setHeight(25); - root_child0.insertChild(root_child0_child2, 2); + const root_child0_child0_child1 = Yoga.Node.create(config); + root_child0_child0_child1.setWidth(50); + root_child0_child0_child1.setHeight(100); + root_child0_child0.insertChild(root_child0_child0_child1, 1); + + const root_child0_child0_child2 = Yoga.Node.create(config); + root_child0_child0_child2.setWidth(50); + root_child0_child0_child2.setHeight(25); + root_child0_child0.insertChild(root_child0_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(2660); - expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); - expect(root_child0.getComputedWidth()).toBe(500); - expect(root_child0.getComputedHeight()).toBe(400); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(500); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); - expect(root_child0_child0.getComputedHeight()).toBe(50); + expect(root_child0_child0.getComputedHeight()).toBe(400); - expect(root_child0_child1.getComputedLeft()).toBe(0); - expect(root_child0_child1.getComputedTop()).toBe(50); - expect(root_child0_child1.getComputedWidth()).toBe(50); - expect(root_child0_child1.getComputedHeight()).toBe(100); + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); - expect(root_child0_child2.getComputedLeft()).toBe(0); - expect(root_child0_child2.getComputedTop()).toBe(150); - expect(root_child0_child2.getComputedWidth()).toBe(50); - expect(root_child0_child2.getComputedHeight()).toBe(25); + expect(root_child0_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child0_child1.getComputedTop()).toBe(50); + expect(root_child0_child0_child1.getComputedWidth()).toBe(50); + expect(root_child0_child0_child1.getComputedHeight()).toBe(100); + + expect(root_child0_child0_child2.getComputedLeft()).toBe(0); + expect(root_child0_child0_child2.getComputedTop()).toBe(150); + expect(root_child0_child0_child2.getComputedWidth()).toBe(50); + expect(root_child0_child0_child2.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(2660); - expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); - expect(root_child0.getComputedWidth()).toBe(500); - expect(root_child0.getComputedHeight()).toBe(400); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(500); - expect(root_child0_child0.getComputedLeft()).toBe(450); + expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); - expect(root_child0_child0.getComputedHeight()).toBe(50); - - expect(root_child0_child1.getComputedLeft()).toBe(450); - expect(root_child0_child1.getComputedTop()).toBe(50); - expect(root_child0_child1.getComputedWidth()).toBe(50); - expect(root_child0_child1.getComputedHeight()).toBe(100); - - expect(root_child0_child2.getComputedLeft()).toBe(450); - expect(root_child0_child2.getComputedTop()).toBe(150); - expect(root_child0_child2.getComputedWidth()).toBe(50); - expect(root_child0_child2.getComputedHeight()).toBe(25); + expect(root_child0_child0.getComputedHeight()).toBe(400); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child0_child1.getComputedTop()).toBe(50); + expect(root_child0_child0_child1.getComputedWidth()).toBe(50); + expect(root_child0_child0_child1.getComputedHeight()).toBe(100); + + expect(root_child0_child0_child2.getComputedLeft()).toBe(0); + expect(root_child0_child0_child2.getComputedTop()).toBe(150); + expect(root_child0_child0_child2.getComputedWidth()).toBe(50); + expect(root_child0_child0_child2.getComputedHeight()).toBe(25); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); diff --git a/tests/generated/YGIntrinsicSizeTest.cpp b/tests/generated/YGIntrinsicSizeTest.cpp index 268964c9ac..a2c065e83c 100644 --- a/tests/generated/YGIntrinsicSizeTest.cpp +++ b/tests/generated/YGIntrinsicSizeTest.cpp @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * clang-format off - * @generated SignedSource<<7a5bad4cb091610dd7998a52fd7ea1cf>> + * @generated SignedSource<> * generated by gentest/gentest-driver.ts from gentest/fixtures/YGIntrinsicSizeTest.html */ @@ -574,28 +574,32 @@ TEST(YogaTest, fit_content_width) { YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root, 90); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow); - YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap); - YGNodeStyleSetWidthFitContent(root_child0); + YGNodeStyleSetWidth(root_child0, 90); YGNodeInsertChild(root, root_child0, 0); YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child0, 50); - YGNodeStyleSetHeight(root_child0_child0, 50); + YGNodeStyleSetFlexDirection(root_child0_child0, YGFlexDirectionRow); + YGNodeStyleSetFlexWrap(root_child0_child0, YGWrapWrap); + YGNodeStyleSetWidthFitContent(root_child0_child0); YGNodeInsertChild(root_child0, root_child0_child0, 0); - YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child1, 100); - YGNodeStyleSetHeight(root_child0_child1, 50); - YGNodeInsertChild(root_child0, root_child0_child1, 1); + YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child0, 50); + YGNodeStyleSetHeight(root_child0_child0_child0, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0); - YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child2, 25); - YGNodeStyleSetHeight(root_child0_child2, 50); - YGNodeInsertChild(root_child0, root_child0_child2, 2); + YGNodeRef root_child0_child0_child1 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child1, 100); + YGNodeStyleSetHeight(root_child0_child0_child1, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child1, 1); + + YGNodeRef root_child0_child0_child2 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child2, 25); + YGNodeStyleSetHeight(root_child0_child0_child2, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child2, 2); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); @@ -605,23 +609,28 @@ TEST(YogaTest, fit_content_width) { ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(90, YGNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(150, 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(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child1)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); @@ -630,25 +639,30 @@ TEST(YogaTest, fit_content_width) { ASSERT_FLOAT_EQ(90, YGNodeLayoutGetWidth(root)); ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root)); - ASSERT_FLOAT_EQ(-10, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(90, YGNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(-10, YGNodeLayoutGetLeft(root_child0_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root_child0_child0)); + + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child1)); - ASSERT_FLOAT_EQ(75, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(75, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeFreeRecursive(root); @@ -661,32 +675,36 @@ TEST(YogaTest, stretch_width) { YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root, 500); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow); - YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap); - YGNodeStyleSetWidthStretch(root_child0); + YGNodeStyleSetWidth(root_child0, 500); YGNodeInsertChild(root, root_child0, 0); YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child0, 50); - YGNodeStyleSetHeight(root_child0_child0, 50); + YGNodeStyleSetFlexDirection(root_child0_child0, YGFlexDirectionRow); + YGNodeStyleSetFlexWrap(root_child0_child0, YGWrapWrap); + YGNodeStyleSetWidthStretch(root_child0_child0); YGNodeInsertChild(root_child0, root_child0_child0, 0); - YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child1, 100); - YGNodeStyleSetHeight(root_child0_child1, 50); - YGNodeInsertChild(root_child0, root_child0_child1, 1); + YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child0, 50); + YGNodeStyleSetHeight(root_child0_child0_child0, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0); - YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child2, 25); - YGNodeStyleSetHeight(root_child0_child2, 50); - YGNodeInsertChild(root_child0, root_child0_child2, 2); + YGNodeRef root_child0_child0_child1 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child1, 100); + YGNodeStyleSetHeight(root_child0_child0_child1, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child1, 1); + + YGNodeRef root_child0_child0_child2 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child2, 25); + YGNodeStyleSetHeight(root_child0_child0_child2, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child2, 2); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root)); @@ -697,23 +715,28 @@ TEST(YogaTest, stretch_width) { ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0_child0)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); + + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child1)); - ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root)); @@ -722,20 +745,25 @@ TEST(YogaTest, stretch_width) { ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0)); - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0_child0)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); - ASSERT_FLOAT_EQ(350, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1)); + ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); + + ASSERT_FLOAT_EQ(350, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child1)); - ASSERT_FLOAT_EQ(325, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(325, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeFreeRecursive(root); @@ -819,80 +847,94 @@ TEST(YogaTest, fit_content_height) { YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetHeight(root, 90); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap); - YGNodeStyleSetHeightFitContent(root_child0); + YGNodeStyleSetHeight(root_child0, 90); YGNodeInsertChild(root, root_child0, 0); YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child0, 50); - YGNodeStyleSetHeight(root_child0_child0, 50); + YGNodeStyleSetFlexWrap(root_child0_child0, YGWrapWrap); + YGNodeStyleSetHeightFitContent(root_child0_child0); YGNodeInsertChild(root_child0, root_child0_child0, 0); - YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child1, 50); - YGNodeStyleSetHeight(root_child0_child1, 100); - YGNodeInsertChild(root_child0, root_child0_child1, 1); + YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child0, 50); + YGNodeStyleSetHeight(root_child0_child0_child0, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0); - YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child2, 50); - YGNodeStyleSetHeight(root_child0_child2, 25); - YGNodeInsertChild(root_child0, root_child0_child2, 2); + YGNodeRef root_child0_child0_child1 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child1, 50); + YGNodeStyleSetHeight(root_child0_child0_child1, 100); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child1, 1); + + YGNodeRef root_child0_child0_child2 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child2, 50); + YGNodeStyleSetHeight(root_child0_child0_child2, 25); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child2, 2); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(200, YGNodeLayoutGetTop(root)); - ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root)); ASSERT_FLOAT_EQ(90, 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(175, YGNodeLayoutGetHeight(root_child0)); + ASSERT_FLOAT_EQ(50, 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(50, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); + ASSERT_FLOAT_EQ(175, 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(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0_child1)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(200, YGNodeLayoutGetTop(root)); - ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root)); ASSERT_FLOAT_EQ(90, 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(175, YGNodeLayoutGetHeight(root_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(90, YGNodeLayoutGetHeight(root_child0)); - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); + ASSERT_FLOAT_EQ(175, YGNodeLayoutGetHeight(root_child0_child0)); - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0_child1)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeFreeRecursive(root); @@ -905,80 +947,94 @@ TEST(YogaTest, stretch_height) { YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetHeight(root, 500); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap); - YGNodeStyleSetHeightStretch(root_child0); + YGNodeStyleSetHeight(root_child0, 500); YGNodeInsertChild(root, root_child0, 0); YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child0, 50); - YGNodeStyleSetHeight(root_child0_child0, 50); + YGNodeStyleSetFlexWrap(root_child0_child0, YGWrapWrap); + YGNodeStyleSetHeightStretch(root_child0_child0); YGNodeInsertChild(root_child0, root_child0_child0, 0); - YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child1, 50); - YGNodeStyleSetHeight(root_child0_child1, 100); - YGNodeInsertChild(root_child0, root_child0_child1, 1); + YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child0, 50); + YGNodeStyleSetHeight(root_child0_child0_child0, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0); - YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child2, 50); - YGNodeStyleSetHeight(root_child0_child2, 25); - YGNodeInsertChild(root_child0, root_child0_child2, 2); + YGNodeRef root_child0_child0_child1 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child1, 50); + YGNodeStyleSetHeight(root_child0_child0_child1, 100); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child1, 1); + + YGNodeRef root_child0_child0_child2 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child2, 50); + YGNodeStyleSetHeight(root_child0_child0_child2, 25); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child2, 2); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(290, YGNodeLayoutGetTop(root)); - ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(50, 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(175, YGNodeLayoutGetHeight(root_child0)); + ASSERT_FLOAT_EQ(50, 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(50, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); + ASSERT_FLOAT_EQ(175, 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(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0_child1)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(290, YGNodeLayoutGetTop(root)); - ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(50, 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(175, YGNodeLayoutGetHeight(root_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root_child0)); - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); + ASSERT_FLOAT_EQ(175, 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(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0_child1)); - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeFreeRecursive(root); @@ -1062,80 +1118,94 @@ TEST(YogaTest, fit_content_flex_basis_column) { YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetHeight(root, 90); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap); - YGNodeStyleSetFlexBasisFitContent(root_child0); + YGNodeStyleSetHeight(root_child0, 90); YGNodeInsertChild(root, root_child0, 0); YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child0, 50); - YGNodeStyleSetHeight(root_child0_child0, 50); + YGNodeStyleSetFlexWrap(root_child0_child0, YGWrapWrap); + YGNodeStyleSetFlexBasisFitContent(root_child0_child0); YGNodeInsertChild(root_child0, root_child0_child0, 0); - YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child1, 50); - YGNodeStyleSetHeight(root_child0_child1, 100); - YGNodeInsertChild(root_child0, root_child0_child1, 1); + YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child0, 50); + YGNodeStyleSetHeight(root_child0_child0_child0, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0); - YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child2, 50); - YGNodeStyleSetHeight(root_child0_child2, 25); - YGNodeInsertChild(root_child0, root_child0_child2, 2); + YGNodeRef root_child0_child0_child1 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child1, 50); + YGNodeStyleSetHeight(root_child0_child0_child1, 100); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child1, 1); + + YGNodeRef root_child0_child0_child2 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child2, 50); + YGNodeStyleSetHeight(root_child0_child0_child2, 25); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child2, 2); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(790, YGNodeLayoutGetTop(root)); - ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root)); ASSERT_FLOAT_EQ(90, 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(175, YGNodeLayoutGetHeight(root_child0)); + ASSERT_FLOAT_EQ(50, 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(50, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); + ASSERT_FLOAT_EQ(175, YGNodeLayoutGetHeight(root_child0_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0_child1)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(790, YGNodeLayoutGetTop(root)); - ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root)); ASSERT_FLOAT_EQ(90, 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(175, YGNodeLayoutGetHeight(root_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(90, YGNodeLayoutGetHeight(root_child0)); - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); + ASSERT_FLOAT_EQ(175, YGNodeLayoutGetHeight(root_child0_child0)); - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0_child1)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeFreeRecursive(root); @@ -1148,79 +1218,93 @@ TEST(YogaTest, stretch_flex_basis_column) { YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetHeight(root, 500); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap); + YGNodeStyleSetHeight(root_child0, 500); YGNodeInsertChild(root, root_child0, 0); YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child0, 50); - YGNodeStyleSetHeight(root_child0_child0, 50); + YGNodeStyleSetFlexWrap(root_child0_child0, YGWrapWrap); YGNodeInsertChild(root_child0, root_child0_child0, 0); - YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child1, 50); - YGNodeStyleSetHeight(root_child0_child1, 100); - YGNodeInsertChild(root_child0, root_child0_child1, 1); + YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child0, 50); + YGNodeStyleSetHeight(root_child0_child0_child0, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0); - YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child2, 50); - YGNodeStyleSetHeight(root_child0_child2, 25); - YGNodeInsertChild(root_child0, root_child0_child2, 2); + YGNodeRef root_child0_child0_child1 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child1, 50); + YGNodeStyleSetHeight(root_child0_child0_child1, 100); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child1, 1); + + YGNodeRef root_child0_child0_child2 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child2, 50); + YGNodeStyleSetHeight(root_child0_child0_child2, 25); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child2, 2); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(880, YGNodeLayoutGetTop(root)); - ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(50, 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(175, YGNodeLayoutGetHeight(root_child0)); + ASSERT_FLOAT_EQ(50, 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(50, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); + ASSERT_FLOAT_EQ(175, 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(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0_child1)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(880, YGNodeLayoutGetTop(root)); - ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(50, 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(175, YGNodeLayoutGetHeight(root_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root_child0)); - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); + ASSERT_FLOAT_EQ(175, 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(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0_child1)); - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeFreeRecursive(root); @@ -1228,6 +1312,8 @@ TEST(YogaTest, stretch_flex_basis_column) { } TEST(YogaTest, max_content_flex_basis_row) { + GTEST_SKIP(); + YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); @@ -1254,21 +1340,21 @@ TEST(YogaTest, max_content_flex_basis_row) { ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); - ASSERT_FLOAT_EQ(175, YGNodeLayoutGetWidth(root)); - ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(600, YGNodeLayoutGetHeight(root)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1)); ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child1)); ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root_child1)); - ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child2)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2)); + ASSERT_FLOAT_EQ(550, YGNodeLayoutGetTop(root_child2)); ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child2)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2)); @@ -1276,21 +1362,21 @@ TEST(YogaTest, max_content_flex_basis_row) { ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); - ASSERT_FLOAT_EQ(175, YGNodeLayoutGetWidth(root)); - ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(600, YGNodeLayoutGetHeight(root)); - ASSERT_FLOAT_EQ(125, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetLeft(root_child1)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1)); ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child1)); ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root_child1)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2)); + ASSERT_FLOAT_EQ(75, YGNodeLayoutGetLeft(root_child2)); + ASSERT_FLOAT_EQ(550, YGNodeLayoutGetTop(root_child2)); ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child2)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2)); @@ -1305,32 +1391,36 @@ TEST(YogaTest, fit_content_flex_basis_row) { YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root, 90); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow); - YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap); - YGNodeStyleSetFlexBasisFitContent(root_child0); + YGNodeStyleSetWidth(root_child0, 90); YGNodeInsertChild(root, root_child0, 0); YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child0, 50); - YGNodeStyleSetHeight(root_child0_child0, 50); + YGNodeStyleSetFlexDirection(root_child0_child0, YGFlexDirectionRow); + YGNodeStyleSetFlexWrap(root_child0_child0, YGWrapWrap); + YGNodeStyleSetFlexBasisFitContent(root_child0_child0); YGNodeInsertChild(root_child0, root_child0_child0, 0); - YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child1, 100); - YGNodeStyleSetHeight(root_child0_child1, 50); - YGNodeInsertChild(root_child0, root_child0_child1, 1); + YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child0, 50); + YGNodeStyleSetHeight(root_child0_child0_child0, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0); - YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child2, 25); - YGNodeStyleSetHeight(root_child0_child2, 50); - YGNodeInsertChild(root_child0, root_child0_child2, 2); + YGNodeRef root_child0_child0_child1 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child1, 100); + YGNodeStyleSetHeight(root_child0_child0_child1, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child1, 1); + + YGNodeRef root_child0_child0_child2 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child2, 25); + YGNodeStyleSetHeight(root_child0_child0_child2, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child2, 2); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(1380, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(90, YGNodeLayoutGetWidth(root)); ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root)); @@ -1341,23 +1431,28 @@ TEST(YogaTest, fit_content_flex_basis_row) { ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); + ASSERT_FLOAT_EQ(90, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root_child0_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child1)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(1380, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(90, YGNodeLayoutGetWidth(root)); ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root)); @@ -1366,20 +1461,25 @@ TEST(YogaTest, fit_content_flex_basis_row) { ASSERT_FLOAT_EQ(90, YGNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root_child0)); - ASSERT_FLOAT_EQ(40, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); + ASSERT_FLOAT_EQ(90, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root_child0_child0)); + + ASSERT_FLOAT_EQ(40, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(-10, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1)); + ASSERT_FLOAT_EQ(-10, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child1)); - ASSERT_FLOAT_EQ(65, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(65, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeFreeRecursive(root); @@ -1392,31 +1492,35 @@ TEST(YogaTest, stretch_flex_basis_row) { YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root, 500); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow); - YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap); + YGNodeStyleSetWidth(root_child0, 500); YGNodeInsertChild(root, root_child0, 0); YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child0, 50); - YGNodeStyleSetHeight(root_child0_child0, 50); + YGNodeStyleSetFlexDirection(root_child0_child0, YGFlexDirectionRow); + YGNodeStyleSetFlexWrap(root_child0_child0, YGWrapWrap); YGNodeInsertChild(root_child0, root_child0_child0, 0); - YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child1, 100); - YGNodeStyleSetHeight(root_child0_child1, 50); - YGNodeInsertChild(root_child0, root_child0_child1, 1); + YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child0, 50); + YGNodeStyleSetHeight(root_child0_child0_child0, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0); - YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child2, 25); - YGNodeStyleSetHeight(root_child0_child2, 50); - YGNodeInsertChild(root_child0, root_child0_child2, 2); + YGNodeRef root_child0_child0_child1 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child1, 100); + YGNodeStyleSetHeight(root_child0_child0_child1, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child1, 1); + + YGNodeRef root_child0_child0_child2 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child2, 25); + YGNodeStyleSetHeight(root_child0_child0_child2, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child2, 2); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(1530, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root)); @@ -1427,23 +1531,28 @@ TEST(YogaTest, stretch_flex_basis_row) { ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0_child0)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); + + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child1)); - ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(1530, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root)); @@ -1452,20 +1561,25 @@ TEST(YogaTest, stretch_flex_basis_row) { ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0)); - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0_child0)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); - ASSERT_FLOAT_EQ(350, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1)); + ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(325, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(350, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child1)); + + ASSERT_FLOAT_EQ(325, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeFreeRecursive(root); @@ -1553,82 +1667,96 @@ TEST(YogaTest, fit_content_max_width) { YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root, 90); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow); - YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap); - YGNodeStyleSetWidth(root_child0, 110); - YGNodeStyleSetMaxWidthFitContent(root_child0); + YGNodeStyleSetWidth(root_child0, 90); YGNodeInsertChild(root, root_child0, 0); YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child0, 50); - YGNodeStyleSetHeight(root_child0_child0, 50); + YGNodeStyleSetFlexDirection(root_child0_child0, YGFlexDirectionRow); + YGNodeStyleSetFlexWrap(root_child0_child0, YGWrapWrap); + YGNodeStyleSetWidth(root_child0_child0, 110); + YGNodeStyleSetMaxWidthFitContent(root_child0_child0); YGNodeInsertChild(root_child0, root_child0_child0, 0); - YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child1, 100); - YGNodeStyleSetHeight(root_child0_child1, 50); - YGNodeInsertChild(root_child0, root_child0_child1, 1); + YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child0, 50); + YGNodeStyleSetHeight(root_child0_child0_child0, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0); - YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child2, 25); - YGNodeStyleSetHeight(root_child0_child2, 50); - YGNodeInsertChild(root_child0, root_child0_child2, 2); + YGNodeRef root_child0_child0_child1 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child1, 100); + YGNodeStyleSetHeight(root_child0_child0_child1, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child1, 1); + + YGNodeRef root_child0_child0_child2 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child2, 25); + YGNodeStyleSetHeight(root_child0_child0_child2, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child2, 2); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(1580, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(90, YGNodeLayoutGetWidth(root)); ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(90, YGNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root_child0_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child1)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(1580, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(90, YGNodeLayoutGetWidth(root)); ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root)); - ASSERT_FLOAT_EQ(-10, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(90, YGNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(-10, YGNodeLayoutGetLeft(root_child0_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root_child0_child0)); + + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child1)); - ASSERT_FLOAT_EQ(75, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(75, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeFreeRecursive(root); @@ -1641,33 +1769,37 @@ TEST(YogaTest, stretch_max_width) { YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root, 500); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow); - YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap); - YGNodeStyleSetWidth(root_child0, 600); - YGNodeStyleSetMaxWidthStretch(root_child0); + YGNodeStyleSetWidth(root_child0, 500); YGNodeInsertChild(root, root_child0, 0); YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child0, 50); - YGNodeStyleSetHeight(root_child0_child0, 50); + YGNodeStyleSetFlexDirection(root_child0_child0, YGFlexDirectionRow); + YGNodeStyleSetFlexWrap(root_child0_child0, YGWrapWrap); + YGNodeStyleSetWidth(root_child0_child0, 600); + YGNodeStyleSetMaxWidthStretch(root_child0_child0); YGNodeInsertChild(root_child0, root_child0_child0, 0); - YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child1, 100); - YGNodeStyleSetHeight(root_child0_child1, 50); - YGNodeInsertChild(root_child0, root_child0_child1, 1); + YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child0, 50); + YGNodeStyleSetHeight(root_child0_child0_child0, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0); - YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child2, 25); - YGNodeStyleSetHeight(root_child0_child2, 50); - YGNodeInsertChild(root_child0, root_child0_child2, 2); + YGNodeRef root_child0_child0_child1 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child1, 100); + YGNodeStyleSetHeight(root_child0_child0_child1, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child1, 1); + + YGNodeRef root_child0_child0_child2 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child2, 25); + YGNodeStyleSetHeight(root_child0_child0_child2, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child2, 2); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(1730, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root)); @@ -1678,23 +1810,28 @@ TEST(YogaTest, stretch_max_width) { ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0_child0)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); + + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child1)); - ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(1730, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root)); @@ -1703,20 +1840,25 @@ TEST(YogaTest, stretch_max_width) { ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0)); - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0_child0)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); - ASSERT_FLOAT_EQ(350, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1)); + ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); + + ASSERT_FLOAT_EQ(350, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child1)); - ASSERT_FLOAT_EQ(325, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(325, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeFreeRecursive(root); @@ -1804,82 +1946,96 @@ TEST(YogaTest, fit_content_min_width) { YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root, 90); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow); - YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap); YGNodeStyleSetWidth(root_child0, 90); - YGNodeStyleSetMinWidthFitContent(root_child0); YGNodeInsertChild(root, root_child0, 0); YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child0, 50); - YGNodeStyleSetHeight(root_child0_child0, 50); + YGNodeStyleSetFlexDirection(root_child0_child0, YGFlexDirectionRow); + YGNodeStyleSetFlexWrap(root_child0_child0, YGWrapWrap); + YGNodeStyleSetWidth(root_child0_child0, 90); + YGNodeStyleSetMinWidthFitContent(root_child0_child0); YGNodeInsertChild(root_child0, root_child0_child0, 0); - YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child1, 100); - YGNodeStyleSetHeight(root_child0_child1, 50); - YGNodeInsertChild(root_child0, root_child0_child1, 1); + YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child0, 50); + YGNodeStyleSetHeight(root_child0_child0_child0, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0); + + YGNodeRef root_child0_child0_child1 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child1, 100); + YGNodeStyleSetHeight(root_child0_child0_child1, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child1, 1); - YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child2, 25); - YGNodeStyleSetHeight(root_child0_child2, 50); - YGNodeInsertChild(root_child0, root_child0_child2, 2); + YGNodeRef root_child0_child0_child2 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child2, 25); + YGNodeStyleSetHeight(root_child0_child0_child2, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child2, 2); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(1780, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(90, YGNodeLayoutGetWidth(root)); ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(90, YGNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(150, 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(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child1)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(1780, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(90, YGNodeLayoutGetWidth(root)); ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root)); - ASSERT_FLOAT_EQ(-10, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(90, YGNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(-10, YGNodeLayoutGetLeft(root_child0_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root_child0_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(75, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child1)); + + ASSERT_FLOAT_EQ(75, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeFreeRecursive(root); @@ -1892,33 +2048,37 @@ TEST(YogaTest, stretch_min_width) { YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root, 500); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow); - YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap); - YGNodeStyleSetWidth(root_child0, 400); - YGNodeStyleSetMinWidthStretch(root_child0); + YGNodeStyleSetWidth(root_child0, 500); YGNodeInsertChild(root, root_child0, 0); YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child0, 50); - YGNodeStyleSetHeight(root_child0_child0, 50); + YGNodeStyleSetFlexDirection(root_child0_child0, YGFlexDirectionRow); + YGNodeStyleSetFlexWrap(root_child0_child0, YGWrapWrap); + YGNodeStyleSetWidth(root_child0_child0, 400); + YGNodeStyleSetMinWidthStretch(root_child0_child0); YGNodeInsertChild(root_child0, root_child0_child0, 0); - YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child1, 100); - YGNodeStyleSetHeight(root_child0_child1, 50); - YGNodeInsertChild(root_child0, root_child0_child1, 1); + YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child0, 50); + YGNodeStyleSetHeight(root_child0_child0_child0, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0); + + YGNodeRef root_child0_child0_child1 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child1, 100); + YGNodeStyleSetHeight(root_child0_child0_child1, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child1, 1); - YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child2, 25); - YGNodeStyleSetHeight(root_child0_child2, 50); - YGNodeInsertChild(root_child0, root_child0_child2, 2); + YGNodeRef root_child0_child0_child2 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child2, 25); + YGNodeStyleSetHeight(root_child0_child0_child2, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child2, 2); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(1930, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root)); @@ -1929,23 +2089,28 @@ TEST(YogaTest, stretch_min_width) { ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0_child0)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child1)); + + ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(1930, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root)); @@ -1954,20 +2119,25 @@ TEST(YogaTest, stretch_min_width) { ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0)); - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0_child0)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); - ASSERT_FLOAT_EQ(350, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1)); + ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(325, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(350, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child1)); + + ASSERT_FLOAT_EQ(325, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeFreeRecursive(root); @@ -2054,81 +2224,95 @@ TEST(YogaTest, fit_content_max_height) { YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetHeight(root, 90); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap); - YGNodeStyleSetHeight(root_child0, 110); - YGNodeStyleSetMaxHeightFitContent(root_child0); + YGNodeStyleSetHeight(root_child0, 90); YGNodeInsertChild(root, root_child0, 0); YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child0, 50); - YGNodeStyleSetHeight(root_child0_child0, 50); + YGNodeStyleSetFlexWrap(root_child0_child0, YGWrapWrap); + YGNodeStyleSetHeight(root_child0_child0, 110); + YGNodeStyleSetMaxHeightFitContent(root_child0_child0); YGNodeInsertChild(root_child0, root_child0_child0, 0); - YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child1, 50); - YGNodeStyleSetHeight(root_child0_child1, 100); - YGNodeInsertChild(root_child0, root_child0_child1, 1); + YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child0, 50); + YGNodeStyleSetHeight(root_child0_child0_child0, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0); + + YGNodeRef root_child0_child0_child1 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child1, 50); + YGNodeStyleSetHeight(root_child0_child0_child1, 100); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child1, 1); - YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child2, 50); - YGNodeStyleSetHeight(root_child0_child2, 25); - YGNodeInsertChild(root_child0, root_child0_child2, 2); + YGNodeRef root_child0_child0_child2 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child2, 50); + YGNodeStyleSetHeight(root_child0_child0_child2, 25); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child2, 2); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(1980, YGNodeLayoutGetTop(root)); - ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root)); ASSERT_FLOAT_EQ(90, 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(100, YGNodeLayoutGetHeight(root_child0)); + ASSERT_FLOAT_EQ(50, 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(50, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0_child1)); + + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(1980, YGNodeLayoutGetTop(root)); - ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root)); ASSERT_FLOAT_EQ(90, 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(100, YGNodeLayoutGetHeight(root_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(90, YGNodeLayoutGetHeight(root_child0)); - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); + ASSERT_FLOAT_EQ(100, 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(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(400, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1)); + ASSERT_FLOAT_EQ(-50, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0_child1)); - ASSERT_FLOAT_EQ(350, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(-100, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeFreeRecursive(root); @@ -2141,81 +2325,95 @@ TEST(YogaTest, stretch_max_height) { YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetHeight(root, 500); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap); - YGNodeStyleSetHeight(root_child0, 600); - YGNodeStyleSetMaxHeightStretch(root_child0); + YGNodeStyleSetHeight(root_child0, 500); YGNodeInsertChild(root, root_child0, 0); YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child0, 50); - YGNodeStyleSetHeight(root_child0_child0, 50); + YGNodeStyleSetFlexWrap(root_child0_child0, YGWrapWrap); + YGNodeStyleSetHeight(root_child0_child0, 600); + YGNodeStyleSetMaxHeightStretch(root_child0_child0); YGNodeInsertChild(root_child0, root_child0_child0, 0); - YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child1, 50); - YGNodeStyleSetHeight(root_child0_child1, 100); - YGNodeInsertChild(root_child0, root_child0_child1, 1); + YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child0, 50); + YGNodeStyleSetHeight(root_child0_child0_child0, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0); + + YGNodeRef root_child0_child0_child1 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child1, 50); + YGNodeStyleSetHeight(root_child0_child0_child1, 100); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child1, 1); - YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child2, 50); - YGNodeStyleSetHeight(root_child0_child2, 25); - YGNodeInsertChild(root_child0, root_child0_child2, 2); + YGNodeRef root_child0_child0_child2 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child2, 50); + YGNodeStyleSetHeight(root_child0_child0_child2, 25); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child2, 2); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(2070, YGNodeLayoutGetTop(root)); - ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(50, 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(600, YGNodeLayoutGetHeight(root_child0)); + ASSERT_FLOAT_EQ(50, 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(50, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); + ASSERT_FLOAT_EQ(600, YGNodeLayoutGetHeight(root_child0_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0_child1)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(2070, YGNodeLayoutGetTop(root)); - ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(50, 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(600, YGNodeLayoutGetHeight(root_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root_child0)); - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); + ASSERT_FLOAT_EQ(600, YGNodeLayoutGetHeight(root_child0_child0)); - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0_child1)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeFreeRecursive(root); @@ -2302,81 +2500,95 @@ TEST(YogaTest, fit_content_min_height) { YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetHeight(root, 90); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap); YGNodeStyleSetHeight(root_child0, 90); - YGNodeStyleSetMinHeightFitContent(root_child0); YGNodeInsertChild(root, root_child0, 0); YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child0, 50); - YGNodeStyleSetHeight(root_child0_child0, 50); + YGNodeStyleSetFlexWrap(root_child0_child0, YGWrapWrap); + YGNodeStyleSetHeight(root_child0_child0, 90); + YGNodeStyleSetMinHeightFitContent(root_child0_child0); YGNodeInsertChild(root_child0, root_child0_child0, 0); - YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child1, 50); - YGNodeStyleSetHeight(root_child0_child1, 100); - YGNodeInsertChild(root_child0, root_child0_child1, 1); + YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child0, 50); + YGNodeStyleSetHeight(root_child0_child0_child0, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0); - YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child2, 50); - YGNodeStyleSetHeight(root_child0_child2, 25); - YGNodeInsertChild(root_child0, root_child0_child2, 2); + YGNodeRef root_child0_child0_child1 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child1, 50); + YGNodeStyleSetHeight(root_child0_child0_child1, 100); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child1, 1); + + YGNodeRef root_child0_child0_child2 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child2, 50); + YGNodeStyleSetHeight(root_child0_child0_child2, 25); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child2, 2); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(2570, YGNodeLayoutGetTop(root)); - ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root)); ASSERT_FLOAT_EQ(90, 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(175, YGNodeLayoutGetHeight(root_child0)); + ASSERT_FLOAT_EQ(50, 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(50, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); + ASSERT_FLOAT_EQ(175, 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(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0_child1)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(2570, YGNodeLayoutGetTop(root)); - ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root)); ASSERT_FLOAT_EQ(90, 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(175, YGNodeLayoutGetHeight(root_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(90, YGNodeLayoutGetHeight(root_child0)); - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); + ASSERT_FLOAT_EQ(175, 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(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0_child1)); - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeFreeRecursive(root); @@ -2389,81 +2601,95 @@ TEST(YogaTest, stretch_min_height) { YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetHeight(root, 500); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap); - YGNodeStyleSetHeight(root_child0, 400); - YGNodeStyleSetMinHeightStretch(root_child0); + YGNodeStyleSetHeight(root_child0, 500); YGNodeInsertChild(root, root_child0, 0); YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child0, 50); - YGNodeStyleSetHeight(root_child0_child0, 50); + YGNodeStyleSetFlexWrap(root_child0_child0, YGWrapWrap); + YGNodeStyleSetHeight(root_child0_child0, 400); + YGNodeStyleSetMinHeightStretch(root_child0_child0); YGNodeInsertChild(root_child0, root_child0_child0, 0); - YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child1, 50); - YGNodeStyleSetHeight(root_child0_child1, 100); - YGNodeInsertChild(root_child0, root_child0_child1, 1); + YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child0, 50); + YGNodeStyleSetHeight(root_child0_child0_child0, 50); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0); + + YGNodeRef root_child0_child0_child1 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child1, 50); + YGNodeStyleSetHeight(root_child0_child0_child1, 100); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child1, 1); - YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config); - YGNodeStyleSetWidth(root_child0_child2, 50); - YGNodeStyleSetHeight(root_child0_child2, 25); - YGNodeInsertChild(root_child0, root_child0_child2, 2); + YGNodeRef root_child0_child0_child2 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0_child0_child2, 50); + YGNodeStyleSetHeight(root_child0_child0_child2, 25); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child2, 2); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(2660, YGNodeLayoutGetTop(root)); - ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(50, 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(400, YGNodeLayoutGetHeight(root_child0)); + ASSERT_FLOAT_EQ(50, 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(50, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); + ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root_child0_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0_child1)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(2660, YGNodeLayoutGetTop(root)); - ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(50, 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(400, YGNodeLayoutGetHeight(root_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root_child0)); - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0)); - - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1)); - - ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2)); + ASSERT_FLOAT_EQ(400, 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(50, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0_child1)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child0_child2)); YGNodeFreeRecursive(root);