diff --git a/gentest/fixtures/YGStaticPositionTest.html b/gentest/fixtures/YGStaticPositionTest.html
index 95cc3095b1..e73e35f3a5 100644
--- a/gentest/fixtures/YGStaticPositionTest.html
+++ b/gentest/fixtures/YGStaticPositionTest.html
@@ -1,3 +1,326 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/java/tests/com/facebook/yoga/YGStaticPositionTest.java b/java/tests/com/facebook/yoga/YGStaticPositionTest.java
index 26ba05a817..4be8337387 100644
--- a/java/tests/com/facebook/yoga/YGStaticPositionTest.java
+++ b/java/tests/com/facebook/yoga/YGStaticPositionTest.java
@@ -27,16 +27,61 @@ public static Iterable
nodeFactories() {
@Test
@Ignore
- public void test_static_position_insets_have_no_effect() {
+ public void test_static_position_insets_have_no_effect_left_top() {
YogaConfig config = YogaConfigFactory.create();
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
final YogaNode root = createNode(config);
- root.setPositionType(YogaPositionType.STATIC);
- root.setPosition(YogaEdge.LEFT, 50f);
- root.setPosition(YogaEdge.TOP, 50f);
- root.setWidth(100f);
- root.setHeight(100f);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0.setPosition(YogaEdge.LEFT, 50f);
+ root_child0.setPosition(YogaEdge.TOP, 50f);
+ root_child0.setWidth(100f);
+ root_child0.setHeight(100f);
+ root.addChildAt(root_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_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(100f, root.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_insets_have_no_effect_right_bottom() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0.setPosition(YogaEdge.RIGHT, 50f);
+ root_child0.setPosition(YogaEdge.BOTTOM, 50f);
+ root_child0.setWidth(100f);
+ root_child0.setHeight(100f);
+ root.addChildAt(root_child0, 0);
root.setDirection(YogaDirection.LTR);
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
@@ -45,6 +90,11 @@ public void test_static_position_insets_have_no_effect() {
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
+
root.setDirection(YogaDirection.RTL);
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
@@ -52,6 +102,2554 @@ public void test_static_position_insets_have_no_effect() {
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_absolute_child_insets_relative_to_positioned_ancestor() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(200f);
+ root_child0.setHeight(200f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setMargin(YogaEdge.LEFT, 100f);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
+ root_child0_child0_child0.setPosition(YogaEdge.LEFT, 50f);
+ root_child0_child0_child0.setPosition(YogaEdge.TOP, 50f);
+ root_child0_child0_child0.setWidth(50f);
+ root_child0_child0_child0.setHeight(50f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ 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(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_absolute_child_insets_relative_to_positioned_ancestor_deep() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(200f);
+ root_child0.setHeight(200f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setMargin(YogaEdge.LEFT, 100f);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0_child0.setMargin(YogaEdge.LEFT, 100f);
+ root_child0_child0_child0.setWidth(100f);
+ root_child0_child0_child0.setHeight(100f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0_child0_child0.setMargin(YogaEdge.LEFT, 100f);
+ root_child0_child0_child0_child0.setWidth(100f);
+ root_child0_child0_child0_child0.setHeight(100f);
+ root_child0_child0_child0.addChildAt(root_child0_child0_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0_child0_child0_child0.setMargin(YogaEdge.LEFT, 100f);
+ root_child0_child0_child0_child0_child0.setWidth(100f);
+ root_child0_child0_child0_child0_child0.setHeight(100f);
+ root_child0_child0_child0_child0.addChildAt(root_child0_child0_child0_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
+ root_child0_child0_child0_child0_child0_child0.setPosition(YogaEdge.LEFT, 50f);
+ root_child0_child0_child0_child0_child0_child0.setPosition(YogaEdge.TOP, 50f);
+ root_child0_child0_child0_child0_child0_child0.setWidth(50f);
+ root_child0_child0_child0_child0_child0_child0.setHeight(50f);
+ root_child0_child0_child0_child0_child0.addChildAt(root_child0_child0_child0_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(200f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(300f, root_child0_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(400f, root_child0_child0_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child0_child0_child0_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child0_child0_child0_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_absolute_child_width_percentage() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(200f);
+ root_child0.setHeight(200f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
+ root_child0_child0_child0.setWidthPercent(50f);
+ root_child0_child0_child0.setHeight(50f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_relative_child_width_percentage() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(200f);
+ root_child0.setHeight(200f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setWidthPercent(50f);
+ root_child0_child0_child0.setHeight(50f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ 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(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(150f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_static_child_width_percentage() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(200f);
+ root_child0.setHeight(200f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0_child0.setWidthPercent(50f);
+ root_child0_child0_child0.setHeight(50f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ 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(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(150f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_absolute_child_height_percentage() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(200f);
+ root_child0.setHeight(200f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
+ root_child0_child0_child0.setWidth(50f);
+ root_child0_child0_child0.setHeightPercent(50f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(150f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_relative_child_height_percentage() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(200f);
+ root_child0.setHeight(200f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setWidth(50f);
+ root_child0_child0_child0.setHeightPercent(50f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ 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(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(150f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_static_child_height_percentage() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(200f);
+ root_child0.setHeight(200f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0_child0.setWidth(50f);
+ root_child0_child0_child0.setHeightPercent(50f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ 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(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(150f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_absolute_child_left_percentage() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(200f);
+ root_child0.setHeight(200f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
+ root_child0_child0_child0.setPositionPercent(YogaEdge.LEFT, 50f);
+ root_child0_child0_child0.setWidth(50f);
+ root_child0_child0_child0.setHeight(50f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ 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(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_relative_child_left_percentage() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(200f);
+ root_child0.setHeight(200f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setPositionPercent(YogaEdge.LEFT, 50f);
+ root_child0_child0_child0.setWidth(50f);
+ root_child0_child0_child0.setHeight(50f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ 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(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(200f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_static_child_left_percentage() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(200f);
+ root_child0.setHeight(200f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0_child0.setPositionPercent(YogaEdge.LEFT, 50f);
+ root_child0_child0_child0.setWidth(50f);
+ root_child0_child0_child0.setHeight(50f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ 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(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(150f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_absolute_child_right_percentage() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(200f);
+ root_child0.setHeight(200f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
+ root_child0_child0_child0.setPositionPercent(YogaEdge.RIGHT, 50f);
+ root_child0_child0_child0.setWidth(50f);
+ root_child0_child0_child0.setHeight(50f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ 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(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_relative_child_right_percentage() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(200f);
+ root_child0.setHeight(200f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setPositionPercent(YogaEdge.RIGHT, 50f);
+ root_child0_child0_child0.setWidth(50f);
+ root_child0_child0_child0.setHeight(50f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(-50f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ 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(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_static_child_right_percentage() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(200f);
+ root_child0.setHeight(200f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0_child0.setPositionPercent(YogaEdge.RIGHT, 50f);
+ root_child0_child0_child0.setWidth(50f);
+ root_child0_child0_child0.setHeight(50f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ 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(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(150f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_absolute_child_top_percentage() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(200f);
+ root_child0.setHeight(200f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
+ root_child0_child0_child0.setPositionPercent(YogaEdge.TOP, 50f);
+ root_child0_child0_child0.setWidth(50f);
+ root_child0_child0_child0.setHeight(50f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ 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(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(150f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_relative_child_top_percentage() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(200f);
+ root_child0.setHeight(200f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setPositionPercent(YogaEdge.TOP, 50f);
+ root_child0_child0_child0.setWidth(50f);
+ root_child0_child0_child0.setHeight(50f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ 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(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(150f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_static_child_top_percentage() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(200f);
+ root_child0.setHeight(200f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0_child0.setPositionPercent(YogaEdge.TOP, 50f);
+ root_child0_child0_child0.setWidth(50f);
+ root_child0_child0_child0.setHeight(50f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ 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(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(150f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_absolute_child_bottom_percentage() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(200f);
+ root_child0.setHeight(200f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
+ root_child0_child0_child0.setPositionPercent(YogaEdge.BOTTOM, 50f);
+ root_child0_child0_child0.setWidth(50f);
+ root_child0_child0_child0.setHeight(50f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ 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(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(150f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_relative_child_bottom_percentage() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(200f);
+ root_child0.setHeight(200f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setPositionPercent(YogaEdge.BOTTOM, 50f);
+ root_child0_child0_child0.setWidth(50f);
+ root_child0_child0_child0.setHeight(50f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(-50f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ 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(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(150f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(-50f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_static_child_bottom_percentage() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(200f);
+ root_child0.setHeight(200f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0_child0.setPositionPercent(YogaEdge.BOTTOM, 50f);
+ root_child0_child0_child0.setWidth(50f);
+ root_child0_child0_child0.setHeight(50f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ 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(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(150f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_absolute_child_margin_percentage() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(200f);
+ root_child0.setHeight(200f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
+ root_child0_child0_child0.setMarginPercent(YogaEdge.LEFT, 50f);
+ root_child0_child0_child0.setMarginPercent(YogaEdge.TOP, 50f);
+ root_child0_child0_child0.setMarginPercent(YogaEdge.RIGHT, 50f);
+ root_child0_child0_child0.setMarginPercent(YogaEdge.BOTTOM, 50f);
+ root_child0_child0_child0.setWidth(50f);
+ root_child0_child0_child0.setHeight(50f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ 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(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_relative_child_margin_percentage() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(200f);
+ root_child0.setHeight(200f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setMarginPercent(YogaEdge.LEFT, 50f);
+ root_child0_child0_child0.setMarginPercent(YogaEdge.TOP, 50f);
+ root_child0_child0_child0.setMarginPercent(YogaEdge.RIGHT, 50f);
+ root_child0_child0_child0.setMarginPercent(YogaEdge.BOTTOM, 50f);
+ root_child0_child0_child0.setWidth(50f);
+ root_child0_child0_child0.setHeight(50f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ 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(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_static_child_margin_percentage() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(200f);
+ root_child0.setHeight(200f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0_child0.setMarginPercent(YogaEdge.LEFT, 50f);
+ root_child0_child0_child0.setMarginPercent(YogaEdge.TOP, 50f);
+ root_child0_child0_child0.setMarginPercent(YogaEdge.RIGHT, 50f);
+ root_child0_child0_child0.setMarginPercent(YogaEdge.BOTTOM, 50f);
+ root_child0_child0_child0.setWidth(50f);
+ root_child0_child0_child0.setHeight(50f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ 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(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_absolute_child_padding_percentage() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(200f);
+ root_child0.setHeight(200f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
+ root_child0_child0_child0.setPaddingPercent(YogaEdge.LEFT, 50);
+ root_child0_child0_child0.setPaddingPercent(YogaEdge.TOP, 50);
+ root_child0_child0_child0.setPaddingPercent(YogaEdge.RIGHT, 50);
+ root_child0_child0_child0.setPaddingPercent(YogaEdge.BOTTOM, 50);
+ root_child0_child0_child0.setWidth(50f);
+ root_child0_child0_child0.setHeight(50f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(200f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(200f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(200f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(200f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_relative_child_padding_percentage() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(200f);
+ root_child0.setHeight(200f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setPaddingPercent(YogaEdge.LEFT, 50);
+ root_child0_child0_child0.setPaddingPercent(YogaEdge.TOP, 50);
+ root_child0_child0_child0.setPaddingPercent(YogaEdge.RIGHT, 50);
+ root_child0_child0_child0.setPaddingPercent(YogaEdge.BOTTOM, 50);
+ root_child0_child0_child0.setWidth(50f);
+ root_child0_child0_child0.setHeight(50f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_static_child_padding_percentage() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(200f);
+ root_child0.setHeight(200f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0_child0.setPaddingPercent(YogaEdge.LEFT, 50);
+ root_child0_child0_child0.setPaddingPercent(YogaEdge.TOP, 50);
+ root_child0_child0_child0.setPaddingPercent(YogaEdge.RIGHT, 50);
+ root_child0_child0_child0.setPaddingPercent(YogaEdge.BOTTOM, 50);
+ root_child0_child0_child0.setWidth(50f);
+ root_child0_child0_child0.setHeight(50f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_absolute_child_border_percentage() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(200f);
+ root_child0.setHeight(200f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
+ root_child0_child0_child0.setWidth(50f);
+ root_child0_child0_child0.setHeight(50f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ 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(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(150f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_relative_child_border_percentage() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(200f);
+ root_child0.setHeight(200f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setWidth(50f);
+ root_child0_child0_child0.setHeight(50f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ 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(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ 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(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(150f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_static_child_border_percentage() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(200f);
+ root_child0.setHeight(200f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0_child0.setWidth(50f);
+ root_child0_child0_child0.setHeight(50f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
+ assertEquals(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ 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(200f, 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(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(150f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_absolute_child_containing_block_padding_box() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setPadding(YogaEdge.LEFT, 100);
+ root_child0.setPadding(YogaEdge.TOP, 100);
+ root_child0.setPadding(YogaEdge.RIGHT, 100);
+ root_child0.setPadding(YogaEdge.BOTTOM, 100);
+ root_child0.setWidth(400f);
+ root_child0.setHeight(400f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
+ root_child0_child0_child0.setWidthPercent(50f);
+ root_child0_child0_child0.setHeight(50f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(400f, root.getLayoutWidth(), 0.0f);
+ assertEquals(400f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(400f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(400f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(200f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(400f, root.getLayoutWidth(), 0.0f);
+ assertEquals(400f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(400f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(400f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(200f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(200f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_relative_child_containing_block_padding_box() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setPadding(YogaEdge.LEFT, 100);
+ root_child0.setPadding(YogaEdge.TOP, 100);
+ root_child0.setPadding(YogaEdge.RIGHT, 100);
+ root_child0.setPadding(YogaEdge.BOTTOM, 100);
+ root_child0.setWidth(400f);
+ root_child0.setHeight(400f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setWidthPercent(50f);
+ root_child0_child0_child0.setHeight(50f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(400f, root.getLayoutWidth(), 0.0f);
+ assertEquals(400f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(400f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(400f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(400f, root.getLayoutWidth(), 0.0f);
+ assertEquals(400f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(400f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(400f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(200f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(250f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_static_child_containing_block_padding_box() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setPadding(YogaEdge.LEFT, 100);
+ root_child0.setPadding(YogaEdge.TOP, 100);
+ root_child0.setPadding(YogaEdge.RIGHT, 100);
+ root_child0.setPadding(YogaEdge.BOTTOM, 100);
+ root_child0.setWidth(400f);
+ root_child0.setHeight(400f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setWidth(100f);
+ root_child0_child0.setHeight(100f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0_child0.setWidthPercent(50f);
+ root_child0_child0_child0.setHeight(50f);
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(400f, root.getLayoutWidth(), 0.0f);
+ assertEquals(400f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(400f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(400f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(400f, root.getLayoutWidth(), 0.0f);
+ assertEquals(400f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(400f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(400f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(200f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(250f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_absolute_child_containing_block_content_box() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setPadding(YogaEdge.LEFT, 100);
+ root_child0.setPadding(YogaEdge.TOP, 100);
+ root_child0.setPadding(YogaEdge.RIGHT, 100);
+ root_child0.setPadding(YogaEdge.BOTTOM, 100);
+ root_child0.setWidth(400f);
+ root_child0.setHeight(400f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
+ root_child0_child0.setWidthPercent(50f);
+ root_child0_child0.setHeight(50f);
+ root_child0.addChildAt(root_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(400f, root.getLayoutWidth(), 0.0f);
+ assertEquals(400f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(400f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(400f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, 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(400f, root.getLayoutWidth(), 0.0f);
+ assertEquals(400f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(400f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(400f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_relative_child_containing_block_content_box() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setPadding(YogaEdge.LEFT, 100);
+ root_child0.setPadding(YogaEdge.TOP, 100);
+ root_child0.setPadding(YogaEdge.RIGHT, 100);
+ root_child0.setPadding(YogaEdge.BOTTOM, 100);
+ root_child0.setWidth(400f);
+ root_child0.setHeight(400f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setWidthPercent(50f);
+ root_child0_child0.setHeight(50f);
+ root_child0.addChildAt(root_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(400f, root.getLayoutWidth(), 0.0f);
+ assertEquals(400f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(400f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(400f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, 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(400f, root.getLayoutWidth(), 0.0f);
+ assertEquals(400f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(400f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(400f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(200f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_static_position_static_child_containing_block_content_box() {
+ YogaConfig config = YogaConfigFactory.create();
+ config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
+
+ final YogaNode root = createNode(config);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setPadding(YogaEdge.LEFT, 100);
+ root_child0.setPadding(YogaEdge.TOP, 100);
+ root_child0.setPadding(YogaEdge.RIGHT, 100);
+ root_child0.setPadding(YogaEdge.BOTTOM, 100);
+ root_child0.setWidth(400f);
+ root_child0.setHeight(400f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setWidthPercent(50f);
+ root_child0_child0.setHeight(50f);
+ root_child0.addChildAt(root_child0_child0, 0);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(400f, root.getLayoutWidth(), 0.0f);
+ assertEquals(400f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(400f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(400f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, 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(400f, root.getLayoutWidth(), 0.0f);
+ assertEquals(400f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(400f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(400f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(200f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
}
private YogaNode createNode(YogaConfig config) {
diff --git a/javascript/tests/generated/YGStaticPositionTest.test.ts b/javascript/tests/generated/YGStaticPositionTest.test.ts
index 36963049e3..1c0c56a27b 100644
--- a/javascript/tests/generated/YGStaticPositionTest.test.ts
+++ b/javascript/tests/generated/YGStaticPositionTest.test.ts
@@ -25,7 +25,7 @@ import {
Wrap,
} from 'yoga-layout';
-test.skip('static_position_insets_have_no_effect', () => {
+test.skip('static_position_insets_have_no_effect_left_top', () => {
const config = Yoga.Config.create();
let root;
@@ -33,11 +33,61 @@ test.skip('static_position_insets_have_no_effect', () => {
try {
root = Yoga.Node.create(config);
- root.setPositionType(PositionType.Static);
- root.setPosition(Edge.Left, 50);
- root.setPosition(Edge.Top, 50);
- root.setWidth(100);
- root.setHeight(100);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setPositionType(PositionType.Static);
+ root_child0.setPosition(Edge.Left, 50);
+ root_child0.setPosition(Edge.Top, 50);
+ root_child0.setWidth(100);
+ root_child0.setHeight(100);
+ root.insertChild(root_child0, 0);
+ root.calculateLayout(undefined, undefined, Direction.LTR);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(100);
+ expect(root.getComputedHeight()).toBe(100);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(100);
+ expect(root_child0.getComputedHeight()).toBe(100);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(100);
+ expect(root.getComputedHeight()).toBe(100);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(100);
+ expect(root_child0.getComputedHeight()).toBe(100);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_insets_have_no_effect_right_bottom', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setPositionType(PositionType.Static);
+ root_child0.setPosition(Edge.Right, 50);
+ root_child0.setPosition(Edge.Bottom, 50);
+ root_child0.setWidth(100);
+ root_child0.setHeight(100);
+ root.insertChild(root_child0, 0);
root.calculateLayout(undefined, undefined, Direction.LTR);
expect(root.getComputedLeft()).toBe(0);
@@ -45,12 +95,2740 @@ test.skip('static_position_insets_have_no_effect', () => {
expect(root.getComputedWidth()).toBe(100);
expect(root.getComputedHeight()).toBe(100);
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(100);
+ expect(root_child0.getComputedHeight()).toBe(100);
+
root.calculateLayout(undefined, undefined, Direction.RTL);
expect(root.getComputedLeft()).toBe(0);
expect(root.getComputedTop()).toBe(0);
expect(root.getComputedWidth()).toBe(100);
expect(root.getComputedHeight()).toBe(100);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(100);
+ expect(root_child0.getComputedHeight()).toBe(100);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_absolute_child_insets_relative_to_positioned_ancestor', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(200);
+ root_child0.setHeight(200);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setMargin(Edge.Left, 100);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setPositionType(PositionType.Absolute);
+ root_child0_child0_child0.setPosition(Edge.Left, 50);
+ root_child0_child0_child0.setPosition(Edge.Top, 50);
+ root_child0_child0_child0.setWidth(50);
+ root_child0_child0_child0.setHeight(50);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(50);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(50);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(50);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(50);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_absolute_child_insets_relative_to_positioned_ancestor_deep', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(200);
+ root_child0.setHeight(200);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setMargin(Edge.Left, 100);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0_child0.setMargin(Edge.Left, 100);
+ root_child0_child0_child0.setWidth(100);
+ root_child0_child0_child0.setHeight(100);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+
+ const root_child0_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0_child0_child0.setMargin(Edge.Left, 100);
+ root_child0_child0_child0_child0.setWidth(100);
+ root_child0_child0_child0_child0.setHeight(100);
+ root_child0_child0_child0.insertChild(root_child0_child0_child0_child0, 0);
+
+ const root_child0_child0_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0_child0_child0_child0.setMargin(Edge.Left, 100);
+ root_child0_child0_child0_child0_child0.setWidth(100);
+ root_child0_child0_child0_child0_child0.setHeight(100);
+ root_child0_child0_child0_child0.insertChild(root_child0_child0_child0_child0_child0, 0);
+
+ const root_child0_child0_child0_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0_child0_child0_child0.setPositionType(PositionType.Absolute);
+ root_child0_child0_child0_child0_child0_child0.setPosition(Edge.Left, 50);
+ root_child0_child0_child0_child0_child0_child0.setPosition(Edge.Top, 50);
+ root_child0_child0_child0_child0_child0_child0.setWidth(50);
+ root_child0_child0_child0_child0_child0_child0.setHeight(50);
+ root_child0_child0_child0_child0_child0.insertChild(root_child0_child0_child0_child0_child0_child0, 0);
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(200);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(300);
+ expect(root_child0_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0_child0_child0.getComputedLeft()).toBe(400);
+ expect(root_child0_child0_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0_child0_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0_child0_child0_child0.getComputedLeft()).toBe(50);
+ expect(root_child0_child0_child0_child0_child0_child0.getComputedTop()).toBe(50);
+ expect(root_child0_child0_child0_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0_child0_child0_child0.getComputedHeight()).toBe(50);
+
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0_child0_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0_child0_child0_child0.getComputedLeft()).toBe(50);
+ expect(root_child0_child0_child0_child0_child0_child0.getComputedTop()).toBe(50);
+ expect(root_child0_child0_child0_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0_child0_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_absolute_child_width_percentage', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(200);
+ root_child0.setHeight(200);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setPositionType(PositionType.Absolute);
+ root_child0_child0_child0.setWidth("50%");
+ root_child0_child0_child0.setHeight(50);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_relative_child_width_percentage', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(200);
+ root_child0.setHeight(200);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setWidth("50%");
+ root_child0_child0_child0.setHeight(50);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(150);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_static_child_width_percentage', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(200);
+ root_child0.setHeight(200);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0_child0.setWidth("50%");
+ root_child0_child0_child0.setHeight(50);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(150);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_absolute_child_height_percentage', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(200);
+ root_child0.setHeight(200);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setPositionType(PositionType.Absolute);
+ root_child0_child0_child0.setWidth(50);
+ root_child0_child0_child0.setHeight("50%");
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(100);
+
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(150);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(100);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_relative_child_height_percentage', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(200);
+ root_child0.setHeight(200);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setWidth(50);
+ root_child0_child0_child0.setHeight("50%");
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(150);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_static_child_height_percentage', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(200);
+ root_child0.setHeight(200);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0_child0.setWidth(50);
+ root_child0_child0_child0.setHeight("50%");
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(150);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_absolute_child_left_percentage', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(200);
+ root_child0.setHeight(200);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setPositionType(PositionType.Absolute);
+ root_child0_child0_child0.setPosition(Edge.Left, "50%");
+ root_child0_child0_child0.setWidth(50);
+ root_child0_child0_child0.setHeight(50);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_relative_child_left_percentage', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(200);
+ root_child0.setHeight(200);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setPosition(Edge.Left, "50%");
+ root_child0_child0_child0.setWidth(50);
+ root_child0_child0_child0.setHeight(50);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(50);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(200);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_static_child_left_percentage', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(200);
+ root_child0.setHeight(200);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0_child0.setPosition(Edge.Left, "50%");
+ root_child0_child0_child0.setWidth(50);
+ root_child0_child0_child0.setHeight(50);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(150);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_absolute_child_right_percentage', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(200);
+ root_child0.setHeight(200);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setPositionType(PositionType.Absolute);
+ root_child0_child0_child0.setPosition(Edge.Right, "50%");
+ root_child0_child0_child0.setWidth(50);
+ root_child0_child0_child0.setHeight(50);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(50);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(50);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_relative_child_right_percentage', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(200);
+ root_child0.setHeight(200);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setPosition(Edge.Right, "50%");
+ root_child0_child0_child0.setWidth(50);
+ root_child0_child0_child0.setHeight(50);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(-50);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_static_child_right_percentage', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(200);
+ root_child0.setHeight(200);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0_child0.setPosition(Edge.Right, "50%");
+ root_child0_child0_child0.setWidth(50);
+ root_child0_child0_child0.setHeight(50);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(150);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_absolute_child_top_percentage', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(200);
+ root_child0.setHeight(200);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setPositionType(PositionType.Absolute);
+ root_child0_child0_child0.setPosition(Edge.Top, "50%");
+ root_child0_child0_child0.setWidth(50);
+ root_child0_child0_child0.setHeight(50);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(100);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(150);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(100);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_relative_child_top_percentage', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(200);
+ root_child0.setHeight(200);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setPosition(Edge.Top, "50%");
+ root_child0_child0_child0.setWidth(50);
+ root_child0_child0_child0.setHeight(50);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(50);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(150);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(50);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_static_child_top_percentage', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(200);
+ root_child0.setHeight(200);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0_child0.setPosition(Edge.Top, "50%");
+ root_child0_child0_child0.setWidth(50);
+ root_child0_child0_child0.setHeight(50);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(150);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_absolute_child_bottom_percentage', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(200);
+ root_child0.setHeight(200);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setPositionType(PositionType.Absolute);
+ root_child0_child0_child0.setPosition(Edge.Bottom, "50%");
+ root_child0_child0_child0.setWidth(50);
+ root_child0_child0_child0.setHeight(50);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(50);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(150);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(50);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_relative_child_bottom_percentage', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(200);
+ root_child0.setHeight(200);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setPosition(Edge.Bottom, "50%");
+ root_child0_child0_child0.setWidth(50);
+ root_child0_child0_child0.setHeight(50);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(-50);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(150);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(-50);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_static_child_bottom_percentage', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(200);
+ root_child0.setHeight(200);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0_child0.setPosition(Edge.Bottom, "50%");
+ root_child0_child0_child0.setWidth(50);
+ root_child0_child0_child0.setHeight(50);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(150);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_absolute_child_margin_percentage', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(200);
+ root_child0.setHeight(200);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setPositionType(PositionType.Absolute);
+ root_child0_child0_child0.setMargin(Edge.Left, "50%");
+ root_child0_child0_child0.setMargin(Edge.Top, "50%");
+ root_child0_child0_child0.setMargin(Edge.Right, "50%");
+ root_child0_child0_child0.setMargin(Edge.Bottom, "50%");
+ root_child0_child0_child0.setWidth(50);
+ root_child0_child0_child0.setHeight(50);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(100);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(50);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(100);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_relative_child_margin_percentage', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(200);
+ root_child0.setHeight(200);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setMargin(Edge.Left, "50%");
+ root_child0_child0_child0.setMargin(Edge.Top, "50%");
+ root_child0_child0_child0.setMargin(Edge.Right, "50%");
+ root_child0_child0_child0.setMargin(Edge.Bottom, "50%");
+ root_child0_child0_child0.setWidth(50);
+ root_child0_child0_child0.setHeight(50);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(50);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(50);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(50);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_static_child_margin_percentage', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(200);
+ root_child0.setHeight(200);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0_child0.setMargin(Edge.Left, "50%");
+ root_child0_child0_child0.setMargin(Edge.Top, "50%");
+ root_child0_child0_child0.setMargin(Edge.Right, "50%");
+ root_child0_child0_child0.setMargin(Edge.Bottom, "50%");
+ root_child0_child0_child0.setWidth(50);
+ root_child0_child0_child0.setHeight(50);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(50);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(50);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(50);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_absolute_child_padding_percentage', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(200);
+ root_child0.setHeight(200);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setPositionType(PositionType.Absolute);
+ root_child0_child0_child0.setPadding(Edge.Left, "50%");
+ root_child0_child0_child0.setPadding(Edge.Top, "50%");
+ root_child0_child0_child0.setPadding(Edge.Right, "50%");
+ root_child0_child0_child0.setPadding(Edge.Bottom, "50%");
+ root_child0_child0_child0.setWidth(50);
+ root_child0_child0_child0.setHeight(50);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(200);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(200);
+
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(200);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(200);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_relative_child_padding_percentage', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(200);
+ root_child0.setHeight(200);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setPadding(Edge.Left, "50%");
+ root_child0_child0_child0.setPadding(Edge.Top, "50%");
+ root_child0_child0_child0.setPadding(Edge.Right, "50%");
+ root_child0_child0_child0.setPadding(Edge.Bottom, "50%");
+ root_child0_child0_child0.setWidth(50);
+ root_child0_child0_child0.setHeight(50);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(100);
+
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(100);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_static_child_padding_percentage', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(200);
+ root_child0.setHeight(200);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0_child0.setPadding(Edge.Left, "50%");
+ root_child0_child0_child0.setPadding(Edge.Top, "50%");
+ root_child0_child0_child0.setPadding(Edge.Right, "50%");
+ root_child0_child0_child0.setPadding(Edge.Bottom, "50%");
+ root_child0_child0_child0.setWidth(50);
+ root_child0_child0_child0.setHeight(50);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(100);
+
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(100);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_absolute_child_border_percentage', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(200);
+ root_child0.setHeight(200);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setPositionType(PositionType.Absolute);
+ root_child0_child0_child0.setWidth(50);
+ root_child0_child0_child0.setHeight(50);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(150);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_relative_child_border_percentage', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(200);
+ root_child0.setHeight(200);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setWidth(50);
+ root_child0_child0_child0.setHeight(50);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(150);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_static_child_border_percentage', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(200);
+ root_child0.setHeight(200);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0_child0.setWidth(50);
+ root_child0_child0_child0.setHeight(50);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+
+ 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(200);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(150);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_absolute_child_containing_block_padding_box', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setPadding(Edge.Left, 100);
+ root_child0.setPadding(Edge.Top, 100);
+ root_child0.setPadding(Edge.Right, 100);
+ root_child0.setPadding(Edge.Bottom, 100);
+ root_child0.setWidth(400);
+ root_child0.setHeight(400);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setPositionType(PositionType.Absolute);
+ root_child0_child0_child0.setWidth("50%");
+ root_child0_child0_child0.setHeight(50);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ root.calculateLayout(undefined, undefined, Direction.LTR);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(400);
+ expect(root.getComputedHeight()).toBe(400);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(400);
+ expect(root_child0.getComputedHeight()).toBe(400);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(100);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(100);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(200);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(400);
+ expect(root.getComputedHeight()).toBe(400);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(400);
+ expect(root_child0.getComputedHeight()).toBe(400);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(200);
+ expect(root_child0_child0.getComputedTop()).toBe(100);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(100);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(200);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_relative_child_containing_block_padding_box', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setPadding(Edge.Left, 100);
+ root_child0.setPadding(Edge.Top, 100);
+ root_child0.setPadding(Edge.Right, 100);
+ root_child0.setPadding(Edge.Bottom, 100);
+ root_child0.setWidth(400);
+ root_child0.setHeight(400);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setWidth("50%");
+ root_child0_child0_child0.setHeight(50);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ root.calculateLayout(undefined, undefined, Direction.LTR);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(400);
+ expect(root.getComputedHeight()).toBe(400);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(400);
+ expect(root_child0.getComputedHeight()).toBe(400);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(100);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(100);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(400);
+ expect(root.getComputedHeight()).toBe(400);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(400);
+ expect(root_child0.getComputedHeight()).toBe(400);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(200);
+ expect(root_child0_child0.getComputedTop()).toBe(100);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(250);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(100);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_static_child_containing_block_padding_box', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setPadding(Edge.Left, 100);
+ root_child0.setPadding(Edge.Top, 100);
+ root_child0.setPadding(Edge.Right, 100);
+ root_child0.setPadding(Edge.Bottom, 100);
+ root_child0.setWidth(400);
+ root_child0.setHeight(400);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setWidth(100);
+ root_child0_child0.setHeight(100);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0_child0.setWidth("50%");
+ root_child0_child0_child0.setHeight(50);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ root.calculateLayout(undefined, undefined, Direction.LTR);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(400);
+ expect(root.getComputedHeight()).toBe(400);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(400);
+ expect(root_child0.getComputedHeight()).toBe(400);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(100);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(100);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(400);
+ expect(root.getComputedHeight()).toBe(400);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(400);
+ expect(root_child0.getComputedHeight()).toBe(400);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(200);
+ expect(root_child0_child0.getComputedTop()).toBe(100);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(250);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(100);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_absolute_child_containing_block_content_box', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setPadding(Edge.Left, 100);
+ root_child0.setPadding(Edge.Top, 100);
+ root_child0.setPadding(Edge.Right, 100);
+ root_child0.setPadding(Edge.Bottom, 100);
+ root_child0.setWidth(400);
+ root_child0.setHeight(400);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Absolute);
+ root_child0_child0.setWidth("50%");
+ root_child0_child0.setHeight(50);
+ root_child0.insertChild(root_child0_child0, 0);
+ root.calculateLayout(undefined, undefined, Direction.LTR);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(400);
+ expect(root.getComputedHeight()).toBe(400);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(400);
+ expect(root_child0.getComputedHeight()).toBe(400);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(100);
+ expect(root_child0_child0.getComputedWidth()).toBe(200);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(400);
+ expect(root.getComputedHeight()).toBe(400);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(400);
+ expect(root_child0.getComputedHeight()).toBe(400);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(100);
+ expect(root_child0_child0.getComputedWidth()).toBe(200);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_relative_child_containing_block_content_box', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setPadding(Edge.Left, 100);
+ root_child0.setPadding(Edge.Top, 100);
+ root_child0.setPadding(Edge.Right, 100);
+ root_child0.setPadding(Edge.Bottom, 100);
+ root_child0.setWidth(400);
+ root_child0.setHeight(400);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setWidth("50%");
+ root_child0_child0.setHeight(50);
+ root_child0.insertChild(root_child0_child0, 0);
+ root.calculateLayout(undefined, undefined, Direction.LTR);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(400);
+ expect(root.getComputedHeight()).toBe(400);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(400);
+ expect(root_child0.getComputedHeight()).toBe(400);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(100);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(400);
+ expect(root.getComputedHeight()).toBe(400);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(400);
+ expect(root_child0.getComputedHeight()).toBe(400);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(200);
+ expect(root_child0_child0.getComputedTop()).toBe(100);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('static_position_static_child_containing_block_content_box', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
+
+ try {
+ root = Yoga.Node.create(config);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setPadding(Edge.Left, 100);
+ root_child0.setPadding(Edge.Top, 100);
+ root_child0.setPadding(Edge.Right, 100);
+ root_child0.setPadding(Edge.Bottom, 100);
+ root_child0.setWidth(400);
+ root_child0.setHeight(400);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setWidth("50%");
+ root_child0_child0.setHeight(50);
+ root_child0.insertChild(root_child0_child0, 0);
+ root.calculateLayout(undefined, undefined, Direction.LTR);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(400);
+ expect(root.getComputedHeight()).toBe(400);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(400);
+ expect(root_child0.getComputedHeight()).toBe(400);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0.getComputedTop()).toBe(100);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(400);
+ expect(root.getComputedHeight()).toBe(400);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(400);
+ expect(root_child0.getComputedHeight()).toBe(400);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(200);
+ expect(root_child0_child0.getComputedTop()).toBe(100);
+ expect(root_child0_child0.getComputedWidth()).toBe(100);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
} finally {
if (typeof root !== 'undefined') {
root.freeRecursive();
diff --git a/tests/generated/YGStaticPositionTest.cpp b/tests/generated/YGStaticPositionTest.cpp
index 377d21c191..ff0d84ea70 100644
--- a/tests/generated/YGStaticPositionTest.cpp
+++ b/tests/generated/YGStaticPositionTest.cpp
@@ -11,18 +11,65 @@
#include
#include
-TEST(YogaTest, static_position_insets_have_no_effect) {
+TEST(YogaTest, static_position_insets_have_no_effect_left_top) {
GTEST_SKIP();
const YGConfigRef config = YGConfigNew();
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
const YGNodeRef root = YGNodeNewWithConfig(config);
- YGNodeStyleSetPositionType(root, YGPositionTypeStatic);
- YGNodeStyleSetPosition(root, YGEdgeLeft, 50);
- YGNodeStyleSetPosition(root, YGEdgeTop, 50);
- YGNodeStyleSetWidth(root, 100);
- YGNodeStyleSetHeight(root, 100);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0, YGPositionTypeStatic);
+ YGNodeStyleSetPosition(root_child0, YGEdgeLeft, 50);
+ YGNodeStyleSetPosition(root_child0, YGEdgeTop, 50);
+ YGNodeStyleSetWidth(root_child0, 100);
+ YGNodeStyleSetHeight(root_child0, 100);
+ YGNodeInsertChild(root, root_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_insets_have_no_effect_right_bottom) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0, YGPositionTypeStatic);
+ YGNodeStyleSetPosition(root_child0, YGEdgeRight, 50);
+ YGNodeStyleSetPosition(root_child0, YGEdgeBottom, 50);
+ YGNodeStyleSetWidth(root_child0, 100);
+ YGNodeStyleSetHeight(root_child0, 100);
+ YGNodeInsertChild(root, root_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
@@ -30,6 +77,11 @@ TEST(YogaTest, static_position_insets_have_no_effect) {
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
+
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
@@ -37,6 +89,2624 @@ TEST(YogaTest, static_position_insets_have_no_effect) {
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_absolute_child_insets_relative_to_positioned_ancestor) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 200);
+ YGNodeStyleSetHeight(root_child0, 200);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetMargin(root_child0_child0, YGEdgeLeft, 100);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0_child0, YGPositionTypeAbsolute);
+ YGNodeStyleSetPosition(root_child0_child0_child0, YGEdgeLeft, 50);
+ YGNodeStyleSetPosition(root_child0_child0_child0, YGEdgeTop, 50);
+ YGNodeStyleSetWidth(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_absolute_child_insets_relative_to_positioned_ancestor_deep) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 200);
+ YGNodeStyleSetHeight(root_child0, 200);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetMargin(root_child0_child0, YGEdgeLeft, 100);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeLeft, 100);
+ YGNodeStyleSetWidth(root_child0_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 100);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetMargin(root_child0_child0_child0_child0, YGEdgeLeft, 100);
+ YGNodeStyleSetWidth(root_child0_child0_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0_child0_child0, 100);
+ YGNodeInsertChild(root_child0_child0_child0, root_child0_child0_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0_child0_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetMargin(root_child0_child0_child0_child0_child0, YGEdgeLeft, 100);
+ YGNodeStyleSetWidth(root_child0_child0_child0_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0_child0_child0_child0, 100);
+ YGNodeInsertChild(root_child0_child0_child0_child0, root_child0_child0_child0_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0_child0_child0_child0_child0, YGPositionTypeAbsolute);
+ YGNodeStyleSetPosition(root_child0_child0_child0_child0_child0_child0, YGEdgeLeft, 50);
+ YGNodeStyleSetPosition(root_child0_child0_child0_child0_child0_child0, YGEdgeTop, 50);
+ YGNodeStyleSetWidth(root_child0_child0_child0_child0_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0_child0_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0_child0_child0_child0, root_child0_child0_child0_child0_child0_child0, 0);
+ 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(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ ASSERT_FLOAT_EQ(300, YGNodeLayoutGetLeft(root_child0_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0_child0_child0));
+
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetLeft(root_child0_child0_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0_child0_child0_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child0_child0_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child0_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0_child0_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(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0_child0_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0_child0_child0_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child0_child0_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child0_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_absolute_child_width_percentage) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 200);
+ YGNodeStyleSetHeight(root_child0, 200);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0_child0, YGPositionTypeAbsolute);
+ YGNodeStyleSetWidthPercent(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_relative_child_width_percentage) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 200);
+ YGNodeStyleSetHeight(root_child0, 200);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidthPercent(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ 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(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_static_child_width_percentage) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 200);
+ YGNodeStyleSetHeight(root_child0, 200);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidthPercent(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ 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(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_absolute_child_height_percentage) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 200);
+ YGNodeStyleSetHeight(root_child0, 200);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0_child0, YGPositionTypeAbsolute);
+ YGNodeStyleSetWidth(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeightPercent(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_relative_child_height_percentage) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 200);
+ YGNodeStyleSetHeight(root_child0, 200);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeightPercent(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ 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(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_static_child_height_percentage) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 200);
+ YGNodeStyleSetHeight(root_child0, 200);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeightPercent(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ 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(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_absolute_child_left_percentage) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 200);
+ YGNodeStyleSetHeight(root_child0, 200);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0_child0, YGPositionTypeAbsolute);
+ YGNodeStyleSetPositionPercent(root_child0_child0_child0, YGEdgeLeft, 50);
+ YGNodeStyleSetWidth(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ 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(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_relative_child_left_percentage) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 200);
+ YGNodeStyleSetHeight(root_child0, 200);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionPercent(root_child0_child0_child0, YGEdgeLeft, 50);
+ YGNodeStyleSetWidth(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ 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(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_static_child_left_percentage) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 200);
+ YGNodeStyleSetHeight(root_child0, 200);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetPositionPercent(root_child0_child0_child0, YGEdgeLeft, 50);
+ YGNodeStyleSetWidth(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ 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(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_absolute_child_right_percentage) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 200);
+ YGNodeStyleSetHeight(root_child0, 200);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0_child0, YGPositionTypeAbsolute);
+ YGNodeStyleSetPositionPercent(root_child0_child0_child0, YGEdgeRight, 50);
+ YGNodeStyleSetWidth(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ 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(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_relative_child_right_percentage) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 200);
+ YGNodeStyleSetHeight(root_child0, 200);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionPercent(root_child0_child0_child0, YGEdgeRight, 50);
+ YGNodeStyleSetWidth(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(-50, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ 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(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_static_child_right_percentage) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 200);
+ YGNodeStyleSetHeight(root_child0, 200);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetPositionPercent(root_child0_child0_child0, YGEdgeRight, 50);
+ YGNodeStyleSetWidth(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ 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(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_absolute_child_top_percentage) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 200);
+ YGNodeStyleSetHeight(root_child0, 200);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0_child0, YGPositionTypeAbsolute);
+ YGNodeStyleSetPositionPercent(root_child0_child0_child0, YGEdgeTop, 50);
+ YGNodeStyleSetWidth(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_relative_child_top_percentage) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 200);
+ YGNodeStyleSetHeight(root_child0, 200);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionPercent(root_child0_child0_child0, YGEdgeTop, 50);
+ YGNodeStyleSetWidth(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_static_child_top_percentage) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 200);
+ YGNodeStyleSetHeight(root_child0, 200);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetPositionPercent(root_child0_child0_child0, YGEdgeTop, 50);
+ YGNodeStyleSetWidth(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ 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(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_absolute_child_bottom_percentage) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 200);
+ YGNodeStyleSetHeight(root_child0, 200);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0_child0, YGPositionTypeAbsolute);
+ YGNodeStyleSetPositionPercent(root_child0_child0_child0, YGEdgeBottom, 50);
+ YGNodeStyleSetWidth(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_relative_child_bottom_percentage) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 200);
+ YGNodeStyleSetHeight(root_child0, 200);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionPercent(root_child0_child0_child0, YGEdgeBottom, 50);
+ YGNodeStyleSetWidth(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(-50, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(-50, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_static_child_bottom_percentage) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 200);
+ YGNodeStyleSetHeight(root_child0, 200);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetPositionPercent(root_child0_child0_child0, YGEdgeBottom, 50);
+ YGNodeStyleSetWidth(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ 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(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_absolute_child_margin_percentage) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 200);
+ YGNodeStyleSetHeight(root_child0, 200);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0_child0, YGPositionTypeAbsolute);
+ YGNodeStyleSetMarginPercent(root_child0_child0_child0, YGEdgeLeft, 50);
+ YGNodeStyleSetMarginPercent(root_child0_child0_child0, YGEdgeTop, 50);
+ YGNodeStyleSetMarginPercent(root_child0_child0_child0, YGEdgeRight, 50);
+ YGNodeStyleSetMarginPercent(root_child0_child0_child0, YGEdgeBottom, 50);
+ YGNodeStyleSetWidth(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_relative_child_margin_percentage) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 200);
+ YGNodeStyleSetHeight(root_child0, 200);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetMarginPercent(root_child0_child0_child0, YGEdgeLeft, 50);
+ YGNodeStyleSetMarginPercent(root_child0_child0_child0, YGEdgeTop, 50);
+ YGNodeStyleSetMarginPercent(root_child0_child0_child0, YGEdgeRight, 50);
+ YGNodeStyleSetMarginPercent(root_child0_child0_child0, YGEdgeBottom, 50);
+ YGNodeStyleSetWidth(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_static_child_margin_percentage) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 200);
+ YGNodeStyleSetHeight(root_child0, 200);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetMarginPercent(root_child0_child0_child0, YGEdgeLeft, 50);
+ YGNodeStyleSetMarginPercent(root_child0_child0_child0, YGEdgeTop, 50);
+ YGNodeStyleSetMarginPercent(root_child0_child0_child0, YGEdgeRight, 50);
+ YGNodeStyleSetMarginPercent(root_child0_child0_child0, YGEdgeBottom, 50);
+ YGNodeStyleSetWidth(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_absolute_child_padding_percentage) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 200);
+ YGNodeStyleSetHeight(root_child0, 200);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0_child0, YGPositionTypeAbsolute);
+ YGNodeStyleSetPaddingPercent(root_child0_child0_child0, YGEdgeLeft, 50);
+ YGNodeStyleSetPaddingPercent(root_child0_child0_child0, YGEdgeTop, 50);
+ YGNodeStyleSetPaddingPercent(root_child0_child0_child0, YGEdgeRight, 50);
+ YGNodeStyleSetPaddingPercent(root_child0_child0_child0, YGEdgeBottom, 50);
+ YGNodeStyleSetWidth(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_relative_child_padding_percentage) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 200);
+ YGNodeStyleSetHeight(root_child0, 200);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPaddingPercent(root_child0_child0_child0, YGEdgeLeft, 50);
+ YGNodeStyleSetPaddingPercent(root_child0_child0_child0, YGEdgeTop, 50);
+ YGNodeStyleSetPaddingPercent(root_child0_child0_child0, YGEdgeRight, 50);
+ YGNodeStyleSetPaddingPercent(root_child0_child0_child0, YGEdgeBottom, 50);
+ YGNodeStyleSetWidth(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_static_child_padding_percentage) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 200);
+ YGNodeStyleSetHeight(root_child0, 200);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetPaddingPercent(root_child0_child0_child0, YGEdgeLeft, 50);
+ YGNodeStyleSetPaddingPercent(root_child0_child0_child0, YGEdgeTop, 50);
+ YGNodeStyleSetPaddingPercent(root_child0_child0_child0, YGEdgeRight, 50);
+ YGNodeStyleSetPaddingPercent(root_child0_child0_child0, YGEdgeBottom, 50);
+ YGNodeStyleSetWidth(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_absolute_child_border_percentage) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 200);
+ YGNodeStyleSetHeight(root_child0, 200);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0_child0, YGPositionTypeAbsolute);
+ YGNodeStyleSetWidth(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ 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(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_relative_child_border_percentage) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 200);
+ YGNodeStyleSetHeight(root_child0, 200);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ 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(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ 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(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_static_child_border_percentage) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 200);
+ YGNodeStyleSetHeight(root_child0, 200);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ 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(200, 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(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_absolute_child_containing_block_padding_box) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPadding(root_child0, YGEdgeLeft, 100);
+ YGNodeStyleSetPadding(root_child0, YGEdgeTop, 100);
+ YGNodeStyleSetPadding(root_child0, YGEdgeRight, 100);
+ YGNodeStyleSetPadding(root_child0, YGEdgeBottom, 100);
+ YGNodeStyleSetWidth(root_child0, 400);
+ YGNodeStyleSetHeight(root_child0, 400);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0_child0, YGPositionTypeAbsolute);
+ YGNodeStyleSetWidthPercent(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_relative_child_containing_block_padding_box) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPadding(root_child0, YGEdgeLeft, 100);
+ YGNodeStyleSetPadding(root_child0, YGEdgeTop, 100);
+ YGNodeStyleSetPadding(root_child0, YGEdgeRight, 100);
+ YGNodeStyleSetPadding(root_child0, YGEdgeBottom, 100);
+ YGNodeStyleSetWidth(root_child0, 400);
+ YGNodeStyleSetHeight(root_child0, 400);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidthPercent(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(250, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_static_child_containing_block_padding_box) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPadding(root_child0, YGEdgeLeft, 100);
+ YGNodeStyleSetPadding(root_child0, YGEdgeTop, 100);
+ YGNodeStyleSetPadding(root_child0, YGEdgeRight, 100);
+ YGNodeStyleSetPadding(root_child0, YGEdgeBottom, 100);
+ YGNodeStyleSetWidth(root_child0, 400);
+ YGNodeStyleSetHeight(root_child0, 400);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidth(root_child0_child0, 100);
+ YGNodeStyleSetHeight(root_child0_child0, 100);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidthPercent(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(250, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_absolute_child_containing_block_content_box) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPadding(root_child0, YGEdgeLeft, 100);
+ YGNodeStyleSetPadding(root_child0, YGEdgeTop, 100);
+ YGNodeStyleSetPadding(root_child0, YGEdgeRight, 100);
+ YGNodeStyleSetPadding(root_child0, YGEdgeBottom, 100);
+ YGNodeStyleSetWidth(root_child0, 400);
+ YGNodeStyleSetHeight(root_child0, 400);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeAbsolute);
+ YGNodeStyleSetWidthPercent(root_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0, 50);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_relative_child_containing_block_content_box) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPadding(root_child0, YGEdgeLeft, 100);
+ YGNodeStyleSetPadding(root_child0, YGEdgeTop, 100);
+ YGNodeStyleSetPadding(root_child0, YGEdgeRight, 100);
+ YGNodeStyleSetPadding(root_child0, YGEdgeBottom, 100);
+ YGNodeStyleSetWidth(root_child0, 400);
+ YGNodeStyleSetHeight(root_child0, 400);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidthPercent(root_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0, 50);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, static_position_static_child_containing_block_content_box) {
+ GTEST_SKIP();
+
+ const YGConfigRef config = YGConfigNew();
+ YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPadding(root_child0, YGEdgeLeft, 100);
+ YGNodeStyleSetPadding(root_child0, YGEdgeTop, 100);
+ YGNodeStyleSetPadding(root_child0, YGEdgeRight, 100);
+ YGNodeStyleSetPadding(root_child0, YGEdgeBottom, 100);
+ YGNodeStyleSetWidth(root_child0, 400);
+ YGNodeStyleSetHeight(root_child0, 400);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetWidthPercent(root_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0, 50);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
YGNodeFreeRecursive(root);
YGConfigFree(config);