diff --git a/gentest/fixtures/YGIntrinsicSizeTest.html b/gentest/fixtures/YGIntrinsicSizeTest.html index 587b1b8506..12534f704f 100644 --- a/gentest/fixtures/YGIntrinsicSizeTest.html +++ b/gentest/fixtures/YGIntrinsicSizeTest.html @@ -229,7 +229,7 @@ -
+
@@ -240,7 +240,7 @@
-
+
@@ -260,7 +260,7 @@
-
+
@@ -271,7 +271,7 @@
-
+
@@ -291,7 +291,7 @@
-
+
@@ -302,7 +302,7 @@
-
+
@@ -313,7 +313,7 @@
-
+
@@ -322,7 +322,7 @@
-
+
@@ -333,7 +333,7 @@
-
+
@@ -344,7 +344,8 @@
-
+
@@ -353,7 +354,7 @@
-
+
@@ -364,7 +365,7 @@
-
+
@@ -375,7 +376,8 @@
-
+
@@ -384,7 +386,7 @@
-
+
@@ -395,7 +397,7 @@
-
+
@@ -415,7 +417,7 @@
-
+
@@ -426,7 +428,7 @@
-
+
@@ -446,7 +448,7 @@
-
+
@@ -457,7 +459,7 @@
-
+
@@ -467,3 +469,75 @@
+ +
+
+
+ Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet +
+
+
+ +
+
+
+ Lorem ipsum dolor sit amet +
+
+
+ +
+
+
+ Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet +
+
+
+ +
+
+
+ Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet +
+
+
+ +
+
+
+ Lorem ipsum dolor sit amet +
+
+
+ +
+
+
+ Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet +
+
+
+ +
+
+
+ Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet +
+
+
+ +
+
+
+ Lorem ipsum dolor sit amet +
+
+
+ +
+
+
+ Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet +
+
+
diff --git a/java/tests/generated/com/facebook/yoga/YGIntrinsicSizeTest.java b/java/tests/generated/com/facebook/yoga/YGIntrinsicSizeTest.java index 7ff0d0f096..d31755fe4f 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<<687a3aca94b61dfa74ab408189b3fc48>> * generated by gentest/gentest-driver.ts from gentest/fixtures/YGIntrinsicSizeTest.html */ @@ -576,6 +576,7 @@ public void test_fit_content_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(90f); final YogaNode root_child0 = createNode(config); @@ -656,11 +657,11 @@ public void test_fit_content_width() { } @Test - @Ignore public void test_stretch_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(500f); final YogaNode root_child0 = createNode(config); @@ -687,7 +688,7 @@ public void test_stretch_width() { 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); @@ -715,7 +716,7 @@ public void test_stretch_width() { 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); @@ -816,6 +817,7 @@ public void test_fit_content_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(90f); final YogaNode root_child0 = createNode(config); @@ -841,13 +843,13 @@ public void test_fit_content_height() { 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(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(175f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); @@ -869,26 +871,26 @@ public void test_fit_content_height() { 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(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(175f, 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(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(450f, root_child0_child2.getLayoutX(), 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); @@ -900,6 +902,7 @@ public void test_stretch_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(500f); final YogaNode root_child0 = createNode(config); @@ -925,14 +928,14 @@ public void test_stretch_height() { 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); @@ -953,26 +956,26 @@ public void test_stretch_height() { 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(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(450f, root_child0_child2.getLayoutX(), 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); @@ -1054,6 +1057,7 @@ public void test_fit_content_flex_basis_column() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(90f); final YogaNode root_child0 = createNode(config); @@ -1079,13 +1083,13 @@ public void test_fit_content_flex_basis_column() { 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(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(175f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); @@ -1107,37 +1111,37 @@ public void test_fit_content_flex_basis_column() { 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(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(175f, 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(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(450f, root_child0_child2.getLayoutX(), 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); } @Test - @Ignore public void test_stretch_flex_basis_column() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(500f); final YogaNode root_child0 = createNode(config); @@ -1162,13 +1166,13 @@ public void test_stretch_flex_basis_column() { 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(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(175f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); @@ -1190,32 +1194,33 @@ public void test_stretch_flex_basis_column() { 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(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(175f, 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(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(450f, root_child0_child2.getLayoutX(), 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); } @Test + @Ignore public void test_max_content_flex_basis_row() { YogaConfig config = YogaConfigFactory.create(); @@ -1244,21 +1249,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 +1272,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,6 +1297,7 @@ public void test_fit_content_flex_basis_row() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(90f); final YogaNode root_child0 = createNode(config); @@ -1318,7 +1324,7 @@ public void test_fit_content_flex_basis_row() { 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); @@ -1346,7 +1352,7 @@ public void test_fit_content_flex_basis_row() { 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); @@ -1377,6 +1383,7 @@ public void test_stretch_flex_basis_row() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(500f); final YogaNode root_child0 = createNode(config); @@ -1402,7 +1409,7 @@ public void test_stretch_flex_basis_row() { 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); @@ -1430,7 +1437,7 @@ public void test_stretch_flex_basis_row() { 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); @@ -1534,6 +1541,7 @@ public void test_fit_content_max_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(90f); final YogaNode root_child0 = createNode(config); @@ -1561,7 +1569,7 @@ public void test_fit_content_max_width() { 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); @@ -1589,7 +1597,7 @@ public void test_fit_content_max_width() { 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); @@ -1620,6 +1628,7 @@ public void test_stretch_max_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(500f); final YogaNode root_child0 = createNode(config); @@ -1647,7 +1656,7 @@ public void test_stretch_max_width() { 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); @@ -1675,7 +1684,7 @@ public void test_stretch_max_width() { 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); @@ -1779,6 +1788,7 @@ public void test_fit_content_min_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(90f); final YogaNode root_child0 = createNode(config); @@ -1806,7 +1816,7 @@ public void test_fit_content_min_width() { 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); @@ -1834,7 +1844,7 @@ public void test_fit_content_min_width() { 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); @@ -1865,6 +1875,7 @@ public void test_stretch_min_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(500f); final YogaNode root_child0 = createNode(config); @@ -1892,7 +1903,7 @@ public void test_stretch_min_width() { 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); @@ -1920,7 +1931,7 @@ public void test_stretch_min_width() { 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); @@ -2023,6 +2034,7 @@ public void test_fit_content_max_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(90f); final YogaNode root_child0 = createNode(config); @@ -2049,13 +2061,13 @@ public void test_fit_content_max_height() { 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(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); @@ -2077,26 +2089,26 @@ public void test_fit_content_max_height() { 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(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, 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(-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(350f, root_child0_child2.getLayoutX(), 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); @@ -2108,6 +2120,7 @@ public void test_stretch_max_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(500f); final YogaNode root_child0 = createNode(config); @@ -2134,14 +2147,14 @@ public void test_stretch_max_height() { 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); @@ -2162,26 +2175,26 @@ public void test_stretch_max_height() { 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(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(450f, root_child0_child2.getLayoutX(), 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); @@ -2265,6 +2278,7 @@ public void test_fit_content_min_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(90f); final YogaNode root_child0 = createNode(config); @@ -2291,13 +2305,13 @@ public void test_fit_content_min_height() { 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(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(175f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); @@ -2319,26 +2333,26 @@ public void test_fit_content_min_height() { 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(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(175f, 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(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(450f, root_child0_child2.getLayoutX(), 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); @@ -2350,6 +2364,7 @@ public void test_stretch_min_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(500f); final YogaNode root_child0 = createNode(config); @@ -2376,14 +2391,14 @@ public void test_stretch_min_height() { 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); @@ -2404,31 +2419,532 @@ public void test_stretch_min_height() { 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(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(450f, root_child0_child2.getLayoutX(), 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); } + @Test + @Ignore + public void test_text_max_content_width() { + YogaConfig config = YogaConfigFactory.create(); + + final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); + root.setWidth(200f); + + final YogaNode root_child0 = createNode(config); + root_child0.setWidthMaxContent(); + root.addChildAt(root_child0, 0); + + final YogaNode root_child0_child0 = createNode(config); + root_child0_child0.setFlexDirection(YogaFlexDirection.ROW); + root_child0.addChildAt(root_child0_child0, 0); + root_child0_child0.setData("Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet"); + root_child0_child0.setMeasureFunction(new TestUtils.intrinsicMeasureFunction()); + root.setDirection(YogaDirection.LTR); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(200f, root.getLayoutWidth(), 0.0f); + assertEquals(10f, root.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0.getLayoutY(), 0.0f); + assertEquals(1140f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(1140f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); + + root.setDirection(YogaDirection.RTL); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(200f, root.getLayoutWidth(), 0.0f); + assertEquals(10f, root.getLayoutHeight(), 0.0f); + + assertEquals(-940f, root_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0.getLayoutY(), 0.0f); + assertEquals(1140f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(1140f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); + } + + @Test + @Ignore + public void test_text_stretch_width() { + YogaConfig config = YogaConfigFactory.create(); + + final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); + root.setWidth(200f); + + final YogaNode root_child0 = createNode(config); + root_child0.setWidthStretch(); + root.addChildAt(root_child0, 0); + + final YogaNode root_child0_child0 = createNode(config); + root_child0_child0.setFlexDirection(YogaFlexDirection.ROW); + root_child0.addChildAt(root_child0_child0, 0); + root_child0_child0.setData("Lorem ipsum dolor sit amet"); + root_child0_child0.setMeasureFunction(new TestUtils.intrinsicMeasureFunction()); + root.setDirection(YogaDirection.LTR); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(200f, root.getLayoutWidth(), 0.0f); + assertEquals(20f, root.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); + + root.setDirection(YogaDirection.RTL); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(200f, root.getLayoutWidth(), 0.0f); + assertEquals(20f, root.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); + } + + @Test + @Ignore + public void test_text_fit_content_width() { + YogaConfig config = YogaConfigFactory.create(); + + final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); + root.setWidth(200f); + + final YogaNode root_child0 = createNode(config); + root_child0.setWidthFitContent(); + root.addChildAt(root_child0, 0); + + final YogaNode root_child0_child0 = createNode(config); + root_child0_child0.setFlexDirection(YogaFlexDirection.ROW); + root_child0.addChildAt(root_child0_child0, 0); + root_child0_child0.setData("Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet"); + root_child0_child0.setMeasureFunction(new TestUtils.intrinsicMeasureFunction()); + root.setDirection(YogaDirection.LTR); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(200f, root.getLayoutWidth(), 0.0f); + assertEquals(30f, root.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0.getLayoutY(), 0.0f); + assertEquals(870f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(30f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(870f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(30f, root_child0_child0.getLayoutHeight(), 0.0f); + + root.setDirection(YogaDirection.RTL); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(200f, root.getLayoutWidth(), 0.0f); + assertEquals(30f, root.getLayoutHeight(), 0.0f); + + assertEquals(-670f, root_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0.getLayoutY(), 0.0f); + assertEquals(870f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(30f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(870f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(30f, root_child0_child0.getLayoutHeight(), 0.0f); + } + + @Test + @Ignore + public void test_text_max_content_min_width() { + YogaConfig config = YogaConfigFactory.create(); + + final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); + root.setWidth(200f); + + final YogaNode root_child0 = createNode(config); + root_child0.setWidth(200f); + root_child0.setMinWidthMaxContent(); + root.addChildAt(root_child0, 0); + + final YogaNode root_child0_child0 = createNode(config); + root_child0_child0.setFlexDirection(YogaFlexDirection.ROW); + root_child0.addChildAt(root_child0_child0, 0); + root_child0_child0.setData("Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet"); + root_child0_child0.setMeasureFunction(new TestUtils.intrinsicMeasureFunction()); + root.setDirection(YogaDirection.LTR); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(200f, root.getLayoutWidth(), 0.0f); + assertEquals(10f, root.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0.getLayoutY(), 0.0f); + assertEquals(1140f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(1140f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); + + root.setDirection(YogaDirection.RTL); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(200f, root.getLayoutWidth(), 0.0f); + assertEquals(10f, root.getLayoutHeight(), 0.0f); + + assertEquals(-940f, root_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0.getLayoutY(), 0.0f); + assertEquals(1140f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(1140f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); + } + + @Test + @Ignore + public void test_text_stretch_min_width() { + YogaConfig config = YogaConfigFactory.create(); + + final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); + root.setWidth(200f); + + final YogaNode root_child0 = createNode(config); + root_child0.setWidth(100f); + root_child0.setMinWidthStretch(); + root.addChildAt(root_child0, 0); + + final YogaNode root_child0_child0 = createNode(config); + root_child0_child0.setFlexDirection(YogaFlexDirection.ROW); + root_child0.addChildAt(root_child0_child0, 0); + root_child0_child0.setData("Lorem ipsum dolor sit amet"); + root_child0_child0.setMeasureFunction(new TestUtils.intrinsicMeasureFunction()); + root.setDirection(YogaDirection.LTR); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(200f, root.getLayoutWidth(), 0.0f); + assertEquals(20f, root.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); + + root.setDirection(YogaDirection.RTL); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(200f, root.getLayoutWidth(), 0.0f); + assertEquals(20f, root.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); + } + + @Test + @Ignore + public void test_text_fit_content_min_width() { + YogaConfig config = YogaConfigFactory.create(); + + final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); + root.setWidth(200f); + + final YogaNode root_child0 = createNode(config); + root_child0.setWidth(300f); + root_child0.setMinWidthFitContent(); + root.addChildAt(root_child0, 0); + + final YogaNode root_child0_child0 = createNode(config); + root_child0_child0.setFlexDirection(YogaFlexDirection.ROW); + root_child0.addChildAt(root_child0_child0, 0); + root_child0_child0.setData("Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet"); + root_child0_child0.setMeasureFunction(new TestUtils.intrinsicMeasureFunction()); + root.setDirection(YogaDirection.LTR); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(200f, root.getLayoutWidth(), 0.0f); + assertEquals(30f, root.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0.getLayoutY(), 0.0f); + assertEquals(870f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(30f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(870f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(30f, root_child0_child0.getLayoutHeight(), 0.0f); + + root.setDirection(YogaDirection.RTL); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(200f, root.getLayoutWidth(), 0.0f); + assertEquals(30f, root.getLayoutHeight(), 0.0f); + + assertEquals(-670f, root_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0.getLayoutY(), 0.0f); + assertEquals(870f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(30f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(870f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(30f, root_child0_child0.getLayoutHeight(), 0.0f); + } + + @Test + @Ignore + public void test_text_max_content_max_width() { + YogaConfig config = YogaConfigFactory.create(); + + final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); + root.setWidth(200f); + + final YogaNode root_child0 = createNode(config); + root_child0.setWidth(2000f); + root_child0.setMaxWidthMaxContent(); + root.addChildAt(root_child0, 0); + + final YogaNode root_child0_child0 = createNode(config); + root_child0_child0.setFlexDirection(YogaFlexDirection.ROW); + root_child0.addChildAt(root_child0_child0, 0); + root_child0_child0.setData("Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet"); + root_child0_child0.setMeasureFunction(new TestUtils.intrinsicMeasureFunction()); + root.setDirection(YogaDirection.LTR); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(200f, root.getLayoutWidth(), 0.0f); + assertEquals(10f, root.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0.getLayoutY(), 0.0f); + assertEquals(1140f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(1140f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); + + root.setDirection(YogaDirection.RTL); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(200f, root.getLayoutWidth(), 0.0f); + assertEquals(10f, root.getLayoutHeight(), 0.0f); + + assertEquals(-940f, root_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0.getLayoutY(), 0.0f); + assertEquals(1140f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(1140f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); + } + + @Test + @Ignore + public void test_text_stretch_max_width() { + YogaConfig config = YogaConfigFactory.create(); + + final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); + root.setWidth(200f); + + final YogaNode root_child0 = createNode(config); + root_child0.setWidth(300f); + root_child0.setMaxWidthStretch(); + root.addChildAt(root_child0, 0); + + final YogaNode root_child0_child0 = createNode(config); + root_child0_child0.setFlexDirection(YogaFlexDirection.ROW); + root_child0.addChildAt(root_child0_child0, 0); + root_child0_child0.setData("Lorem ipsum dolor sit amet"); + root_child0_child0.setMeasureFunction(new TestUtils.intrinsicMeasureFunction()); + root.setDirection(YogaDirection.LTR); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(200f, root.getLayoutWidth(), 0.0f); + assertEquals(20f, root.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); + + root.setDirection(YogaDirection.RTL); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(200f, root.getLayoutWidth(), 0.0f); + assertEquals(20f, root.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); + } + + @Test + @Ignore + public void test_text_fit_content_max_width() { + YogaConfig config = YogaConfigFactory.create(); + + final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); + root.setWidth(200f); + + final YogaNode root_child0 = createNode(config); + root_child0.setWidth(1000f); + root_child0.setMaxWidthFitContent(); + root.addChildAt(root_child0, 0); + + final YogaNode root_child0_child0 = createNode(config); + root_child0_child0.setFlexDirection(YogaFlexDirection.ROW); + root_child0.addChildAt(root_child0_child0, 0); + root_child0_child0.setData("Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet"); + root_child0_child0.setMeasureFunction(new TestUtils.intrinsicMeasureFunction()); + root.setDirection(YogaDirection.LTR); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(200f, root.getLayoutWidth(), 0.0f); + assertEquals(30f, root.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0.getLayoutY(), 0.0f); + assertEquals(870f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(30f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(870f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(30f, root_child0_child0.getLayoutHeight(), 0.0f); + + root.setDirection(YogaDirection.RTL); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(200f, root.getLayoutWidth(), 0.0f); + assertEquals(30f, root.getLayoutHeight(), 0.0f); + + assertEquals(-670f, root_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0.getLayoutY(), 0.0f); + assertEquals(870f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(30f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(870f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(30f, root_child0_child0.getLayoutHeight(), 0.0f); + } + private YogaNode createNode(YogaConfig config) { return mNodeFactory.create(config); } diff --git a/javascript/tests/generated/YGIntrinsicSizeTest.test.ts b/javascript/tests/generated/YGIntrinsicSizeTest.test.ts index b6367b6134..a75a371f67 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,6 +626,7 @@ test.skip('fit_content_width', () => { try { root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); root.setWidth(90); const root_child0 = Yoga.Node.create(config); @@ -709,12 +710,13 @@ test.skip('fit_content_width', () => { config.free(); } }); -test.skip('stretch_width', () => { +test('stretch_width', () => { const config = Yoga.Config.create(); let root; try { root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); root.setWidth(500); const root_child0 = Yoga.Node.create(config); @@ -740,7 +742,7 @@ test.skip('stretch_width', () => { 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); @@ -767,7 +769,7 @@ test.skip('stretch_width', () => { 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); @@ -879,6 +881,7 @@ test.skip('fit_content_height', () => { try { root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); root.setHeight(90); const root_child0 = Yoga.Node.create(config); @@ -903,13 +906,13 @@ test.skip('fit_content_height', () => { 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.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(175); expect(root_child0_child0.getComputedLeft()).toBe(0); @@ -930,26 +933,26 @@ test.skip('fit_content_height', () => { 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.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(175); - 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.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_child2.getComputedLeft()).toBe(450); + 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); @@ -967,6 +970,7 @@ test.skip('stretch_height', () => { try { root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); root.setHeight(500); const root_child0 = Yoga.Node.create(config); @@ -991,14 +995,14 @@ test.skip('stretch_height', () => { 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); @@ -1018,26 +1022,26 @@ test.skip('stretch_height', () => { 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.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_child2.getComputedLeft()).toBe(450); + 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); @@ -1130,6 +1134,7 @@ test.skip('fit_content_flex_basis_column', () => { try { root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); root.setHeight(90); const root_child0 = Yoga.Node.create(config); @@ -1154,13 +1159,13 @@ test.skip('fit_content_flex_basis_column', () => { 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.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(175); expect(root_child0_child0.getComputedLeft()).toBe(0); @@ -1181,26 +1186,26 @@ test.skip('fit_content_flex_basis_column', () => { 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.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(175); - 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.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_child2.getComputedLeft()).toBe(450); + 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); @@ -1212,12 +1217,13 @@ test.skip('fit_content_flex_basis_column', () => { config.free(); } }); -test.skip('stretch_flex_basis_column', () => { +test('stretch_flex_basis_column', () => { const config = Yoga.Config.create(); let root; try { root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); root.setHeight(500); const root_child0 = Yoga.Node.create(config); @@ -1241,13 +1247,13 @@ test.skip('stretch_flex_basis_column', () => { 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.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(175); expect(root_child0_child0.getComputedLeft()).toBe(0); @@ -1268,26 +1274,26 @@ test.skip('stretch_flex_basis_column', () => { 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.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(175); - 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.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_child2.getComputedLeft()).toBe(450); + 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); @@ -1299,7 +1305,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 +1334,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 +1356,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,6 +1387,7 @@ test.skip('fit_content_flex_basis_row', () => { try { root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); root.setWidth(90); const root_child0 = Yoga.Node.create(config); @@ -1406,7 +1413,7 @@ test.skip('fit_content_flex_basis_row', () => { 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); @@ -1433,7 +1440,7 @@ test.skip('fit_content_flex_basis_row', () => { 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); @@ -1470,6 +1477,7 @@ test.skip('stretch_flex_basis_row', () => { try { root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); root.setWidth(500); const root_child0 = Yoga.Node.create(config); @@ -1494,7 +1502,7 @@ test.skip('stretch_flex_basis_row', () => { 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); @@ -1521,7 +1529,7 @@ test.skip('stretch_flex_basis_row', () => { 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); @@ -1635,6 +1643,7 @@ test.skip('fit_content_max_width', () => { try { root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); root.setWidth(90); const root_child0 = Yoga.Node.create(config); @@ -1661,7 +1670,7 @@ test.skip('fit_content_max_width', () => { 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); @@ -1688,7 +1697,7 @@ test.skip('fit_content_max_width', () => { 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); @@ -1725,6 +1734,7 @@ test.skip('stretch_max_width', () => { try { root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); root.setWidth(500); const root_child0 = Yoga.Node.create(config); @@ -1751,7 +1761,7 @@ test.skip('stretch_max_width', () => { 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); @@ -1778,7 +1788,7 @@ test.skip('stretch_max_width', () => { 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); @@ -1892,6 +1902,7 @@ test.skip('fit_content_min_width', () => { try { root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); root.setWidth(90); const root_child0 = Yoga.Node.create(config); @@ -1918,7 +1929,7 @@ test.skip('fit_content_min_width', () => { 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); @@ -1945,7 +1956,7 @@ test.skip('fit_content_min_width', () => { 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); @@ -1982,6 +1993,7 @@ test.skip('stretch_min_width', () => { try { root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); root.setWidth(500); const root_child0 = Yoga.Node.create(config); @@ -2008,7 +2020,7 @@ test.skip('stretch_min_width', () => { 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); @@ -2035,7 +2047,7 @@ test.skip('stretch_min_width', () => { 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); @@ -2148,6 +2160,7 @@ test.skip('fit_content_max_height', () => { try { root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); root.setHeight(90); const root_child0 = Yoga.Node.create(config); @@ -2173,13 +2186,13 @@ test.skip('fit_content_max_height', () => { 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.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); @@ -2200,26 +2213,26 @@ test.skip('fit_content_max_height', () => { 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.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(100); - 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.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_child2.getComputedLeft()).toBe(350); + 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); @@ -2237,6 +2250,7 @@ test.skip('stretch_max_height', () => { try { root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); root.setHeight(500); const root_child0 = Yoga.Node.create(config); @@ -2262,14 +2276,14 @@ test.skip('stretch_max_height', () => { 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); @@ -2289,26 +2303,26 @@ test.skip('stretch_max_height', () => { 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.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_child2.getComputedLeft()).toBe(450); + 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); @@ -2402,6 +2416,7 @@ test.skip('fit_content_min_height', () => { try { root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); root.setHeight(90); const root_child0 = Yoga.Node.create(config); @@ -2427,13 +2442,13 @@ test.skip('fit_content_min_height', () => { 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.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(175); expect(root_child0_child0.getComputedLeft()).toBe(0); @@ -2454,26 +2469,26 @@ test.skip('fit_content_min_height', () => { 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.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(175); - 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.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_child2.getComputedLeft()).toBe(450); + 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); @@ -2491,6 +2506,7 @@ test.skip('stretch_min_height', () => { try { root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); root.setHeight(500); const root_child0 = Yoga.Node.create(config); @@ -2516,14 +2532,14 @@ test.skip('stretch_min_height', () => { 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); @@ -2543,26 +2559,26 @@ test.skip('stretch_min_height', () => { 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.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_child2.getComputedLeft()).toBe(450); + 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); @@ -2574,3 +2590,531 @@ test.skip('stretch_min_height', () => { config.free(); } }); +test.skip('text_max_content_width', () => { + const config = Yoga.Config.create(); + let root; + + try { + root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); + root.setWidth(200); + + const root_child0 = Yoga.Node.create(config); + root_child0.setWidth("max-content"); + root.insertChild(root_child0, 0); + + const root_child0_child0 = Yoga.Node.create(config); + root_child0_child0.setFlexDirection(FlexDirection.Row); + root_child0.insertChild(root_child0_child0, 0); + root_child0_child0.setMeasureFunc(instrinsicSizeMeasureFunc.bind("Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet")); + root.calculateLayout(undefined, undefined, Direction.LTR); + + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(10); + + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(1140); + expect(root_child0.getComputedHeight()).toBe(10); + + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(1140); + expect(root_child0_child0.getComputedHeight()).toBe(10); + + root.calculateLayout(undefined, undefined, Direction.RTL); + + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(10); + + expect(root_child0.getComputedLeft()).toBe(-940); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(1140); + expect(root_child0.getComputedHeight()).toBe(10); + + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(1140); + expect(root_child0_child0.getComputedHeight()).toBe(10); + } finally { + if (typeof root !== 'undefined') { + root.freeRecursive(); + } + + config.free(); + } +}); +test.skip('text_stretch_width', () => { + const config = Yoga.Config.create(); + let root; + + try { + root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); + root.setWidth(200); + + const root_child0 = Yoga.Node.create(config); + root_child0.setWidth("stretch"); + root.insertChild(root_child0, 0); + + const root_child0_child0 = Yoga.Node.create(config); + root_child0_child0.setFlexDirection(FlexDirection.Row); + root_child0.insertChild(root_child0_child0, 0); + root_child0_child0.setMeasureFunc(instrinsicSizeMeasureFunc.bind("Lorem ipsum dolor sit amet")); + root.calculateLayout(undefined, undefined, Direction.LTR); + + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(20); + + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(200); + expect(root_child0.getComputedHeight()).toBe(20); + + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0.getComputedHeight()).toBe(20); + + root.calculateLayout(undefined, undefined, Direction.RTL); + + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(20); + + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(200); + expect(root_child0.getComputedHeight()).toBe(20); + + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0.getComputedHeight()).toBe(20); + } finally { + if (typeof root !== 'undefined') { + root.freeRecursive(); + } + + config.free(); + } +}); +test.skip('text_fit_content_width', () => { + const config = Yoga.Config.create(); + let root; + + try { + root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); + root.setWidth(200); + + const root_child0 = Yoga.Node.create(config); + root_child0.setWidth("fit-content"); + root.insertChild(root_child0, 0); + + const root_child0_child0 = Yoga.Node.create(config); + root_child0_child0.setFlexDirection(FlexDirection.Row); + root_child0.insertChild(root_child0_child0, 0); + root_child0_child0.setMeasureFunc(instrinsicSizeMeasureFunc.bind("Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet")); + root.calculateLayout(undefined, undefined, Direction.LTR); + + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(30); + + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(870); + expect(root_child0.getComputedHeight()).toBe(30); + + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(870); + expect(root_child0_child0.getComputedHeight()).toBe(30); + + root.calculateLayout(undefined, undefined, Direction.RTL); + + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(30); + + expect(root_child0.getComputedLeft()).toBe(-670); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(870); + expect(root_child0.getComputedHeight()).toBe(30); + + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(870); + expect(root_child0_child0.getComputedHeight()).toBe(30); + } finally { + if (typeof root !== 'undefined') { + root.freeRecursive(); + } + + config.free(); + } +}); +test.skip('text_max_content_min_width', () => { + const config = Yoga.Config.create(); + let root; + + try { + root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); + root.setWidth(200); + + const root_child0 = Yoga.Node.create(config); + root_child0.setWidth(200); + root_child0.setMinWidth("max-content"); + root.insertChild(root_child0, 0); + + const root_child0_child0 = Yoga.Node.create(config); + root_child0_child0.setFlexDirection(FlexDirection.Row); + root_child0.insertChild(root_child0_child0, 0); + root_child0_child0.setMeasureFunc(instrinsicSizeMeasureFunc.bind("Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet")); + root.calculateLayout(undefined, undefined, Direction.LTR); + + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(10); + + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(1140); + expect(root_child0.getComputedHeight()).toBe(10); + + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(1140); + expect(root_child0_child0.getComputedHeight()).toBe(10); + + root.calculateLayout(undefined, undefined, Direction.RTL); + + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(10); + + expect(root_child0.getComputedLeft()).toBe(-940); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(1140); + expect(root_child0.getComputedHeight()).toBe(10); + + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(1140); + expect(root_child0_child0.getComputedHeight()).toBe(10); + } finally { + if (typeof root !== 'undefined') { + root.freeRecursive(); + } + + config.free(); + } +}); +test.skip('text_stretch_min_width', () => { + const config = Yoga.Config.create(); + let root; + + try { + root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); + root.setWidth(200); + + const root_child0 = Yoga.Node.create(config); + root_child0.setWidth(100); + root_child0.setMinWidth("stretch"); + root.insertChild(root_child0, 0); + + const root_child0_child0 = Yoga.Node.create(config); + root_child0_child0.setFlexDirection(FlexDirection.Row); + root_child0.insertChild(root_child0_child0, 0); + root_child0_child0.setMeasureFunc(instrinsicSizeMeasureFunc.bind("Lorem ipsum dolor sit amet")); + root.calculateLayout(undefined, undefined, Direction.LTR); + + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(20); + + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(200); + expect(root_child0.getComputedHeight()).toBe(20); + + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0.getComputedHeight()).toBe(20); + + root.calculateLayout(undefined, undefined, Direction.RTL); + + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(20); + + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(200); + expect(root_child0.getComputedHeight()).toBe(20); + + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0.getComputedHeight()).toBe(20); + } finally { + if (typeof root !== 'undefined') { + root.freeRecursive(); + } + + config.free(); + } +}); +test.skip('text_fit_content_min_width', () => { + const config = Yoga.Config.create(); + let root; + + try { + root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); + root.setWidth(200); + + const root_child0 = Yoga.Node.create(config); + root_child0.setWidth(300); + root_child0.setMinWidth("fit-content"); + root.insertChild(root_child0, 0); + + const root_child0_child0 = Yoga.Node.create(config); + root_child0_child0.setFlexDirection(FlexDirection.Row); + root_child0.insertChild(root_child0_child0, 0); + root_child0_child0.setMeasureFunc(instrinsicSizeMeasureFunc.bind("Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet")); + root.calculateLayout(undefined, undefined, Direction.LTR); + + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(30); + + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(870); + expect(root_child0.getComputedHeight()).toBe(30); + + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(870); + expect(root_child0_child0.getComputedHeight()).toBe(30); + + root.calculateLayout(undefined, undefined, Direction.RTL); + + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(30); + + expect(root_child0.getComputedLeft()).toBe(-670); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(870); + expect(root_child0.getComputedHeight()).toBe(30); + + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(870); + expect(root_child0_child0.getComputedHeight()).toBe(30); + } finally { + if (typeof root !== 'undefined') { + root.freeRecursive(); + } + + config.free(); + } +}); +test.skip('text_max_content_max_width', () => { + const config = Yoga.Config.create(); + let root; + + try { + root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); + root.setWidth(200); + + const root_child0 = Yoga.Node.create(config); + root_child0.setWidth(2000); + root_child0.setMaxWidth("max-content"); + root.insertChild(root_child0, 0); + + const root_child0_child0 = Yoga.Node.create(config); + root_child0_child0.setFlexDirection(FlexDirection.Row); + root_child0.insertChild(root_child0_child0, 0); + root_child0_child0.setMeasureFunc(instrinsicSizeMeasureFunc.bind("Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet")); + root.calculateLayout(undefined, undefined, Direction.LTR); + + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(10); + + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(1140); + expect(root_child0.getComputedHeight()).toBe(10); + + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(1140); + expect(root_child0_child0.getComputedHeight()).toBe(10); + + root.calculateLayout(undefined, undefined, Direction.RTL); + + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(10); + + expect(root_child0.getComputedLeft()).toBe(-940); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(1140); + expect(root_child0.getComputedHeight()).toBe(10); + + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(1140); + expect(root_child0_child0.getComputedHeight()).toBe(10); + } finally { + if (typeof root !== 'undefined') { + root.freeRecursive(); + } + + config.free(); + } +}); +test.skip('text_stretch_max_width', () => { + const config = Yoga.Config.create(); + let root; + + try { + root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); + root.setWidth(200); + + const root_child0 = Yoga.Node.create(config); + root_child0.setWidth(300); + root_child0.setMaxWidth("stretch"); + root.insertChild(root_child0, 0); + + const root_child0_child0 = Yoga.Node.create(config); + root_child0_child0.setFlexDirection(FlexDirection.Row); + root_child0.insertChild(root_child0_child0, 0); + root_child0_child0.setMeasureFunc(instrinsicSizeMeasureFunc.bind("Lorem ipsum dolor sit amet")); + root.calculateLayout(undefined, undefined, Direction.LTR); + + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(20); + + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(200); + expect(root_child0.getComputedHeight()).toBe(20); + + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0.getComputedHeight()).toBe(20); + + root.calculateLayout(undefined, undefined, Direction.RTL); + + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(20); + + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(200); + expect(root_child0.getComputedHeight()).toBe(20); + + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0.getComputedHeight()).toBe(20); + } finally { + if (typeof root !== 'undefined') { + root.freeRecursive(); + } + + config.free(); + } +}); +test.skip('text_fit_content_max_width', () => { + const config = Yoga.Config.create(); + let root; + + try { + root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); + root.setWidth(200); + + const root_child0 = Yoga.Node.create(config); + root_child0.setWidth(1000); + root_child0.setMaxWidth("fit-content"); + root.insertChild(root_child0, 0); + + const root_child0_child0 = Yoga.Node.create(config); + root_child0_child0.setFlexDirection(FlexDirection.Row); + root_child0.insertChild(root_child0_child0, 0); + root_child0_child0.setMeasureFunc(instrinsicSizeMeasureFunc.bind("Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet")); + root.calculateLayout(undefined, undefined, Direction.LTR); + + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(30); + + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(870); + expect(root_child0.getComputedHeight()).toBe(30); + + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(870); + expect(root_child0_child0.getComputedHeight()).toBe(30); + + root.calculateLayout(undefined, undefined, Direction.RTL); + + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(30); + + expect(root_child0.getComputedLeft()).toBe(-670); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(870); + expect(root_child0.getComputedHeight()).toBe(30); + + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(870); + expect(root_child0_child0.getComputedHeight()).toBe(30); + } finally { + if (typeof root !== 'undefined') { + root.freeRecursive(); + } + + config.free(); + } +}); diff --git a/tests/generated/YGIntrinsicSizeTest.cpp b/tests/generated/YGIntrinsicSizeTest.cpp index 268964c9ac..8a52d074a0 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<<38909ba26fe838f819e095d3f56172dd>> * generated by gentest/gentest-driver.ts from gentest/fixtures/YGIntrinsicSizeTest.html */ @@ -574,6 +574,7 @@ TEST(YogaTest, fit_content_width) { YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeStyleSetWidth(root, 90); YGNodeRef root_child0 = YGNodeNewWithConfig(config); @@ -656,11 +657,10 @@ TEST(YogaTest, fit_content_width) { } TEST(YogaTest, stretch_width) { - GTEST_SKIP(); - YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeStyleSetWidth(root, 500); YGNodeRef root_child0 = YGNodeNewWithConfig(config); @@ -686,7 +686,7 @@ TEST(YogaTest, stretch_width) { 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)); @@ -713,7 +713,7 @@ TEST(YogaTest, stretch_width) { 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)); @@ -819,6 +819,7 @@ TEST(YogaTest, fit_content_height) { YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeStyleSetHeight(root, 90); YGNodeRef root_child0 = YGNodeNewWithConfig(config); @@ -843,13 +844,13 @@ TEST(YogaTest, fit_content_height) { 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(50, YGNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(175, YGNodeLayoutGetHeight(root_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); @@ -870,26 +871,26 @@ TEST(YogaTest, fit_content_height) { 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(50, YGNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(175, 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(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(450, YGNodeLayoutGetLeft(root_child0_child2)); + 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)); @@ -905,6 +906,7 @@ TEST(YogaTest, stretch_height) { YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeStyleSetHeight(root, 500); YGNodeRef root_child0 = YGNodeNewWithConfig(config); @@ -929,14 +931,14 @@ TEST(YogaTest, stretch_height) { 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)); @@ -956,26 +958,26 @@ TEST(YogaTest, stretch_height) { 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(450, YGNodeLayoutGetLeft(root_child0_child1)); + 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(450, YGNodeLayoutGetLeft(root_child0_child2)); + 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)); @@ -1062,6 +1064,7 @@ TEST(YogaTest, fit_content_flex_basis_column) { YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeStyleSetHeight(root, 90); YGNodeRef root_child0 = YGNodeNewWithConfig(config); @@ -1086,13 +1089,13 @@ TEST(YogaTest, fit_content_flex_basis_column) { 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(50, YGNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(175, YGNodeLayoutGetHeight(root_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); @@ -1113,26 +1116,26 @@ TEST(YogaTest, fit_content_flex_basis_column) { 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(50, YGNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(175, 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(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(450, YGNodeLayoutGetLeft(root_child0_child2)); + 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)); @@ -1143,11 +1146,10 @@ TEST(YogaTest, fit_content_flex_basis_column) { } TEST(YogaTest, stretch_flex_basis_column) { - GTEST_SKIP(); - YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeStyleSetHeight(root, 500); YGNodeRef root_child0 = YGNodeNewWithConfig(config); @@ -1171,13 +1173,13 @@ TEST(YogaTest, stretch_flex_basis_column) { 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(50, YGNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(175, YGNodeLayoutGetHeight(root_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); @@ -1198,26 +1200,26 @@ TEST(YogaTest, stretch_flex_basis_column) { 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(50, YGNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(175, 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(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(450, YGNodeLayoutGetLeft(root_child0_child2)); + 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)); @@ -1228,6 +1230,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 +1258,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 +1280,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,6 +1309,7 @@ TEST(YogaTest, fit_content_flex_basis_row) { YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeStyleSetWidth(root, 90); YGNodeRef root_child0 = YGNodeNewWithConfig(config); @@ -1330,7 +1335,7 @@ TEST(YogaTest, fit_content_flex_basis_row) { 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)); @@ -1357,7 +1362,7 @@ TEST(YogaTest, fit_content_flex_basis_row) { 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)); @@ -1392,6 +1397,7 @@ TEST(YogaTest, stretch_flex_basis_row) { YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeStyleSetWidth(root, 500); YGNodeRef root_child0 = YGNodeNewWithConfig(config); @@ -1416,7 +1422,7 @@ TEST(YogaTest, stretch_flex_basis_row) { 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)); @@ -1443,7 +1449,7 @@ TEST(YogaTest, stretch_flex_basis_row) { 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)); @@ -1553,6 +1559,7 @@ TEST(YogaTest, fit_content_max_width) { YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeStyleSetWidth(root, 90); YGNodeRef root_child0 = YGNodeNewWithConfig(config); @@ -1579,7 +1586,7 @@ TEST(YogaTest, fit_content_max_width) { 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)); @@ -1606,7 +1613,7 @@ TEST(YogaTest, fit_content_max_width) { 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)); @@ -1641,6 +1648,7 @@ TEST(YogaTest, stretch_max_width) { YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeStyleSetWidth(root, 500); YGNodeRef root_child0 = YGNodeNewWithConfig(config); @@ -1667,7 +1675,7 @@ TEST(YogaTest, stretch_max_width) { 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)); @@ -1694,7 +1702,7 @@ TEST(YogaTest, stretch_max_width) { 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)); @@ -1804,6 +1812,7 @@ TEST(YogaTest, fit_content_min_width) { YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeStyleSetWidth(root, 90); YGNodeRef root_child0 = YGNodeNewWithConfig(config); @@ -1830,7 +1839,7 @@ TEST(YogaTest, fit_content_min_width) { 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)); @@ -1857,7 +1866,7 @@ TEST(YogaTest, fit_content_min_width) { 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)); @@ -1892,6 +1901,7 @@ TEST(YogaTest, stretch_min_width) { YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeStyleSetWidth(root, 500); YGNodeRef root_child0 = YGNodeNewWithConfig(config); @@ -1918,7 +1928,7 @@ TEST(YogaTest, stretch_min_width) { 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)); @@ -1945,7 +1955,7 @@ TEST(YogaTest, stretch_min_width) { 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)); @@ -2054,6 +2064,7 @@ TEST(YogaTest, fit_content_max_height) { YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeStyleSetHeight(root, 90); YGNodeRef root_child0 = YGNodeNewWithConfig(config); @@ -2079,13 +2090,13 @@ TEST(YogaTest, fit_content_max_height) { 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(50, YGNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); @@ -2106,26 +2117,26 @@ TEST(YogaTest, fit_content_max_height) { 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(50, YGNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(100, 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(400, YGNodeLayoutGetLeft(root_child0_child1)); + 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(350, YGNodeLayoutGetLeft(root_child0_child2)); + 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)); @@ -2141,6 +2152,7 @@ TEST(YogaTest, stretch_max_height) { YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeStyleSetHeight(root, 500); YGNodeRef root_child0 = YGNodeNewWithConfig(config); @@ -2166,14 +2178,14 @@ TEST(YogaTest, stretch_max_height) { 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)); @@ -2193,26 +2205,26 @@ TEST(YogaTest, stretch_max_height) { 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(450, YGNodeLayoutGetLeft(root_child0_child1)); + 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(450, YGNodeLayoutGetLeft(root_child0_child2)); + 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)); @@ -2302,6 +2314,7 @@ TEST(YogaTest, fit_content_min_height) { YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeStyleSetHeight(root, 90); YGNodeRef root_child0 = YGNodeNewWithConfig(config); @@ -2327,13 +2340,13 @@ TEST(YogaTest, fit_content_min_height) { 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(50, YGNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(175, YGNodeLayoutGetHeight(root_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); @@ -2354,26 +2367,26 @@ TEST(YogaTest, fit_content_min_height) { 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(50, YGNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(175, 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(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(450, YGNodeLayoutGetLeft(root_child0_child2)); + 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)); @@ -2389,6 +2402,7 @@ TEST(YogaTest, stretch_min_height) { YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); YGNodeStyleSetHeight(root, 500); YGNodeRef root_child0 = YGNodeNewWithConfig(config); @@ -2414,14 +2428,14 @@ TEST(YogaTest, stretch_min_height) { 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)); @@ -2441,26 +2455,26 @@ TEST(YogaTest, stretch_min_height) { 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(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(450, YGNodeLayoutGetLeft(root_child0_child2)); + 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)); @@ -2469,3 +2483,522 @@ TEST(YogaTest, stretch_min_height) { YGConfigFree(config); } + +TEST(YogaTest, text_max_content_width) { + GTEST_SKIP(); + + YGConfigRef config = YGConfigNew(); + + YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); + YGNodeStyleSetWidth(root, 200); + + YGNodeRef root_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidthMaxContent(root_child0); + YGNodeInsertChild(root, root_child0, 0); + + YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetFlexDirection(root_child0_child0, YGFlexDirectionRow); + YGNodeInsertChild(root_child0, root_child0_child0, 0); + YGNodeSetContext(root_child0_child0, (void*)"Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet"); + YGNodeSetMeasureFunc(root_child0_child0, &facebook::yoga::test::IntrinsicSizeMeasure); + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(1140, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(1140, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0_child0)); + + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(-940, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(1140, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(1140, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0_child0)); + + YGNodeFreeRecursive(root); + + YGConfigFree(config); +} + +TEST(YogaTest, text_stretch_width) { + GTEST_SKIP(); + + YGConfigRef config = YGConfigNew(); + + YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); + YGNodeStyleSetWidth(root, 200); + + YGNodeRef root_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidthStretch(root_child0); + YGNodeInsertChild(root, root_child0, 0); + + YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetFlexDirection(root_child0_child0, YGFlexDirectionRow); + YGNodeInsertChild(root_child0, root_child0_child0, 0); + YGNodeSetContext(root_child0_child0, (void*)"Lorem ipsum dolor sit amet"); + YGNodeSetMeasureFunc(root_child0_child0, &facebook::yoga::test::IntrinsicSizeMeasure); + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0)); + + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0)); + + YGNodeFreeRecursive(root); + + YGConfigFree(config); +} + +TEST(YogaTest, text_fit_content_width) { + GTEST_SKIP(); + + YGConfigRef config = YGConfigNew(); + + YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); + YGNodeStyleSetWidth(root, 200); + + YGNodeRef root_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidthFitContent(root_child0); + YGNodeInsertChild(root, root_child0, 0); + + YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetFlexDirection(root_child0_child0, YGFlexDirectionRow); + YGNodeInsertChild(root_child0, root_child0_child0, 0); + YGNodeSetContext(root_child0_child0, (void*)"Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet"); + YGNodeSetMeasureFunc(root_child0_child0, &facebook::yoga::test::IntrinsicSizeMeasure); + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(870, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(870, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child0_child0)); + + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(-670, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(870, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(870, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child0_child0)); + + YGNodeFreeRecursive(root); + + YGConfigFree(config); +} + +TEST(YogaTest, text_max_content_min_width) { + GTEST_SKIP(); + + YGConfigRef config = YGConfigNew(); + + YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); + YGNodeStyleSetWidth(root, 200); + + YGNodeRef root_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0, 200); + YGNodeStyleSetMinWidthMaxContent(root_child0); + YGNodeInsertChild(root, root_child0, 0); + + YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetFlexDirection(root_child0_child0, YGFlexDirectionRow); + YGNodeInsertChild(root_child0, root_child0_child0, 0); + YGNodeSetContext(root_child0_child0, (void*)"Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet"); + YGNodeSetMeasureFunc(root_child0_child0, &facebook::yoga::test::IntrinsicSizeMeasure); + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(1140, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(1140, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0_child0)); + + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(-940, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(1140, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(1140, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0_child0)); + + YGNodeFreeRecursive(root); + + YGConfigFree(config); +} + +TEST(YogaTest, text_stretch_min_width) { + GTEST_SKIP(); + + YGConfigRef config = YGConfigNew(); + + YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); + YGNodeStyleSetWidth(root, 200); + + YGNodeRef root_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0, 100); + YGNodeStyleSetMinWidthStretch(root_child0); + YGNodeInsertChild(root, root_child0, 0); + + YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetFlexDirection(root_child0_child0, YGFlexDirectionRow); + YGNodeInsertChild(root_child0, root_child0_child0, 0); + YGNodeSetContext(root_child0_child0, (void*)"Lorem ipsum dolor sit amet"); + YGNodeSetMeasureFunc(root_child0_child0, &facebook::yoga::test::IntrinsicSizeMeasure); + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0)); + + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0)); + + YGNodeFreeRecursive(root); + + YGConfigFree(config); +} + +TEST(YogaTest, text_fit_content_min_width) { + GTEST_SKIP(); + + YGConfigRef config = YGConfigNew(); + + YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); + YGNodeStyleSetWidth(root, 200); + + YGNodeRef root_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0, 300); + YGNodeStyleSetMinWidthFitContent(root_child0); + YGNodeInsertChild(root, root_child0, 0); + + YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetFlexDirection(root_child0_child0, YGFlexDirectionRow); + YGNodeInsertChild(root_child0, root_child0_child0, 0); + YGNodeSetContext(root_child0_child0, (void*)"Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet"); + YGNodeSetMeasureFunc(root_child0_child0, &facebook::yoga::test::IntrinsicSizeMeasure); + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(870, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(870, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child0_child0)); + + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(-670, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(870, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(870, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child0_child0)); + + YGNodeFreeRecursive(root); + + YGConfigFree(config); +} + +TEST(YogaTest, text_max_content_max_width) { + GTEST_SKIP(); + + YGConfigRef config = YGConfigNew(); + + YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); + YGNodeStyleSetWidth(root, 200); + + YGNodeRef root_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0, 2000); + YGNodeStyleSetMaxWidthMaxContent(root_child0); + YGNodeInsertChild(root, root_child0, 0); + + YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetFlexDirection(root_child0_child0, YGFlexDirectionRow); + YGNodeInsertChild(root_child0, root_child0_child0, 0); + YGNodeSetContext(root_child0_child0, (void*)"Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet"); + YGNodeSetMeasureFunc(root_child0_child0, &facebook::yoga::test::IntrinsicSizeMeasure); + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(1140, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(1140, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0_child0)); + + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(-940, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(1140, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(1140, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0_child0)); + + YGNodeFreeRecursive(root); + + YGConfigFree(config); +} + +TEST(YogaTest, text_stretch_max_width) { + GTEST_SKIP(); + + YGConfigRef config = YGConfigNew(); + + YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); + YGNodeStyleSetWidth(root, 200); + + YGNodeRef root_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0, 300); + YGNodeStyleSetMaxWidthStretch(root_child0); + YGNodeInsertChild(root, root_child0, 0); + + YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetFlexDirection(root_child0_child0, YGFlexDirectionRow); + YGNodeInsertChild(root_child0, root_child0_child0, 0); + YGNodeSetContext(root_child0_child0, (void*)"Lorem ipsum dolor sit amet"); + YGNodeSetMeasureFunc(root_child0_child0, &facebook::yoga::test::IntrinsicSizeMeasure); + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0)); + + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0)); + + YGNodeFreeRecursive(root); + + YGConfigFree(config); +} + +TEST(YogaTest, text_fit_content_max_width) { + GTEST_SKIP(); + + YGConfigRef config = YGConfigNew(); + + YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); + YGNodeStyleSetWidth(root, 200); + + YGNodeRef root_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0, 1000); + YGNodeStyleSetMaxWidthFitContent(root_child0); + YGNodeInsertChild(root, root_child0, 0); + + YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetFlexDirection(root_child0_child0, YGFlexDirectionRow); + YGNodeInsertChild(root_child0, root_child0_child0, 0); + YGNodeSetContext(root_child0_child0, (void*)"Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet"); + YGNodeSetMeasureFunc(root_child0_child0, &facebook::yoga::test::IntrinsicSizeMeasure); + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(870, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(870, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child0_child0)); + + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(-670, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(870, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(870, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child0_child0)); + + YGNodeFreeRecursive(root); + + YGConfigFree(config); +}