From a355ce6a242edf603dd6567e9b327148a4b8013b Mon Sep 17 00:00:00 2001 From: Joe Vilches Date: Mon, 4 Dec 2023 11:31:10 -0800 Subject: [PATCH] Fix bug with align start not taking into account parent padding (#1484) Summary: Pull Request resolved: https://github.com/facebook/yoga/pull/1484 X-link: https://github.com/facebook/react-native/pull/41687 Tsia. Added test and accounted for parent padding Reviewed By: NickGerleman Differential Revision: D51374086 fbshipit-source-id: 3c8b83b16886b60e843b7aa867a57da2624ba842 --- gentest/fixtures/YGStaticPositionTest.html | 141 ++ .../facebook/yoga/YGStaticPositionTest.java | 1283 ++++++++++++++++ .../generated/YGStaticPositionTest.test.ts | 1337 +++++++++++++++++ tests/generated/YGStaticPositionTest.cpp | 1292 ++++++++++++++++ yoga/algorithm/AbsoluteLayout.cpp | 3 +- 5 files changed, 4055 insertions(+), 1 deletion(-) diff --git a/gentest/fixtures/YGStaticPositionTest.html b/gentest/fixtures/YGStaticPositionTest.html index 345c11cede..6db738684a 100644 --- a/gentest/fixtures/YGStaticPositionTest.html +++ b/gentest/fixtures/YGStaticPositionTest.html @@ -334,3 +334,144 @@ + + +
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/java/tests/com/facebook/yoga/YGStaticPositionTest.java b/java/tests/com/facebook/yoga/YGStaticPositionTest.java index dc43dca4ad..b5c9bf1b8c 100644 --- a/java/tests/com/facebook/yoga/YGStaticPositionTest.java +++ b/java/tests/com/facebook/yoga/YGStaticPositionTest.java @@ -2732,6 +2732,1289 @@ public void test_static_position_containing_block_padding_and_border() { assertEquals(239f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } + @Test + public void test_static_position_amalgamation() { + YogaConfig config = YogaConfigFactory.create(); + config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); + + final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); + + final YogaNode root_child0 = createNode(config); + root_child0.setPositionType(YogaPositionType.RELATIVE); + root_child0.setMargin(YogaEdge.LEFT, 4f); + root_child0.setMargin(YogaEdge.TOP, 5f); + root_child0.setMargin(YogaEdge.RIGHT, 9f); + root_child0.setMargin(YogaEdge.BOTTOM, 1f); + root_child0.setPadding(YogaEdge.LEFT, 2); + root_child0.setPadding(YogaEdge.TOP, 9); + root_child0.setPadding(YogaEdge.RIGHT, 11); + root_child0.setPadding(YogaEdge.BOTTOM, 13); + root_child0.setBorder(YogaEdge.LEFT, 5f); + root_child0.setBorder(YogaEdge.TOP, 6f); + root_child0.setBorder(YogaEdge.RIGHT, 7f); + root_child0.setBorder(YogaEdge.BOTTOM, 8f); + root_child0.setWidth(500f); + root_child0.setHeight(500f); + root.addChildAt(root_child0, 0); + + final YogaNode root_child0_child0 = createNode(config); + root_child0_child0.setMargin(YogaEdge.LEFT, 8f); + root_child0_child0.setMargin(YogaEdge.TOP, 6f); + root_child0_child0.setMargin(YogaEdge.RIGHT, 3f); + root_child0_child0.setMargin(YogaEdge.BOTTOM, 9f); + root_child0_child0.setPadding(YogaEdge.LEFT, 1); + root_child0_child0.setPadding(YogaEdge.TOP, 7); + root_child0_child0.setPadding(YogaEdge.RIGHT, 9); + root_child0_child0.setPadding(YogaEdge.BOTTOM, 4); + root_child0_child0.setBorder(YogaEdge.LEFT, 8f); + root_child0_child0.setBorder(YogaEdge.TOP, 10f); + root_child0_child0.setBorder(YogaEdge.RIGHT, 2f); + root_child0_child0.setBorder(YogaEdge.BOTTOM, 1f); + root_child0_child0.setWidth(200f); + root_child0_child0.setHeight(200f); + 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, 2f); + root_child0_child0_child0.setPosition(YogaEdge.RIGHT, 12f); + root_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); + root_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); + root_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); + root_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); + root_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); + root_child0_child0_child0.setPadding(YogaEdge.TOP, 3); + root_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); + root_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); + root_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); + root_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); + root_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); + root_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); + root_child0_child0_child0.setWidthPercent(41f); + root_child0_child0_child0.setHeightPercent(63f); + 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(513f, root.getLayoutWidth(), 0.0f); + assertEquals(506f, root.getLayoutHeight(), 0.0f); + + assertEquals(4f, root_child0.getLayoutX(), 0.0f); + assertEquals(5f, root_child0.getLayoutY(), 0.0f); + assertEquals(500f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(1f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(306f, 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(513f, root.getLayoutWidth(), 0.0f); + assertEquals(506f, root.getLayoutHeight(), 0.0f); + + assertEquals(4f, root_child0.getLayoutX(), 0.0f); + assertEquals(5f, root_child0.getLayoutY(), 0.0f); + assertEquals(500f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(279f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(-2f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(306f, root_child0_child0_child0.getLayoutHeight(), 0.0f); + } + + @Test + public void test_static_position_no_position_amalgamation() { + YogaConfig config = YogaConfigFactory.create(); + config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); + + final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); + + final YogaNode root_child0 = createNode(config); + root_child0.setPositionType(YogaPositionType.RELATIVE); + root_child0.setMargin(YogaEdge.LEFT, 4f); + root_child0.setMargin(YogaEdge.TOP, 5f); + root_child0.setMargin(YogaEdge.RIGHT, 9f); + root_child0.setMargin(YogaEdge.BOTTOM, 1f); + root_child0.setPadding(YogaEdge.LEFT, 2); + root_child0.setPadding(YogaEdge.TOP, 9); + root_child0.setPadding(YogaEdge.RIGHT, 11); + root_child0.setPadding(YogaEdge.BOTTOM, 13); + root_child0.setBorder(YogaEdge.LEFT, 5f); + root_child0.setBorder(YogaEdge.TOP, 6f); + root_child0.setBorder(YogaEdge.RIGHT, 7f); + root_child0.setBorder(YogaEdge.BOTTOM, 8f); + root_child0.setWidth(500f); + root_child0.setHeight(500f); + root.addChildAt(root_child0, 0); + + final YogaNode root_child0_child0 = createNode(config); + root_child0_child0.setMargin(YogaEdge.LEFT, 8f); + root_child0_child0.setMargin(YogaEdge.TOP, 6f); + root_child0_child0.setMargin(YogaEdge.RIGHT, 3f); + root_child0_child0.setMargin(YogaEdge.BOTTOM, 9f); + root_child0_child0.setPadding(YogaEdge.LEFT, 1); + root_child0_child0.setPadding(YogaEdge.TOP, 7); + root_child0_child0.setPadding(YogaEdge.RIGHT, 9); + root_child0_child0.setPadding(YogaEdge.BOTTOM, 4); + root_child0_child0.setBorder(YogaEdge.LEFT, 8f); + root_child0_child0.setBorder(YogaEdge.TOP, 10f); + root_child0_child0.setBorder(YogaEdge.RIGHT, 2f); + root_child0_child0.setBorder(YogaEdge.BOTTOM, 1f); + root_child0_child0.setWidth(200f); + root_child0_child0.setHeight(200f); + 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.setMargin(YogaEdge.LEFT, 9f); + root_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); + root_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); + root_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); + root_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); + root_child0_child0_child0.setPadding(YogaEdge.TOP, 3); + root_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); + root_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); + root_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); + root_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); + root_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); + root_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); + root_child0_child0_child0.setWidthPercent(41f); + root_child0_child0_child0.setHeightPercent(63f); + 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(513f, root.getLayoutWidth(), 0.0f); + assertEquals(506f, root.getLayoutHeight(), 0.0f); + + assertEquals(4f, root_child0.getLayoutX(), 0.0f); + assertEquals(5f, root_child0.getLayoutY(), 0.0f); + assertEquals(500f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(18f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(306f, 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(513f, root.getLayoutWidth(), 0.0f); + assertEquals(506f, root.getLayoutHeight(), 0.0f); + + assertEquals(4f, root_child0.getLayoutX(), 0.0f); + assertEquals(5f, root_child0.getLayoutY(), 0.0f); + assertEquals(500f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(279f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(-15f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(306f, root_child0_child0_child0.getLayoutHeight(), 0.0f); + } + + @Test + public void test_static_position_zero_for_inset_amalgamation() { + YogaConfig config = YogaConfigFactory.create(); + config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); + + final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); + + final YogaNode root_child0 = createNode(config); + root_child0.setPositionType(YogaPositionType.RELATIVE); + root_child0.setMargin(YogaEdge.LEFT, 4f); + root_child0.setMargin(YogaEdge.TOP, 5f); + root_child0.setMargin(YogaEdge.RIGHT, 9f); + root_child0.setMargin(YogaEdge.BOTTOM, 1f); + root_child0.setPadding(YogaEdge.LEFT, 2); + root_child0.setPadding(YogaEdge.TOP, 9); + root_child0.setPadding(YogaEdge.RIGHT, 11); + root_child0.setPadding(YogaEdge.BOTTOM, 13); + root_child0.setBorder(YogaEdge.LEFT, 5f); + root_child0.setBorder(YogaEdge.TOP, 6f); + root_child0.setBorder(YogaEdge.RIGHT, 7f); + root_child0.setBorder(YogaEdge.BOTTOM, 8f); + root_child0.setWidth(500f); + root_child0.setHeight(500f); + root.addChildAt(root_child0, 0); + + final YogaNode root_child0_child0 = createNode(config); + root_child0_child0.setMargin(YogaEdge.LEFT, 8f); + root_child0_child0.setMargin(YogaEdge.TOP, 6f); + root_child0_child0.setMargin(YogaEdge.RIGHT, 3f); + root_child0_child0.setMargin(YogaEdge.BOTTOM, 9f); + root_child0_child0.setPadding(YogaEdge.LEFT, 1); + root_child0_child0.setPadding(YogaEdge.TOP, 7); + root_child0_child0.setPadding(YogaEdge.RIGHT, 9); + root_child0_child0.setPadding(YogaEdge.BOTTOM, 4); + root_child0_child0.setBorder(YogaEdge.LEFT, 8f); + root_child0_child0.setBorder(YogaEdge.TOP, 10f); + root_child0_child0.setBorder(YogaEdge.RIGHT, 2f); + root_child0_child0.setBorder(YogaEdge.BOTTOM, 1f); + root_child0_child0.setWidth(200f); + root_child0_child0.setHeight(200f); + 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, 0f); + root_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); + root_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); + root_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); + root_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); + root_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); + root_child0_child0_child0.setPadding(YogaEdge.TOP, 3); + root_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); + root_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); + root_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); + root_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); + root_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); + root_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); + root_child0_child0_child0.setWidthPercent(41f); + root_child0_child0_child0.setHeightPercent(63f); + 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(513f, root.getLayoutWidth(), 0.0f); + assertEquals(506f, root.getLayoutHeight(), 0.0f); + + assertEquals(4f, root_child0.getLayoutX(), 0.0f); + assertEquals(5f, root_child0.getLayoutY(), 0.0f); + assertEquals(500f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(-1f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(306f, 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(513f, root.getLayoutWidth(), 0.0f); + assertEquals(506f, root.getLayoutHeight(), 0.0f); + + assertEquals(4f, root_child0.getLayoutX(), 0.0f); + assertEquals(5f, root_child0.getLayoutY(), 0.0f); + assertEquals(500f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(279f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(-265f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(306f, root_child0_child0_child0.getLayoutHeight(), 0.0f); + } + + @Test + public void test_static_position_start_inset_amalgamation() { + YogaConfig config = YogaConfigFactory.create(); + config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); + + final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); + + final YogaNode root_child0 = createNode(config); + root_child0.setPositionType(YogaPositionType.RELATIVE); + root_child0.setMargin(YogaEdge.LEFT, 4f); + root_child0.setMargin(YogaEdge.TOP, 5f); + root_child0.setMargin(YogaEdge.RIGHT, 9f); + root_child0.setMargin(YogaEdge.BOTTOM, 1f); + root_child0.setPadding(YogaEdge.LEFT, 2); + root_child0.setPadding(YogaEdge.TOP, 9); + root_child0.setPadding(YogaEdge.RIGHT, 11); + root_child0.setPadding(YogaEdge.BOTTOM, 13); + root_child0.setBorder(YogaEdge.LEFT, 5f); + root_child0.setBorder(YogaEdge.TOP, 6f); + root_child0.setBorder(YogaEdge.RIGHT, 7f); + root_child0.setBorder(YogaEdge.BOTTOM, 8f); + root_child0.setWidth(500f); + root_child0.setHeight(500f); + root.addChildAt(root_child0, 0); + + final YogaNode root_child0_child0 = createNode(config); + root_child0_child0.setMargin(YogaEdge.LEFT, 8f); + root_child0_child0.setMargin(YogaEdge.TOP, 6f); + root_child0_child0.setMargin(YogaEdge.RIGHT, 3f); + root_child0_child0.setMargin(YogaEdge.BOTTOM, 9f); + root_child0_child0.setPadding(YogaEdge.LEFT, 1); + root_child0_child0.setPadding(YogaEdge.TOP, 7); + root_child0_child0.setPadding(YogaEdge.RIGHT, 9); + root_child0_child0.setPadding(YogaEdge.BOTTOM, 4); + root_child0_child0.setBorder(YogaEdge.LEFT, 8f); + root_child0_child0.setBorder(YogaEdge.TOP, 10f); + root_child0_child0.setBorder(YogaEdge.RIGHT, 2f); + root_child0_child0.setBorder(YogaEdge.BOTTOM, 1f); + root_child0_child0.setWidth(200f); + root_child0_child0.setHeight(200f); + 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.START, 12f); + root_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); + root_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); + root_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); + root_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); + root_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); + root_child0_child0_child0.setPadding(YogaEdge.TOP, 3); + root_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); + root_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); + root_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); + root_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); + root_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); + root_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); + root_child0_child0_child0.setWidthPercent(41f); + root_child0_child0_child0.setHeightPercent(63f); + 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(513f, root.getLayoutWidth(), 0.0f); + assertEquals(506f, root.getLayoutHeight(), 0.0f); + + assertEquals(4f, root_child0.getLayoutX(), 0.0f); + assertEquals(5f, root_child0.getLayoutY(), 0.0f); + assertEquals(500f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(11f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(306f, 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(513f, root.getLayoutWidth(), 0.0f); + assertEquals(506f, root.getLayoutHeight(), 0.0f); + + assertEquals(4f, root_child0.getLayoutX(), 0.0f); + assertEquals(5f, root_child0.getLayoutY(), 0.0f); + assertEquals(500f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(279f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(-2f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(306f, root_child0_child0_child0.getLayoutHeight(), 0.0f); + } + + @Test + public void test_static_position_end_inset_amalgamation() { + YogaConfig config = YogaConfigFactory.create(); + config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); + + final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); + + final YogaNode root_child0 = createNode(config); + root_child0.setPositionType(YogaPositionType.RELATIVE); + root_child0.setMargin(YogaEdge.LEFT, 4f); + root_child0.setMargin(YogaEdge.TOP, 5f); + root_child0.setMargin(YogaEdge.RIGHT, 9f); + root_child0.setMargin(YogaEdge.BOTTOM, 1f); + root_child0.setPadding(YogaEdge.LEFT, 2); + root_child0.setPadding(YogaEdge.TOP, 9); + root_child0.setPadding(YogaEdge.RIGHT, 11); + root_child0.setPadding(YogaEdge.BOTTOM, 13); + root_child0.setBorder(YogaEdge.LEFT, 5f); + root_child0.setBorder(YogaEdge.TOP, 6f); + root_child0.setBorder(YogaEdge.RIGHT, 7f); + root_child0.setBorder(YogaEdge.BOTTOM, 8f); + root_child0.setWidth(500f); + root_child0.setHeight(500f); + root.addChildAt(root_child0, 0); + + final YogaNode root_child0_child0 = createNode(config); + root_child0_child0.setMargin(YogaEdge.LEFT, 8f); + root_child0_child0.setMargin(YogaEdge.TOP, 6f); + root_child0_child0.setMargin(YogaEdge.RIGHT, 3f); + root_child0_child0.setMargin(YogaEdge.BOTTOM, 9f); + root_child0_child0.setPadding(YogaEdge.LEFT, 1); + root_child0_child0.setPadding(YogaEdge.TOP, 7); + root_child0_child0.setPadding(YogaEdge.RIGHT, 9); + root_child0_child0.setPadding(YogaEdge.BOTTOM, 4); + root_child0_child0.setBorder(YogaEdge.LEFT, 8f); + root_child0_child0.setBorder(YogaEdge.TOP, 10f); + root_child0_child0.setBorder(YogaEdge.RIGHT, 2f); + root_child0_child0.setBorder(YogaEdge.BOTTOM, 1f); + root_child0_child0.setWidth(200f); + root_child0_child0.setHeight(200f); + 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.END, 4f); + root_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); + root_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); + root_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); + root_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); + root_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); + root_child0_child0_child0.setPadding(YogaEdge.TOP, 3); + root_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); + root_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); + root_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); + root_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); + root_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); + root_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); + root_child0_child0_child0.setWidthPercent(41f); + root_child0_child0_child0.setHeightPercent(63f); + 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(513f, root.getLayoutWidth(), 0.0f); + assertEquals(506f, root.getLayoutHeight(), 0.0f); + + assertEquals(4f, root_child0.getLayoutX(), 0.0f); + assertEquals(5f, root_child0.getLayoutY(), 0.0f); + assertEquals(500f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(270f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(306f, 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(513f, root.getLayoutWidth(), 0.0f); + assertEquals(506f, root.getLayoutHeight(), 0.0f); + + assertEquals(4f, root_child0.getLayoutX(), 0.0f); + assertEquals(5f, root_child0.getLayoutY(), 0.0f); + assertEquals(500f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(279f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(-261f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(200f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(306f, root_child0_child0_child0.getLayoutHeight(), 0.0f); + } + + @Test + public void test_static_position_row_reverse_amalgamation() { + YogaConfig config = YogaConfigFactory.create(); + config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); + + final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); + + final YogaNode root_child0 = createNode(config); + root_child0.setPositionType(YogaPositionType.RELATIVE); + root_child0.setMargin(YogaEdge.LEFT, 4f); + root_child0.setMargin(YogaEdge.TOP, 5f); + root_child0.setMargin(YogaEdge.RIGHT, 9f); + root_child0.setMargin(YogaEdge.BOTTOM, 1f); + root_child0.setPadding(YogaEdge.LEFT, 2); + root_child0.setPadding(YogaEdge.TOP, 9); + root_child0.setPadding(YogaEdge.RIGHT, 11); + root_child0.setPadding(YogaEdge.BOTTOM, 13); + root_child0.setBorder(YogaEdge.LEFT, 5f); + root_child0.setBorder(YogaEdge.TOP, 6f); + root_child0.setBorder(YogaEdge.RIGHT, 7f); + root_child0.setBorder(YogaEdge.BOTTOM, 8f); + root.addChildAt(root_child0, 0); + + final YogaNode root_child0_child0 = createNode(config); + root_child0_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE); + root_child0_child0.setMargin(YogaEdge.LEFT, 8f); + root_child0_child0.setMargin(YogaEdge.TOP, 6f); + root_child0_child0.setMargin(YogaEdge.RIGHT, 3f); + root_child0_child0.setMargin(YogaEdge.BOTTOM, 9f); + root_child0_child0.setPadding(YogaEdge.LEFT, 1); + root_child0_child0.setPadding(YogaEdge.TOP, 7); + root_child0_child0.setPadding(YogaEdge.RIGHT, 9); + root_child0_child0.setPadding(YogaEdge.BOTTOM, 4); + root_child0_child0.setBorder(YogaEdge.LEFT, 8f); + root_child0_child0.setBorder(YogaEdge.TOP, 10f); + root_child0_child0.setBorder(YogaEdge.RIGHT, 2f); + root_child0_child0.setBorder(YogaEdge.BOTTOM, 1f); + 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.setMargin(YogaEdge.LEFT, 9f); + root_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); + root_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); + root_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); + root_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); + root_child0_child0_child0.setPadding(YogaEdge.TOP, 3); + root_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); + root_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); + root_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); + root_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); + root_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); + root_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); + root_child0_child0_child0.setHeightPercent(12f); + 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.RELATIVE); + root_child0_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); + root_child0_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); + root_child0_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); + root_child0_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); + root_child0_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); + root_child0_child0_child0_child0.setPadding(YogaEdge.TOP, 3); + root_child0_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); + root_child0_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); + root_child0_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); + root_child0_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); + root_child0_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); + root_child0_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); + root_child0_child0_child0_child0.setWidth(100f); + root_child0_child0_child0_child0.setHeight(50f); + root_child0_child0_child0.addChildAt(root_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(69f, root.getLayoutWidth(), 0.0f); + assertEquals(79f, root.getLayoutHeight(), 0.0f); + + assertEquals(4f, root_child0.getLayoutX(), 0.0f); + assertEquals(5f, root_child0.getLayoutY(), 0.0f); + assertEquals(56f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(73f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(20f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(22f, root_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(-128f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(133f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(23f, root_child0_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(16f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(16f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_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(69f, root.getLayoutWidth(), 0.0f); + assertEquals(79f, root.getLayoutHeight(), 0.0f); + + assertEquals(4f, root_child0.getLayoutX(), 0.0f); + assertEquals(5f, root_child0.getLayoutY(), 0.0f); + assertEquals(56f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(73f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(20f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(22f, root_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(18f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(133f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(23f, root_child0_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(16f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(16f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f); + } + + @Test + public void test_static_position_column_reverse_amalgamation() { + YogaConfig config = YogaConfigFactory.create(); + config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); + + final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); + + final YogaNode root_child0 = createNode(config); + root_child0.setPositionType(YogaPositionType.RELATIVE); + root_child0.setMargin(YogaEdge.LEFT, 4f); + root_child0.setMargin(YogaEdge.TOP, 5f); + root_child0.setMargin(YogaEdge.RIGHT, 9f); + root_child0.setMargin(YogaEdge.BOTTOM, 1f); + root_child0.setPadding(YogaEdge.LEFT, 2); + root_child0.setPadding(YogaEdge.TOP, 9); + root_child0.setPadding(YogaEdge.RIGHT, 11); + root_child0.setPadding(YogaEdge.BOTTOM, 13); + root_child0.setBorder(YogaEdge.LEFT, 5f); + root_child0.setBorder(YogaEdge.TOP, 6f); + root_child0.setBorder(YogaEdge.RIGHT, 7f); + root_child0.setBorder(YogaEdge.BOTTOM, 8f); + root.addChildAt(root_child0, 0); + + final YogaNode root_child0_child0 = createNode(config); + root_child0_child0.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE); + root_child0_child0.setMargin(YogaEdge.LEFT, 8f); + root_child0_child0.setMargin(YogaEdge.TOP, 6f); + root_child0_child0.setMargin(YogaEdge.RIGHT, 3f); + root_child0_child0.setMargin(YogaEdge.BOTTOM, 9f); + root_child0_child0.setPadding(YogaEdge.LEFT, 1); + root_child0_child0.setPadding(YogaEdge.TOP, 7); + root_child0_child0.setPadding(YogaEdge.RIGHT, 9); + root_child0_child0.setPadding(YogaEdge.BOTTOM, 4); + root_child0_child0.setBorder(YogaEdge.LEFT, 8f); + root_child0_child0.setBorder(YogaEdge.TOP, 10f); + root_child0_child0.setBorder(YogaEdge.RIGHT, 2f); + root_child0_child0.setBorder(YogaEdge.BOTTOM, 1f); + 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.setMargin(YogaEdge.LEFT, 9f); + root_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); + root_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); + root_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); + root_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); + root_child0_child0_child0.setPadding(YogaEdge.TOP, 3); + root_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); + root_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); + root_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); + root_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); + root_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); + root_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); + root_child0_child0_child0.setWidthPercent(21f); + 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.RELATIVE); + root_child0_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); + root_child0_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); + root_child0_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); + root_child0_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); + root_child0_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); + root_child0_child0_child0_child0.setPadding(YogaEdge.TOP, 3); + root_child0_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); + root_child0_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); + root_child0_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); + root_child0_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); + root_child0_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); + root_child0_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); + root_child0_child0_child0_child0.setWidth(100f); + root_child0_child0_child0_child0.setHeight(50f); + root_child0_child0_child0.addChildAt(root_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(69f, root.getLayoutWidth(), 0.0f); + assertEquals(79f, root.getLayoutHeight(), 0.0f); + + assertEquals(4f, root_child0.getLayoutX(), 0.0f); + assertEquals(5f, root_child0.getLayoutY(), 0.0f); + assertEquals(56f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(73f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(20f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(22f, root_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(18f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(-82f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(20f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(92f, root_child0_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(16f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(16f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_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(69f, root.getLayoutWidth(), 0.0f); + assertEquals(79f, root.getLayoutHeight(), 0.0f); + + assertEquals(4f, root_child0.getLayoutX(), 0.0f); + assertEquals(5f, root_child0.getLayoutY(), 0.0f); + assertEquals(56f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(73f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(20f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(22f, root_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(-15f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(-82f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(20f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(92f, root_child0_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(-97f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(16f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f); + } + + @Test + public void test_static_position_justify_flex_start_amalgamation() { + YogaConfig config = YogaConfigFactory.create(); + config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); + + final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); + + final YogaNode root_child0 = createNode(config); + root_child0.setPositionType(YogaPositionType.RELATIVE); + root_child0.setMargin(YogaEdge.LEFT, 4f); + root_child0.setMargin(YogaEdge.TOP, 5f); + root_child0.setMargin(YogaEdge.RIGHT, 9f); + root_child0.setMargin(YogaEdge.BOTTOM, 1f); + root_child0.setPadding(YogaEdge.LEFT, 2); + root_child0.setPadding(YogaEdge.TOP, 9); + root_child0.setPadding(YogaEdge.RIGHT, 11); + root_child0.setPadding(YogaEdge.BOTTOM, 13); + root_child0.setBorder(YogaEdge.LEFT, 5f); + root_child0.setBorder(YogaEdge.TOP, 6f); + root_child0.setBorder(YogaEdge.RIGHT, 7f); + root_child0.setBorder(YogaEdge.BOTTOM, 8f); + root.addChildAt(root_child0, 0); + + final YogaNode root_child0_child0 = createNode(config); + root_child0_child0.setMargin(YogaEdge.LEFT, 8f); + root_child0_child0.setMargin(YogaEdge.TOP, 6f); + root_child0_child0.setMargin(YogaEdge.RIGHT, 3f); + root_child0_child0.setMargin(YogaEdge.BOTTOM, 9f); + root_child0_child0.setPadding(YogaEdge.LEFT, 1); + root_child0_child0.setPadding(YogaEdge.TOP, 7); + root_child0_child0.setPadding(YogaEdge.RIGHT, 9); + root_child0_child0.setPadding(YogaEdge.BOTTOM, 4); + root_child0_child0.setBorder(YogaEdge.LEFT, 8f); + root_child0_child0.setBorder(YogaEdge.TOP, 10f); + root_child0_child0.setBorder(YogaEdge.RIGHT, 2f); + root_child0_child0.setBorder(YogaEdge.BOTTOM, 1f); + 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.setMargin(YogaEdge.LEFT, 9f); + root_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); + root_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); + root_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); + root_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); + root_child0_child0_child0.setPadding(YogaEdge.TOP, 3); + root_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); + root_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); + root_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); + root_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); + root_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); + root_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); + root_child0_child0_child0.setWidthPercent(21f); + 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.RELATIVE); + root_child0_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); + root_child0_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); + root_child0_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); + root_child0_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); + root_child0_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); + root_child0_child0_child0_child0.setPadding(YogaEdge.TOP, 3); + root_child0_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); + root_child0_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); + root_child0_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); + root_child0_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); + root_child0_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); + root_child0_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); + root_child0_child0_child0_child0.setWidth(100f); + root_child0_child0_child0_child0.setHeight(50f); + root_child0_child0_child0.addChildAt(root_child0_child0_child0_child0, 0); + + final YogaNode root_child0_child0_child1 = createNode(config); + root_child0_child0_child1.setPositionType(YogaPositionType.RELATIVE); + root_child0_child0_child1.setMargin(YogaEdge.LEFT, 9f); + root_child0_child0_child1.setMargin(YogaEdge.TOP, 12f); + root_child0_child0_child1.setMargin(YogaEdge.RIGHT, 4f); + root_child0_child0_child1.setMargin(YogaEdge.BOTTOM, 7f); + root_child0_child0_child1.setPadding(YogaEdge.LEFT, 5); + root_child0_child0_child1.setPadding(YogaEdge.TOP, 3); + root_child0_child0_child1.setPadding(YogaEdge.RIGHT, 8); + root_child0_child0_child1.setPadding(YogaEdge.BOTTOM, 10); + root_child0_child0_child1.setBorder(YogaEdge.LEFT, 2f); + root_child0_child0_child1.setBorder(YogaEdge.TOP, 1f); + root_child0_child0_child1.setBorder(YogaEdge.RIGHT, 5f); + root_child0_child0_child1.setBorder(YogaEdge.BOTTOM, 9f); + root_child0_child0_child1.setWidthPercent(10f); + root_child0_child0.addChildAt(root_child0_child0_child1, 1); + + final YogaNode root_child0_child0_child1_child0 = createNode(config); + root_child0_child0_child1_child0.setPositionType(YogaPositionType.RELATIVE); + root_child0_child0_child1_child0.setMargin(YogaEdge.LEFT, 9f); + root_child0_child0_child1_child0.setMargin(YogaEdge.TOP, 12f); + root_child0_child0_child1_child0.setMargin(YogaEdge.RIGHT, 4f); + root_child0_child0_child1_child0.setMargin(YogaEdge.BOTTOM, 7f); + root_child0_child0_child1_child0.setPadding(YogaEdge.LEFT, 5); + root_child0_child0_child1_child0.setPadding(YogaEdge.TOP, 3); + root_child0_child0_child1_child0.setPadding(YogaEdge.RIGHT, 8); + root_child0_child0_child1_child0.setPadding(YogaEdge.BOTTOM, 10); + root_child0_child0_child1_child0.setBorder(YogaEdge.LEFT, 2f); + root_child0_child0_child1_child0.setBorder(YogaEdge.TOP, 1f); + root_child0_child0_child1_child0.setBorder(YogaEdge.RIGHT, 5f); + root_child0_child0_child1_child0.setBorder(YogaEdge.BOTTOM, 9f); + root_child0_child0_child1_child0.setWidth(100f); + root_child0_child0_child1_child0.setHeight(50f); + root_child0_child0_child1.addChildAt(root_child0_child0_child1_child0, 0); + + final YogaNode root_child0_child0_child2 = createNode(config); + root_child0_child0_child2.setPositionType(YogaPositionType.RELATIVE); + root_child0_child0_child2.setMargin(YogaEdge.LEFT, 9f); + root_child0_child0_child2.setMargin(YogaEdge.TOP, 12f); + root_child0_child0_child2.setMargin(YogaEdge.RIGHT, 4f); + root_child0_child0_child2.setMargin(YogaEdge.BOTTOM, 7f); + root_child0_child0_child2.setPadding(YogaEdge.LEFT, 5); + root_child0_child0_child2.setPadding(YogaEdge.TOP, 3); + root_child0_child0_child2.setPadding(YogaEdge.RIGHT, 8); + root_child0_child0_child2.setPadding(YogaEdge.BOTTOM, 10); + root_child0_child0_child2.setBorder(YogaEdge.LEFT, 2f); + root_child0_child0_child2.setBorder(YogaEdge.TOP, 1f); + root_child0_child0_child2.setBorder(YogaEdge.RIGHT, 5f); + root_child0_child0_child2.setBorder(YogaEdge.BOTTOM, 9f); + root_child0_child0_child2.setWidthPercent(10f); + root_child0_child0.addChildAt(root_child0_child0_child2, 2); + + final YogaNode root_child0_child0_child2_child0 = createNode(config); + root_child0_child0_child2_child0.setPositionType(YogaPositionType.RELATIVE); + root_child0_child0_child2_child0.setMargin(YogaEdge.LEFT, 9f); + root_child0_child0_child2_child0.setMargin(YogaEdge.TOP, 12f); + root_child0_child0_child2_child0.setMargin(YogaEdge.RIGHT, 4f); + root_child0_child0_child2_child0.setMargin(YogaEdge.BOTTOM, 7f); + root_child0_child0_child2_child0.setPadding(YogaEdge.LEFT, 5); + root_child0_child0_child2_child0.setPadding(YogaEdge.TOP, 3); + root_child0_child0_child2_child0.setPadding(YogaEdge.RIGHT, 8); + root_child0_child0_child2_child0.setPadding(YogaEdge.BOTTOM, 10); + root_child0_child0_child2_child0.setBorder(YogaEdge.LEFT, 2f); + root_child0_child0_child2_child0.setBorder(YogaEdge.TOP, 1f); + root_child0_child0_child2_child0.setBorder(YogaEdge.RIGHT, 5f); + root_child0_child0_child2_child0.setBorder(YogaEdge.BOTTOM, 9f); + root_child0_child0_child2_child0.setWidth(100f); + root_child0_child0_child2_child0.setHeight(50f); + root_child0_child0_child2.addChildAt(root_child0_child0_child2_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(215f, root.getLayoutWidth(), 0.0f); + assertEquals(301f, root.getLayoutHeight(), 0.0f); + + assertEquals(4f, root_child0.getLayoutX(), 0.0f); + assertEquals(5f, root_child0.getLayoutY(), 0.0f); + assertEquals(202f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(295f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(166f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(244f, root_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(18f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(40f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(92f, root_child0_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(16f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(16f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(18f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(29f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(20f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(92f, root_child0_child0_child1.getLayoutHeight(), 0.0f); + + assertEquals(16f, root_child0_child0_child1_child0.getLayoutX(), 0.0f); + assertEquals(16f, root_child0_child0_child1_child0.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child1_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child1_child0.getLayoutHeight(), 0.0f); + + assertEquals(18f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(140f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(20f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(92f, root_child0_child0_child2.getLayoutHeight(), 0.0f); + + assertEquals(16f, root_child0_child0_child2_child0.getLayoutX(), 0.0f); + assertEquals(16f, root_child0_child0_child2_child0.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child2_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child2_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(215f, root.getLayoutWidth(), 0.0f); + assertEquals(301f, root.getLayoutHeight(), 0.0f); + + assertEquals(4f, root_child0.getLayoutX(), 0.0f); + assertEquals(5f, root_child0.getLayoutY(), 0.0f); + assertEquals(202f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(295f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(166f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(244f, root_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(111f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(40f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(92f, root_child0_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(-77f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(16f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(131f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(29f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(20f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(92f, root_child0_child0_child1.getLayoutHeight(), 0.0f); + + assertEquals(-97f, root_child0_child0_child1_child0.getLayoutX(), 0.0f); + assertEquals(16f, root_child0_child0_child1_child0.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child1_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child1_child0.getLayoutHeight(), 0.0f); + + assertEquals(131f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(140f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(20f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(92f, root_child0_child0_child2.getLayoutHeight(), 0.0f); + + assertEquals(-97f, root_child0_child0_child2_child0.getLayoutX(), 0.0f); + assertEquals(16f, root_child0_child0_child2_child0.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child2_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child2_child0.getLayoutHeight(), 0.0f); + } + + @Test + public void test_static_position_justify_flex_start_position_set_amalgamation() { + YogaConfig config = YogaConfigFactory.create(); + config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); + + final YogaNode root = createNode(config); + root.setPositionType(YogaPositionType.ABSOLUTE); + + final YogaNode root_child0 = createNode(config); + root_child0.setPositionType(YogaPositionType.RELATIVE); + root_child0.setMargin(YogaEdge.LEFT, 4f); + root_child0.setMargin(YogaEdge.TOP, 5f); + root_child0.setMargin(YogaEdge.RIGHT, 9f); + root_child0.setMargin(YogaEdge.BOTTOM, 1f); + root_child0.setPadding(YogaEdge.LEFT, 2); + root_child0.setPadding(YogaEdge.TOP, 9); + root_child0.setPadding(YogaEdge.RIGHT, 11); + root_child0.setPadding(YogaEdge.BOTTOM, 13); + root_child0.setBorder(YogaEdge.LEFT, 5f); + root_child0.setBorder(YogaEdge.TOP, 6f); + root_child0.setBorder(YogaEdge.RIGHT, 7f); + root_child0.setBorder(YogaEdge.BOTTOM, 8f); + root.addChildAt(root_child0, 0); + + final YogaNode root_child0_child0 = createNode(config); + root_child0_child0.setMargin(YogaEdge.LEFT, 8f); + root_child0_child0.setMargin(YogaEdge.TOP, 6f); + root_child0_child0.setMargin(YogaEdge.RIGHT, 3f); + root_child0_child0.setMargin(YogaEdge.BOTTOM, 9f); + root_child0_child0.setPadding(YogaEdge.LEFT, 1); + root_child0_child0.setPadding(YogaEdge.TOP, 7); + root_child0_child0.setPadding(YogaEdge.RIGHT, 9); + root_child0_child0.setPadding(YogaEdge.BOTTOM, 4); + root_child0_child0.setBorder(YogaEdge.LEFT, 8f); + root_child0_child0.setBorder(YogaEdge.TOP, 10f); + root_child0_child0.setBorder(YogaEdge.RIGHT, 2f); + root_child0_child0.setBorder(YogaEdge.BOTTOM, 1f); + 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.RIGHT, 30f); + root_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); + root_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); + root_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); + root_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); + root_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); + root_child0_child0_child0.setPadding(YogaEdge.TOP, 3); + root_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); + root_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); + root_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); + root_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); + root_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); + root_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); + root_child0_child0_child0.setWidthPercent(21f); + 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.RELATIVE); + root_child0_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); + root_child0_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); + root_child0_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); + root_child0_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); + root_child0_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); + root_child0_child0_child0_child0.setPadding(YogaEdge.TOP, 3); + root_child0_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); + root_child0_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); + root_child0_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); + root_child0_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); + root_child0_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); + root_child0_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); + root_child0_child0_child0_child0.setWidth(100f); + root_child0_child0_child0_child0.setHeight(50f); + root_child0_child0_child0.addChildAt(root_child0_child0_child0_child0, 0); + + final YogaNode root_child0_child0_child1 = createNode(config); + root_child0_child0_child1.setPositionType(YogaPositionType.RELATIVE); + root_child0_child0_child1.setMargin(YogaEdge.LEFT, 9f); + root_child0_child0_child1.setMargin(YogaEdge.TOP, 12f); + root_child0_child0_child1.setMargin(YogaEdge.RIGHT, 4f); + root_child0_child0_child1.setMargin(YogaEdge.BOTTOM, 7f); + root_child0_child0_child1.setPadding(YogaEdge.LEFT, 5); + root_child0_child0_child1.setPadding(YogaEdge.TOP, 3); + root_child0_child0_child1.setPadding(YogaEdge.RIGHT, 8); + root_child0_child0_child1.setPadding(YogaEdge.BOTTOM, 10); + root_child0_child0_child1.setBorder(YogaEdge.LEFT, 2f); + root_child0_child0_child1.setBorder(YogaEdge.TOP, 1f); + root_child0_child0_child1.setBorder(YogaEdge.RIGHT, 5f); + root_child0_child0_child1.setBorder(YogaEdge.BOTTOM, 9f); + root_child0_child0_child1.setWidthPercent(10f); + root_child0_child0.addChildAt(root_child0_child0_child1, 1); + + final YogaNode root_child0_child0_child1_child0 = createNode(config); + root_child0_child0_child1_child0.setPositionType(YogaPositionType.RELATIVE); + root_child0_child0_child1_child0.setMargin(YogaEdge.LEFT, 9f); + root_child0_child0_child1_child0.setMargin(YogaEdge.TOP, 12f); + root_child0_child0_child1_child0.setMargin(YogaEdge.RIGHT, 4f); + root_child0_child0_child1_child0.setMargin(YogaEdge.BOTTOM, 7f); + root_child0_child0_child1_child0.setPadding(YogaEdge.LEFT, 5); + root_child0_child0_child1_child0.setPadding(YogaEdge.TOP, 3); + root_child0_child0_child1_child0.setPadding(YogaEdge.RIGHT, 8); + root_child0_child0_child1_child0.setPadding(YogaEdge.BOTTOM, 10); + root_child0_child0_child1_child0.setBorder(YogaEdge.LEFT, 2f); + root_child0_child0_child1_child0.setBorder(YogaEdge.TOP, 1f); + root_child0_child0_child1_child0.setBorder(YogaEdge.RIGHT, 5f); + root_child0_child0_child1_child0.setBorder(YogaEdge.BOTTOM, 9f); + root_child0_child0_child1_child0.setWidth(100f); + root_child0_child0_child1_child0.setHeight(50f); + root_child0_child0_child1.addChildAt(root_child0_child0_child1_child0, 0); + + final YogaNode root_child0_child0_child2 = createNode(config); + root_child0_child0_child2.setPositionType(YogaPositionType.RELATIVE); + root_child0_child0_child2.setMargin(YogaEdge.LEFT, 9f); + root_child0_child0_child2.setMargin(YogaEdge.TOP, 12f); + root_child0_child0_child2.setMargin(YogaEdge.RIGHT, 4f); + root_child0_child0_child2.setMargin(YogaEdge.BOTTOM, 7f); + root_child0_child0_child2.setPadding(YogaEdge.LEFT, 5); + root_child0_child0_child2.setPadding(YogaEdge.TOP, 3); + root_child0_child0_child2.setPadding(YogaEdge.RIGHT, 8); + root_child0_child0_child2.setPadding(YogaEdge.BOTTOM, 10); + root_child0_child0_child2.setBorder(YogaEdge.LEFT, 2f); + root_child0_child0_child2.setBorder(YogaEdge.TOP, 1f); + root_child0_child0_child2.setBorder(YogaEdge.RIGHT, 5f); + root_child0_child0_child2.setBorder(YogaEdge.BOTTOM, 9f); + root_child0_child0_child2.setWidthPercent(10f); + root_child0_child0.addChildAt(root_child0_child0_child2, 2); + + final YogaNode root_child0_child0_child2_child0 = createNode(config); + root_child0_child0_child2_child0.setPositionType(YogaPositionType.RELATIVE); + root_child0_child0_child2_child0.setMargin(YogaEdge.LEFT, 9f); + root_child0_child0_child2_child0.setMargin(YogaEdge.TOP, 12f); + root_child0_child0_child2_child0.setMargin(YogaEdge.RIGHT, 4f); + root_child0_child0_child2_child0.setMargin(YogaEdge.BOTTOM, 7f); + root_child0_child0_child2_child0.setPadding(YogaEdge.LEFT, 5); + root_child0_child0_child2_child0.setPadding(YogaEdge.TOP, 3); + root_child0_child0_child2_child0.setPadding(YogaEdge.RIGHT, 8); + root_child0_child0_child2_child0.setPadding(YogaEdge.BOTTOM, 10); + root_child0_child0_child2_child0.setBorder(YogaEdge.LEFT, 2f); + root_child0_child0_child2_child0.setBorder(YogaEdge.TOP, 1f); + root_child0_child0_child2_child0.setBorder(YogaEdge.RIGHT, 5f); + root_child0_child0_child2_child0.setBorder(YogaEdge.BOTTOM, 9f); + root_child0_child0_child2_child0.setWidth(100f); + root_child0_child0_child2_child0.setHeight(50f); + root_child0_child0_child2.addChildAt(root_child0_child0_child2_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(215f, root.getLayoutWidth(), 0.0f); + assertEquals(301f, root.getLayoutHeight(), 0.0f); + + assertEquals(4f, root_child0.getLayoutX(), 0.0f); + assertEquals(5f, root_child0.getLayoutY(), 0.0f); + assertEquals(202f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(295f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(166f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(244f, root_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(106f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(40f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(92f, root_child0_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(16f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(16f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(18f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(29f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(20f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(92f, root_child0_child0_child1.getLayoutHeight(), 0.0f); + + assertEquals(16f, root_child0_child0_child1_child0.getLayoutX(), 0.0f); + assertEquals(16f, root_child0_child0_child1_child0.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child1_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child1_child0.getLayoutHeight(), 0.0f); + + assertEquals(18f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(140f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(20f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(92f, root_child0_child0_child2.getLayoutHeight(), 0.0f); + + assertEquals(16f, root_child0_child0_child2_child0.getLayoutX(), 0.0f); + assertEquals(16f, root_child0_child0_child2_child0.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child2_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child2_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(215f, root.getLayoutWidth(), 0.0f); + assertEquals(301f, root.getLayoutHeight(), 0.0f); + + assertEquals(4f, root_child0.getLayoutX(), 0.0f); + assertEquals(5f, root_child0.getLayoutY(), 0.0f); + assertEquals(202f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(295f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(166f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(244f, root_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(106f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(40f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(92f, root_child0_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(-77f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(16f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(131f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(29f, root_child0_child0_child1.getLayoutY(), 0.0f); + assertEquals(20f, root_child0_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(92f, root_child0_child0_child1.getLayoutHeight(), 0.0f); + + assertEquals(-97f, root_child0_child0_child1_child0.getLayoutX(), 0.0f); + assertEquals(16f, root_child0_child0_child1_child0.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child1_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child1_child0.getLayoutHeight(), 0.0f); + + assertEquals(131f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(140f, root_child0_child0_child2.getLayoutY(), 0.0f); + assertEquals(20f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(92f, root_child0_child0_child2.getLayoutHeight(), 0.0f); + + assertEquals(-97f, root_child0_child0_child2_child0.getLayoutX(), 0.0f); + assertEquals(16f, root_child0_child0_child2_child0.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0_child2_child0.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child0_child0_child2_child0.getLayoutHeight(), 0.0f); + } + private YogaNode createNode(YogaConfig config) { return mNodeFactory.create(config); } diff --git a/javascript/tests/generated/YGStaticPositionTest.test.ts b/javascript/tests/generated/YGStaticPositionTest.test.ts index 5b92c0586d..3c3ddc0821 100644 --- a/javascript/tests/generated/YGStaticPositionTest.test.ts +++ b/javascript/tests/generated/YGStaticPositionTest.test.ts @@ -2959,3 +2959,1340 @@ test('static_position_containing_block_padding_and_border', () => { config.free(); } }); +test('static_position_amalgamation', () => { + const config = Yoga.Config.create(); + let root; + + config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); + + try { + root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); + + const root_child0 = Yoga.Node.create(config); + root_child0.setPositionType(PositionType.Relative); + root_child0.setMargin(Edge.Left, 4); + root_child0.setMargin(Edge.Top, 5); + root_child0.setMargin(Edge.Right, 9); + root_child0.setMargin(Edge.Bottom, 1); + root_child0.setPadding(Edge.Left, 2); + root_child0.setPadding(Edge.Top, 9); + root_child0.setPadding(Edge.Right, 11); + root_child0.setPadding(Edge.Bottom, 13); + root_child0.setBorder(Edge.Left, 5); + root_child0.setBorder(Edge.Top, 6); + root_child0.setBorder(Edge.Right, 7); + root_child0.setBorder(Edge.Bottom, 8); + root_child0.setWidth(500); + root_child0.setHeight(500); + root.insertChild(root_child0, 0); + + const root_child0_child0 = Yoga.Node.create(config); + root_child0_child0.setMargin(Edge.Left, 8); + root_child0_child0.setMargin(Edge.Top, 6); + root_child0_child0.setMargin(Edge.Right, 3); + root_child0_child0.setMargin(Edge.Bottom, 9); + root_child0_child0.setPadding(Edge.Left, 1); + root_child0_child0.setPadding(Edge.Top, 7); + root_child0_child0.setPadding(Edge.Right, 9); + root_child0_child0.setPadding(Edge.Bottom, 4); + root_child0_child0.setBorder(Edge.Left, 8); + root_child0_child0.setBorder(Edge.Top, 10); + root_child0_child0.setBorder(Edge.Right, 2); + root_child0_child0.setBorder(Edge.Bottom, 1); + root_child0_child0.setWidth(200); + root_child0_child0.setHeight(200); + 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, 2); + root_child0_child0_child0.setPosition(Edge.Right, 12); + root_child0_child0_child0.setMargin(Edge.Left, 9); + root_child0_child0_child0.setMargin(Edge.Top, 12); + root_child0_child0_child0.setMargin(Edge.Right, 4); + root_child0_child0_child0.setMargin(Edge.Bottom, 7); + root_child0_child0_child0.setPadding(Edge.Left, 5); + root_child0_child0_child0.setPadding(Edge.Top, 3); + root_child0_child0_child0.setPadding(Edge.Right, 8); + root_child0_child0_child0.setPadding(Edge.Bottom, 10); + root_child0_child0_child0.setBorder(Edge.Left, 2); + root_child0_child0_child0.setBorder(Edge.Top, 1); + root_child0_child0_child0.setBorder(Edge.Right, 5); + root_child0_child0_child0.setBorder(Edge.Bottom, 9); + root_child0_child0_child0.setWidth("41%"); + root_child0_child0_child0.setHeight("63%"); + 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(513); + expect(root.getComputedHeight()).toBe(506); + + expect(root_child0.getComputedLeft()).toBe(4); + expect(root_child0.getComputedTop()).toBe(5); + expect(root_child0.getComputedWidth()).toBe(500); + expect(root_child0.getComputedHeight()).toBe(500); + + expect(root_child0_child0.getComputedLeft()).toBe(15); + expect(root_child0_child0.getComputedTop()).toBe(21); + expect(root_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0.getComputedHeight()).toBe(200); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(1); + expect(root_child0_child0_child0.getComputedTop()).toBe(29); + expect(root_child0_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0_child0.getComputedHeight()).toBe(306); + + root.calculateLayout(undefined, undefined, Direction.RTL); + + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(513); + expect(root.getComputedHeight()).toBe(506); + + expect(root_child0.getComputedLeft()).toBe(4); + expect(root_child0.getComputedTop()).toBe(5); + expect(root_child0.getComputedWidth()).toBe(500); + expect(root_child0.getComputedHeight()).toBe(500); + + expect(root_child0_child0.getComputedLeft()).toBe(279); + expect(root_child0_child0.getComputedTop()).toBe(21); + expect(root_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0.getComputedHeight()).toBe(200); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(-2); + expect(root_child0_child0_child0.getComputedTop()).toBe(29); + expect(root_child0_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0_child0.getComputedHeight()).toBe(306); + } finally { + if (typeof root !== 'undefined') { + root.freeRecursive(); + } + + config.free(); + } +}); +test('static_position_no_position_amalgamation', () => { + const config = Yoga.Config.create(); + let root; + + config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); + + try { + root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); + + const root_child0 = Yoga.Node.create(config); + root_child0.setPositionType(PositionType.Relative); + root_child0.setMargin(Edge.Left, 4); + root_child0.setMargin(Edge.Top, 5); + root_child0.setMargin(Edge.Right, 9); + root_child0.setMargin(Edge.Bottom, 1); + root_child0.setPadding(Edge.Left, 2); + root_child0.setPadding(Edge.Top, 9); + root_child0.setPadding(Edge.Right, 11); + root_child0.setPadding(Edge.Bottom, 13); + root_child0.setBorder(Edge.Left, 5); + root_child0.setBorder(Edge.Top, 6); + root_child0.setBorder(Edge.Right, 7); + root_child0.setBorder(Edge.Bottom, 8); + root_child0.setWidth(500); + root_child0.setHeight(500); + root.insertChild(root_child0, 0); + + const root_child0_child0 = Yoga.Node.create(config); + root_child0_child0.setMargin(Edge.Left, 8); + root_child0_child0.setMargin(Edge.Top, 6); + root_child0_child0.setMargin(Edge.Right, 3); + root_child0_child0.setMargin(Edge.Bottom, 9); + root_child0_child0.setPadding(Edge.Left, 1); + root_child0_child0.setPadding(Edge.Top, 7); + root_child0_child0.setPadding(Edge.Right, 9); + root_child0_child0.setPadding(Edge.Bottom, 4); + root_child0_child0.setBorder(Edge.Left, 8); + root_child0_child0.setBorder(Edge.Top, 10); + root_child0_child0.setBorder(Edge.Right, 2); + root_child0_child0.setBorder(Edge.Bottom, 1); + root_child0_child0.setWidth(200); + root_child0_child0.setHeight(200); + 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, 9); + root_child0_child0_child0.setMargin(Edge.Top, 12); + root_child0_child0_child0.setMargin(Edge.Right, 4); + root_child0_child0_child0.setMargin(Edge.Bottom, 7); + root_child0_child0_child0.setPadding(Edge.Left, 5); + root_child0_child0_child0.setPadding(Edge.Top, 3); + root_child0_child0_child0.setPadding(Edge.Right, 8); + root_child0_child0_child0.setPadding(Edge.Bottom, 10); + root_child0_child0_child0.setBorder(Edge.Left, 2); + root_child0_child0_child0.setBorder(Edge.Top, 1); + root_child0_child0_child0.setBorder(Edge.Right, 5); + root_child0_child0_child0.setBorder(Edge.Bottom, 9); + root_child0_child0_child0.setWidth("41%"); + root_child0_child0_child0.setHeight("63%"); + 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(513); + expect(root.getComputedHeight()).toBe(506); + + expect(root_child0.getComputedLeft()).toBe(4); + expect(root_child0.getComputedTop()).toBe(5); + expect(root_child0.getComputedWidth()).toBe(500); + expect(root_child0.getComputedHeight()).toBe(500); + + expect(root_child0_child0.getComputedLeft()).toBe(15); + expect(root_child0_child0.getComputedTop()).toBe(21); + expect(root_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0.getComputedHeight()).toBe(200); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(18); + expect(root_child0_child0_child0.getComputedTop()).toBe(29); + expect(root_child0_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0_child0.getComputedHeight()).toBe(306); + + root.calculateLayout(undefined, undefined, Direction.RTL); + + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(513); + expect(root.getComputedHeight()).toBe(506); + + expect(root_child0.getComputedLeft()).toBe(4); + expect(root_child0.getComputedTop()).toBe(5); + expect(root_child0.getComputedWidth()).toBe(500); + expect(root_child0.getComputedHeight()).toBe(500); + + expect(root_child0_child0.getComputedLeft()).toBe(279); + expect(root_child0_child0.getComputedTop()).toBe(21); + expect(root_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0.getComputedHeight()).toBe(200); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(-15); + expect(root_child0_child0_child0.getComputedTop()).toBe(29); + expect(root_child0_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0_child0.getComputedHeight()).toBe(306); + } finally { + if (typeof root !== 'undefined') { + root.freeRecursive(); + } + + config.free(); + } +}); +test('static_position_zero_for_inset_amalgamation', () => { + const config = Yoga.Config.create(); + let root; + + config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); + + try { + root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); + + const root_child0 = Yoga.Node.create(config); + root_child0.setPositionType(PositionType.Relative); + root_child0.setMargin(Edge.Left, 4); + root_child0.setMargin(Edge.Top, 5); + root_child0.setMargin(Edge.Right, 9); + root_child0.setMargin(Edge.Bottom, 1); + root_child0.setPadding(Edge.Left, 2); + root_child0.setPadding(Edge.Top, 9); + root_child0.setPadding(Edge.Right, 11); + root_child0.setPadding(Edge.Bottom, 13); + root_child0.setBorder(Edge.Left, 5); + root_child0.setBorder(Edge.Top, 6); + root_child0.setBorder(Edge.Right, 7); + root_child0.setBorder(Edge.Bottom, 8); + root_child0.setWidth(500); + root_child0.setHeight(500); + root.insertChild(root_child0, 0); + + const root_child0_child0 = Yoga.Node.create(config); + root_child0_child0.setMargin(Edge.Left, 8); + root_child0_child0.setMargin(Edge.Top, 6); + root_child0_child0.setMargin(Edge.Right, 3); + root_child0_child0.setMargin(Edge.Bottom, 9); + root_child0_child0.setPadding(Edge.Left, 1); + root_child0_child0.setPadding(Edge.Top, 7); + root_child0_child0.setPadding(Edge.Right, 9); + root_child0_child0.setPadding(Edge.Bottom, 4); + root_child0_child0.setBorder(Edge.Left, 8); + root_child0_child0.setBorder(Edge.Top, 10); + root_child0_child0.setBorder(Edge.Right, 2); + root_child0_child0.setBorder(Edge.Bottom, 1); + root_child0_child0.setWidth(200); + root_child0_child0.setHeight(200); + 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, "0%"); + root_child0_child0_child0.setMargin(Edge.Left, 9); + root_child0_child0_child0.setMargin(Edge.Top, 12); + root_child0_child0_child0.setMargin(Edge.Right, 4); + root_child0_child0_child0.setMargin(Edge.Bottom, 7); + root_child0_child0_child0.setPadding(Edge.Left, 5); + root_child0_child0_child0.setPadding(Edge.Top, 3); + root_child0_child0_child0.setPadding(Edge.Right, 8); + root_child0_child0_child0.setPadding(Edge.Bottom, 10); + root_child0_child0_child0.setBorder(Edge.Left, 2); + root_child0_child0_child0.setBorder(Edge.Top, 1); + root_child0_child0_child0.setBorder(Edge.Right, 5); + root_child0_child0_child0.setBorder(Edge.Bottom, 9); + root_child0_child0_child0.setWidth("41%"); + root_child0_child0_child0.setHeight("63%"); + 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(513); + expect(root.getComputedHeight()).toBe(506); + + expect(root_child0.getComputedLeft()).toBe(4); + expect(root_child0.getComputedTop()).toBe(5); + expect(root_child0.getComputedWidth()).toBe(500); + expect(root_child0.getComputedHeight()).toBe(500); + + expect(root_child0_child0.getComputedLeft()).toBe(15); + expect(root_child0_child0.getComputedTop()).toBe(21); + expect(root_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0.getComputedHeight()).toBe(200); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(-1); + expect(root_child0_child0_child0.getComputedTop()).toBe(29); + expect(root_child0_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0_child0.getComputedHeight()).toBe(306); + + root.calculateLayout(undefined, undefined, Direction.RTL); + + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(513); + expect(root.getComputedHeight()).toBe(506); + + expect(root_child0.getComputedLeft()).toBe(4); + expect(root_child0.getComputedTop()).toBe(5); + expect(root_child0.getComputedWidth()).toBe(500); + expect(root_child0.getComputedHeight()).toBe(500); + + expect(root_child0_child0.getComputedLeft()).toBe(279); + expect(root_child0_child0.getComputedTop()).toBe(21); + expect(root_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0.getComputedHeight()).toBe(200); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(-265); + expect(root_child0_child0_child0.getComputedTop()).toBe(29); + expect(root_child0_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0_child0.getComputedHeight()).toBe(306); + } finally { + if (typeof root !== 'undefined') { + root.freeRecursive(); + } + + config.free(); + } +}); +test('static_position_start_inset_amalgamation', () => { + const config = Yoga.Config.create(); + let root; + + config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); + + try { + root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); + + const root_child0 = Yoga.Node.create(config); + root_child0.setPositionType(PositionType.Relative); + root_child0.setMargin(Edge.Left, 4); + root_child0.setMargin(Edge.Top, 5); + root_child0.setMargin(Edge.Right, 9); + root_child0.setMargin(Edge.Bottom, 1); + root_child0.setPadding(Edge.Left, 2); + root_child0.setPadding(Edge.Top, 9); + root_child0.setPadding(Edge.Right, 11); + root_child0.setPadding(Edge.Bottom, 13); + root_child0.setBorder(Edge.Left, 5); + root_child0.setBorder(Edge.Top, 6); + root_child0.setBorder(Edge.Right, 7); + root_child0.setBorder(Edge.Bottom, 8); + root_child0.setWidth(500); + root_child0.setHeight(500); + root.insertChild(root_child0, 0); + + const root_child0_child0 = Yoga.Node.create(config); + root_child0_child0.setMargin(Edge.Left, 8); + root_child0_child0.setMargin(Edge.Top, 6); + root_child0_child0.setMargin(Edge.Right, 3); + root_child0_child0.setMargin(Edge.Bottom, 9); + root_child0_child0.setPadding(Edge.Left, 1); + root_child0_child0.setPadding(Edge.Top, 7); + root_child0_child0.setPadding(Edge.Right, 9); + root_child0_child0.setPadding(Edge.Bottom, 4); + root_child0_child0.setBorder(Edge.Left, 8); + root_child0_child0.setBorder(Edge.Top, 10); + root_child0_child0.setBorder(Edge.Right, 2); + root_child0_child0.setBorder(Edge.Bottom, 1); + root_child0_child0.setWidth(200); + root_child0_child0.setHeight(200); + 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.Start, 12); + root_child0_child0_child0.setMargin(Edge.Left, 9); + root_child0_child0_child0.setMargin(Edge.Top, 12); + root_child0_child0_child0.setMargin(Edge.Right, 4); + root_child0_child0_child0.setMargin(Edge.Bottom, 7); + root_child0_child0_child0.setPadding(Edge.Left, 5); + root_child0_child0_child0.setPadding(Edge.Top, 3); + root_child0_child0_child0.setPadding(Edge.Right, 8); + root_child0_child0_child0.setPadding(Edge.Bottom, 10); + root_child0_child0_child0.setBorder(Edge.Left, 2); + root_child0_child0_child0.setBorder(Edge.Top, 1); + root_child0_child0_child0.setBorder(Edge.Right, 5); + root_child0_child0_child0.setBorder(Edge.Bottom, 9); + root_child0_child0_child0.setWidth("41%"); + root_child0_child0_child0.setHeight("63%"); + 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(513); + expect(root.getComputedHeight()).toBe(506); + + expect(root_child0.getComputedLeft()).toBe(4); + expect(root_child0.getComputedTop()).toBe(5); + expect(root_child0.getComputedWidth()).toBe(500); + expect(root_child0.getComputedHeight()).toBe(500); + + expect(root_child0_child0.getComputedLeft()).toBe(15); + expect(root_child0_child0.getComputedTop()).toBe(21); + expect(root_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0.getComputedHeight()).toBe(200); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(11); + expect(root_child0_child0_child0.getComputedTop()).toBe(29); + expect(root_child0_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0_child0.getComputedHeight()).toBe(306); + + root.calculateLayout(undefined, undefined, Direction.RTL); + + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(513); + expect(root.getComputedHeight()).toBe(506); + + expect(root_child0.getComputedLeft()).toBe(4); + expect(root_child0.getComputedTop()).toBe(5); + expect(root_child0.getComputedWidth()).toBe(500); + expect(root_child0.getComputedHeight()).toBe(500); + + expect(root_child0_child0.getComputedLeft()).toBe(279); + expect(root_child0_child0.getComputedTop()).toBe(21); + expect(root_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0.getComputedHeight()).toBe(200); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(-2); + expect(root_child0_child0_child0.getComputedTop()).toBe(29); + expect(root_child0_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0_child0.getComputedHeight()).toBe(306); + } finally { + if (typeof root !== 'undefined') { + root.freeRecursive(); + } + + config.free(); + } +}); +test('static_position_end_inset_amalgamation', () => { + const config = Yoga.Config.create(); + let root; + + config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); + + try { + root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); + + const root_child0 = Yoga.Node.create(config); + root_child0.setPositionType(PositionType.Relative); + root_child0.setMargin(Edge.Left, 4); + root_child0.setMargin(Edge.Top, 5); + root_child0.setMargin(Edge.Right, 9); + root_child0.setMargin(Edge.Bottom, 1); + root_child0.setPadding(Edge.Left, 2); + root_child0.setPadding(Edge.Top, 9); + root_child0.setPadding(Edge.Right, 11); + root_child0.setPadding(Edge.Bottom, 13); + root_child0.setBorder(Edge.Left, 5); + root_child0.setBorder(Edge.Top, 6); + root_child0.setBorder(Edge.Right, 7); + root_child0.setBorder(Edge.Bottom, 8); + root_child0.setWidth(500); + root_child0.setHeight(500); + root.insertChild(root_child0, 0); + + const root_child0_child0 = Yoga.Node.create(config); + root_child0_child0.setMargin(Edge.Left, 8); + root_child0_child0.setMargin(Edge.Top, 6); + root_child0_child0.setMargin(Edge.Right, 3); + root_child0_child0.setMargin(Edge.Bottom, 9); + root_child0_child0.setPadding(Edge.Left, 1); + root_child0_child0.setPadding(Edge.Top, 7); + root_child0_child0.setPadding(Edge.Right, 9); + root_child0_child0.setPadding(Edge.Bottom, 4); + root_child0_child0.setBorder(Edge.Left, 8); + root_child0_child0.setBorder(Edge.Top, 10); + root_child0_child0.setBorder(Edge.Right, 2); + root_child0_child0.setBorder(Edge.Bottom, 1); + root_child0_child0.setWidth(200); + root_child0_child0.setHeight(200); + 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.End, 4); + root_child0_child0_child0.setMargin(Edge.Left, 9); + root_child0_child0_child0.setMargin(Edge.Top, 12); + root_child0_child0_child0.setMargin(Edge.Right, 4); + root_child0_child0_child0.setMargin(Edge.Bottom, 7); + root_child0_child0_child0.setPadding(Edge.Left, 5); + root_child0_child0_child0.setPadding(Edge.Top, 3); + root_child0_child0_child0.setPadding(Edge.Right, 8); + root_child0_child0_child0.setPadding(Edge.Bottom, 10); + root_child0_child0_child0.setBorder(Edge.Left, 2); + root_child0_child0_child0.setBorder(Edge.Top, 1); + root_child0_child0_child0.setBorder(Edge.Right, 5); + root_child0_child0_child0.setBorder(Edge.Bottom, 9); + root_child0_child0_child0.setWidth("41%"); + root_child0_child0_child0.setHeight("63%"); + 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(513); + expect(root.getComputedHeight()).toBe(506); + + expect(root_child0.getComputedLeft()).toBe(4); + expect(root_child0.getComputedTop()).toBe(5); + expect(root_child0.getComputedWidth()).toBe(500); + expect(root_child0.getComputedHeight()).toBe(500); + + expect(root_child0_child0.getComputedLeft()).toBe(15); + expect(root_child0_child0.getComputedTop()).toBe(21); + expect(root_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0.getComputedHeight()).toBe(200); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(270); + expect(root_child0_child0_child0.getComputedTop()).toBe(29); + expect(root_child0_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0_child0.getComputedHeight()).toBe(306); + + root.calculateLayout(undefined, undefined, Direction.RTL); + + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(513); + expect(root.getComputedHeight()).toBe(506); + + expect(root_child0.getComputedLeft()).toBe(4); + expect(root_child0.getComputedTop()).toBe(5); + expect(root_child0.getComputedWidth()).toBe(500); + expect(root_child0.getComputedHeight()).toBe(500); + + expect(root_child0_child0.getComputedLeft()).toBe(279); + expect(root_child0_child0.getComputedTop()).toBe(21); + expect(root_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0.getComputedHeight()).toBe(200); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(-261); + expect(root_child0_child0_child0.getComputedTop()).toBe(29); + expect(root_child0_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0_child0.getComputedHeight()).toBe(306); + } finally { + if (typeof root !== 'undefined') { + root.freeRecursive(); + } + + config.free(); + } +}); +test('static_position_row_reverse_amalgamation', () => { + const config = Yoga.Config.create(); + let root; + + config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); + + try { + root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); + + const root_child0 = Yoga.Node.create(config); + root_child0.setPositionType(PositionType.Relative); + root_child0.setMargin(Edge.Left, 4); + root_child0.setMargin(Edge.Top, 5); + root_child0.setMargin(Edge.Right, 9); + root_child0.setMargin(Edge.Bottom, 1); + root_child0.setPadding(Edge.Left, 2); + root_child0.setPadding(Edge.Top, 9); + root_child0.setPadding(Edge.Right, 11); + root_child0.setPadding(Edge.Bottom, 13); + root_child0.setBorder(Edge.Left, 5); + root_child0.setBorder(Edge.Top, 6); + root_child0.setBorder(Edge.Right, 7); + root_child0.setBorder(Edge.Bottom, 8); + root.insertChild(root_child0, 0); + + const root_child0_child0 = Yoga.Node.create(config); + root_child0_child0.setFlexDirection(FlexDirection.RowReverse); + root_child0_child0.setMargin(Edge.Left, 8); + root_child0_child0.setMargin(Edge.Top, 6); + root_child0_child0.setMargin(Edge.Right, 3); + root_child0_child0.setMargin(Edge.Bottom, 9); + root_child0_child0.setPadding(Edge.Left, 1); + root_child0_child0.setPadding(Edge.Top, 7); + root_child0_child0.setPadding(Edge.Right, 9); + root_child0_child0.setPadding(Edge.Bottom, 4); + root_child0_child0.setBorder(Edge.Left, 8); + root_child0_child0.setBorder(Edge.Top, 10); + root_child0_child0.setBorder(Edge.Right, 2); + root_child0_child0.setBorder(Edge.Bottom, 1); + 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, 9); + root_child0_child0_child0.setMargin(Edge.Top, 12); + root_child0_child0_child0.setMargin(Edge.Right, 4); + root_child0_child0_child0.setMargin(Edge.Bottom, 7); + root_child0_child0_child0.setPadding(Edge.Left, 5); + root_child0_child0_child0.setPadding(Edge.Top, 3); + root_child0_child0_child0.setPadding(Edge.Right, 8); + root_child0_child0_child0.setPadding(Edge.Bottom, 10); + root_child0_child0_child0.setBorder(Edge.Left, 2); + root_child0_child0_child0.setBorder(Edge.Top, 1); + root_child0_child0_child0.setBorder(Edge.Right, 5); + root_child0_child0_child0.setBorder(Edge.Bottom, 9); + root_child0_child0_child0.setHeight("12%"); + 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.Relative); + root_child0_child0_child0_child0.setMargin(Edge.Left, 9); + root_child0_child0_child0_child0.setMargin(Edge.Top, 12); + root_child0_child0_child0_child0.setMargin(Edge.Right, 4); + root_child0_child0_child0_child0.setMargin(Edge.Bottom, 7); + root_child0_child0_child0_child0.setPadding(Edge.Left, 5); + root_child0_child0_child0_child0.setPadding(Edge.Top, 3); + root_child0_child0_child0_child0.setPadding(Edge.Right, 8); + root_child0_child0_child0_child0.setPadding(Edge.Bottom, 10); + root_child0_child0_child0_child0.setBorder(Edge.Left, 2); + root_child0_child0_child0_child0.setBorder(Edge.Top, 1); + root_child0_child0_child0_child0.setBorder(Edge.Right, 5); + root_child0_child0_child0_child0.setBorder(Edge.Bottom, 9); + root_child0_child0_child0_child0.setWidth(100); + root_child0_child0_child0_child0.setHeight(50); + root_child0_child0_child0.insertChild(root_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(69); + expect(root.getComputedHeight()).toBe(79); + + expect(root_child0.getComputedLeft()).toBe(4); + expect(root_child0.getComputedTop()).toBe(5); + expect(root_child0.getComputedWidth()).toBe(56); + expect(root_child0.getComputedHeight()).toBe(73); + + expect(root_child0_child0.getComputedLeft()).toBe(15); + expect(root_child0_child0.getComputedTop()).toBe(21); + expect(root_child0_child0.getComputedWidth()).toBe(20); + expect(root_child0_child0.getComputedHeight()).toBe(22); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(-128); + expect(root_child0_child0_child0.getComputedTop()).toBe(29); + expect(root_child0_child0_child0.getComputedWidth()).toBe(133); + expect(root_child0_child0_child0.getComputedHeight()).toBe(23); + + expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(16); + expect(root_child0_child0_child0_child0.getComputedTop()).toBe(16); + expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); + expect(root_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(69); + expect(root.getComputedHeight()).toBe(79); + + expect(root_child0.getComputedLeft()).toBe(4); + expect(root_child0.getComputedTop()).toBe(5); + expect(root_child0.getComputedWidth()).toBe(56); + expect(root_child0.getComputedHeight()).toBe(73); + + expect(root_child0_child0.getComputedLeft()).toBe(15); + expect(root_child0_child0.getComputedTop()).toBe(21); + expect(root_child0_child0.getComputedWidth()).toBe(20); + expect(root_child0_child0.getComputedHeight()).toBe(22); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(18); + expect(root_child0_child0_child0.getComputedTop()).toBe(29); + expect(root_child0_child0_child0.getComputedWidth()).toBe(133); + expect(root_child0_child0_child0.getComputedHeight()).toBe(23); + + expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(16); + expect(root_child0_child0_child0_child0.getComputedTop()).toBe(16); + expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(50); + } finally { + if (typeof root !== 'undefined') { + root.freeRecursive(); + } + + config.free(); + } +}); +test('static_position_column_reverse_amalgamation', () => { + const config = Yoga.Config.create(); + let root; + + config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); + + try { + root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); + + const root_child0 = Yoga.Node.create(config); + root_child0.setPositionType(PositionType.Relative); + root_child0.setMargin(Edge.Left, 4); + root_child0.setMargin(Edge.Top, 5); + root_child0.setMargin(Edge.Right, 9); + root_child0.setMargin(Edge.Bottom, 1); + root_child0.setPadding(Edge.Left, 2); + root_child0.setPadding(Edge.Top, 9); + root_child0.setPadding(Edge.Right, 11); + root_child0.setPadding(Edge.Bottom, 13); + root_child0.setBorder(Edge.Left, 5); + root_child0.setBorder(Edge.Top, 6); + root_child0.setBorder(Edge.Right, 7); + root_child0.setBorder(Edge.Bottom, 8); + root.insertChild(root_child0, 0); + + const root_child0_child0 = Yoga.Node.create(config); + root_child0_child0.setFlexDirection(FlexDirection.ColumnReverse); + root_child0_child0.setMargin(Edge.Left, 8); + root_child0_child0.setMargin(Edge.Top, 6); + root_child0_child0.setMargin(Edge.Right, 3); + root_child0_child0.setMargin(Edge.Bottom, 9); + root_child0_child0.setPadding(Edge.Left, 1); + root_child0_child0.setPadding(Edge.Top, 7); + root_child0_child0.setPadding(Edge.Right, 9); + root_child0_child0.setPadding(Edge.Bottom, 4); + root_child0_child0.setBorder(Edge.Left, 8); + root_child0_child0.setBorder(Edge.Top, 10); + root_child0_child0.setBorder(Edge.Right, 2); + root_child0_child0.setBorder(Edge.Bottom, 1); + 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, 9); + root_child0_child0_child0.setMargin(Edge.Top, 12); + root_child0_child0_child0.setMargin(Edge.Right, 4); + root_child0_child0_child0.setMargin(Edge.Bottom, 7); + root_child0_child0_child0.setPadding(Edge.Left, 5); + root_child0_child0_child0.setPadding(Edge.Top, 3); + root_child0_child0_child0.setPadding(Edge.Right, 8); + root_child0_child0_child0.setPadding(Edge.Bottom, 10); + root_child0_child0_child0.setBorder(Edge.Left, 2); + root_child0_child0_child0.setBorder(Edge.Top, 1); + root_child0_child0_child0.setBorder(Edge.Right, 5); + root_child0_child0_child0.setBorder(Edge.Bottom, 9); + root_child0_child0_child0.setWidth("21%"); + 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.Relative); + root_child0_child0_child0_child0.setMargin(Edge.Left, 9); + root_child0_child0_child0_child0.setMargin(Edge.Top, 12); + root_child0_child0_child0_child0.setMargin(Edge.Right, 4); + root_child0_child0_child0_child0.setMargin(Edge.Bottom, 7); + root_child0_child0_child0_child0.setPadding(Edge.Left, 5); + root_child0_child0_child0_child0.setPadding(Edge.Top, 3); + root_child0_child0_child0_child0.setPadding(Edge.Right, 8); + root_child0_child0_child0_child0.setPadding(Edge.Bottom, 10); + root_child0_child0_child0_child0.setBorder(Edge.Left, 2); + root_child0_child0_child0_child0.setBorder(Edge.Top, 1); + root_child0_child0_child0_child0.setBorder(Edge.Right, 5); + root_child0_child0_child0_child0.setBorder(Edge.Bottom, 9); + root_child0_child0_child0_child0.setWidth(100); + root_child0_child0_child0_child0.setHeight(50); + root_child0_child0_child0.insertChild(root_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(69); + expect(root.getComputedHeight()).toBe(79); + + expect(root_child0.getComputedLeft()).toBe(4); + expect(root_child0.getComputedTop()).toBe(5); + expect(root_child0.getComputedWidth()).toBe(56); + expect(root_child0.getComputedHeight()).toBe(73); + + expect(root_child0_child0.getComputedLeft()).toBe(15); + expect(root_child0_child0.getComputedTop()).toBe(21); + expect(root_child0_child0.getComputedWidth()).toBe(20); + expect(root_child0_child0.getComputedHeight()).toBe(22); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(18); + expect(root_child0_child0_child0.getComputedTop()).toBe(-82); + expect(root_child0_child0_child0.getComputedWidth()).toBe(20); + expect(root_child0_child0_child0.getComputedHeight()).toBe(92); + + expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(16); + expect(root_child0_child0_child0_child0.getComputedTop()).toBe(16); + expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); + expect(root_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(69); + expect(root.getComputedHeight()).toBe(79); + + expect(root_child0.getComputedLeft()).toBe(4); + expect(root_child0.getComputedTop()).toBe(5); + expect(root_child0.getComputedWidth()).toBe(56); + expect(root_child0.getComputedHeight()).toBe(73); + + expect(root_child0_child0.getComputedLeft()).toBe(15); + expect(root_child0_child0.getComputedTop()).toBe(21); + expect(root_child0_child0.getComputedWidth()).toBe(20); + expect(root_child0_child0.getComputedHeight()).toBe(22); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(-15); + expect(root_child0_child0_child0.getComputedTop()).toBe(-82); + expect(root_child0_child0_child0.getComputedWidth()).toBe(20); + expect(root_child0_child0_child0.getComputedHeight()).toBe(92); + + expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(-97); + expect(root_child0_child0_child0_child0.getComputedTop()).toBe(16); + expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(50); + } finally { + if (typeof root !== 'undefined') { + root.freeRecursive(); + } + + config.free(); + } +}); +test('static_position_justify_flex_start_amalgamation', () => { + const config = Yoga.Config.create(); + let root; + + config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); + + try { + root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); + + const root_child0 = Yoga.Node.create(config); + root_child0.setPositionType(PositionType.Relative); + root_child0.setMargin(Edge.Left, 4); + root_child0.setMargin(Edge.Top, 5); + root_child0.setMargin(Edge.Right, 9); + root_child0.setMargin(Edge.Bottom, 1); + root_child0.setPadding(Edge.Left, 2); + root_child0.setPadding(Edge.Top, 9); + root_child0.setPadding(Edge.Right, 11); + root_child0.setPadding(Edge.Bottom, 13); + root_child0.setBorder(Edge.Left, 5); + root_child0.setBorder(Edge.Top, 6); + root_child0.setBorder(Edge.Right, 7); + root_child0.setBorder(Edge.Bottom, 8); + root.insertChild(root_child0, 0); + + const root_child0_child0 = Yoga.Node.create(config); + root_child0_child0.setMargin(Edge.Left, 8); + root_child0_child0.setMargin(Edge.Top, 6); + root_child0_child0.setMargin(Edge.Right, 3); + root_child0_child0.setMargin(Edge.Bottom, 9); + root_child0_child0.setPadding(Edge.Left, 1); + root_child0_child0.setPadding(Edge.Top, 7); + root_child0_child0.setPadding(Edge.Right, 9); + root_child0_child0.setPadding(Edge.Bottom, 4); + root_child0_child0.setBorder(Edge.Left, 8); + root_child0_child0.setBorder(Edge.Top, 10); + root_child0_child0.setBorder(Edge.Right, 2); + root_child0_child0.setBorder(Edge.Bottom, 1); + 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, 9); + root_child0_child0_child0.setMargin(Edge.Top, 12); + root_child0_child0_child0.setMargin(Edge.Right, 4); + root_child0_child0_child0.setMargin(Edge.Bottom, 7); + root_child0_child0_child0.setPadding(Edge.Left, 5); + root_child0_child0_child0.setPadding(Edge.Top, 3); + root_child0_child0_child0.setPadding(Edge.Right, 8); + root_child0_child0_child0.setPadding(Edge.Bottom, 10); + root_child0_child0_child0.setBorder(Edge.Left, 2); + root_child0_child0_child0.setBorder(Edge.Top, 1); + root_child0_child0_child0.setBorder(Edge.Right, 5); + root_child0_child0_child0.setBorder(Edge.Bottom, 9); + root_child0_child0_child0.setWidth("21%"); + 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.Relative); + root_child0_child0_child0_child0.setMargin(Edge.Left, 9); + root_child0_child0_child0_child0.setMargin(Edge.Top, 12); + root_child0_child0_child0_child0.setMargin(Edge.Right, 4); + root_child0_child0_child0_child0.setMargin(Edge.Bottom, 7); + root_child0_child0_child0_child0.setPadding(Edge.Left, 5); + root_child0_child0_child0_child0.setPadding(Edge.Top, 3); + root_child0_child0_child0_child0.setPadding(Edge.Right, 8); + root_child0_child0_child0_child0.setPadding(Edge.Bottom, 10); + root_child0_child0_child0_child0.setBorder(Edge.Left, 2); + root_child0_child0_child0_child0.setBorder(Edge.Top, 1); + root_child0_child0_child0_child0.setBorder(Edge.Right, 5); + root_child0_child0_child0_child0.setBorder(Edge.Bottom, 9); + root_child0_child0_child0_child0.setWidth(100); + root_child0_child0_child0_child0.setHeight(50); + root_child0_child0_child0.insertChild(root_child0_child0_child0_child0, 0); + + const root_child0_child0_child1 = Yoga.Node.create(config); + root_child0_child0_child1.setPositionType(PositionType.Relative); + root_child0_child0_child1.setMargin(Edge.Left, 9); + root_child0_child0_child1.setMargin(Edge.Top, 12); + root_child0_child0_child1.setMargin(Edge.Right, 4); + root_child0_child0_child1.setMargin(Edge.Bottom, 7); + root_child0_child0_child1.setPadding(Edge.Left, 5); + root_child0_child0_child1.setPadding(Edge.Top, 3); + root_child0_child0_child1.setPadding(Edge.Right, 8); + root_child0_child0_child1.setPadding(Edge.Bottom, 10); + root_child0_child0_child1.setBorder(Edge.Left, 2); + root_child0_child0_child1.setBorder(Edge.Top, 1); + root_child0_child0_child1.setBorder(Edge.Right, 5); + root_child0_child0_child1.setBorder(Edge.Bottom, 9); + root_child0_child0_child1.setWidth("10%"); + root_child0_child0.insertChild(root_child0_child0_child1, 1); + + const root_child0_child0_child1_child0 = Yoga.Node.create(config); + root_child0_child0_child1_child0.setPositionType(PositionType.Relative); + root_child0_child0_child1_child0.setMargin(Edge.Left, 9); + root_child0_child0_child1_child0.setMargin(Edge.Top, 12); + root_child0_child0_child1_child0.setMargin(Edge.Right, 4); + root_child0_child0_child1_child0.setMargin(Edge.Bottom, 7); + root_child0_child0_child1_child0.setPadding(Edge.Left, 5); + root_child0_child0_child1_child0.setPadding(Edge.Top, 3); + root_child0_child0_child1_child0.setPadding(Edge.Right, 8); + root_child0_child0_child1_child0.setPadding(Edge.Bottom, 10); + root_child0_child0_child1_child0.setBorder(Edge.Left, 2); + root_child0_child0_child1_child0.setBorder(Edge.Top, 1); + root_child0_child0_child1_child0.setBorder(Edge.Right, 5); + root_child0_child0_child1_child0.setBorder(Edge.Bottom, 9); + root_child0_child0_child1_child0.setWidth(100); + root_child0_child0_child1_child0.setHeight(50); + root_child0_child0_child1.insertChild(root_child0_child0_child1_child0, 0); + + const root_child0_child0_child2 = Yoga.Node.create(config); + root_child0_child0_child2.setPositionType(PositionType.Relative); + root_child0_child0_child2.setMargin(Edge.Left, 9); + root_child0_child0_child2.setMargin(Edge.Top, 12); + root_child0_child0_child2.setMargin(Edge.Right, 4); + root_child0_child0_child2.setMargin(Edge.Bottom, 7); + root_child0_child0_child2.setPadding(Edge.Left, 5); + root_child0_child0_child2.setPadding(Edge.Top, 3); + root_child0_child0_child2.setPadding(Edge.Right, 8); + root_child0_child0_child2.setPadding(Edge.Bottom, 10); + root_child0_child0_child2.setBorder(Edge.Left, 2); + root_child0_child0_child2.setBorder(Edge.Top, 1); + root_child0_child0_child2.setBorder(Edge.Right, 5); + root_child0_child0_child2.setBorder(Edge.Bottom, 9); + root_child0_child0_child2.setWidth("10%"); + root_child0_child0.insertChild(root_child0_child0_child2, 2); + + const root_child0_child0_child2_child0 = Yoga.Node.create(config); + root_child0_child0_child2_child0.setPositionType(PositionType.Relative); + root_child0_child0_child2_child0.setMargin(Edge.Left, 9); + root_child0_child0_child2_child0.setMargin(Edge.Top, 12); + root_child0_child0_child2_child0.setMargin(Edge.Right, 4); + root_child0_child0_child2_child0.setMargin(Edge.Bottom, 7); + root_child0_child0_child2_child0.setPadding(Edge.Left, 5); + root_child0_child0_child2_child0.setPadding(Edge.Top, 3); + root_child0_child0_child2_child0.setPadding(Edge.Right, 8); + root_child0_child0_child2_child0.setPadding(Edge.Bottom, 10); + root_child0_child0_child2_child0.setBorder(Edge.Left, 2); + root_child0_child0_child2_child0.setBorder(Edge.Top, 1); + root_child0_child0_child2_child0.setBorder(Edge.Right, 5); + root_child0_child0_child2_child0.setBorder(Edge.Bottom, 9); + root_child0_child0_child2_child0.setWidth(100); + root_child0_child0_child2_child0.setHeight(50); + root_child0_child0_child2.insertChild(root_child0_child0_child2_child0, 0); + root.calculateLayout(undefined, undefined, Direction.LTR); + + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(215); + expect(root.getComputedHeight()).toBe(301); + + expect(root_child0.getComputedLeft()).toBe(4); + expect(root_child0.getComputedTop()).toBe(5); + expect(root_child0.getComputedWidth()).toBe(202); + expect(root_child0.getComputedHeight()).toBe(295); + + expect(root_child0_child0.getComputedLeft()).toBe(15); + expect(root_child0_child0.getComputedTop()).toBe(21); + expect(root_child0_child0.getComputedWidth()).toBe(166); + expect(root_child0_child0.getComputedHeight()).toBe(244); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(18); + expect(root_child0_child0_child0.getComputedTop()).toBe(29); + expect(root_child0_child0_child0.getComputedWidth()).toBe(40); + expect(root_child0_child0_child0.getComputedHeight()).toBe(92); + + expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(16); + expect(root_child0_child0_child0_child0.getComputedTop()).toBe(16); + expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child1.getComputedLeft()).toBe(18); + expect(root_child0_child0_child1.getComputedTop()).toBe(29); + expect(root_child0_child0_child1.getComputedWidth()).toBe(20); + expect(root_child0_child0_child1.getComputedHeight()).toBe(92); + + expect(root_child0_child0_child1_child0.getComputedLeft()).toBe(16); + expect(root_child0_child0_child1_child0.getComputedTop()).toBe(16); + expect(root_child0_child0_child1_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0_child1_child0.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child2.getComputedLeft()).toBe(18); + expect(root_child0_child0_child2.getComputedTop()).toBe(140); + expect(root_child0_child0_child2.getComputedWidth()).toBe(20); + expect(root_child0_child0_child2.getComputedHeight()).toBe(92); + + expect(root_child0_child0_child2_child0.getComputedLeft()).toBe(16); + expect(root_child0_child0_child2_child0.getComputedTop()).toBe(16); + expect(root_child0_child0_child2_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0_child2_child0.getComputedHeight()).toBe(50); + + root.calculateLayout(undefined, undefined, Direction.RTL); + + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(215); + expect(root.getComputedHeight()).toBe(301); + + expect(root_child0.getComputedLeft()).toBe(4); + expect(root_child0.getComputedTop()).toBe(5); + expect(root_child0.getComputedWidth()).toBe(202); + expect(root_child0.getComputedHeight()).toBe(295); + + expect(root_child0_child0.getComputedLeft()).toBe(15); + expect(root_child0_child0.getComputedTop()).toBe(21); + expect(root_child0_child0.getComputedWidth()).toBe(166); + expect(root_child0_child0.getComputedHeight()).toBe(244); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(111); + expect(root_child0_child0_child0.getComputedTop()).toBe(29); + expect(root_child0_child0_child0.getComputedWidth()).toBe(40); + expect(root_child0_child0_child0.getComputedHeight()).toBe(92); + + expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(-77); + expect(root_child0_child0_child0_child0.getComputedTop()).toBe(16); + expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child1.getComputedLeft()).toBe(131); + expect(root_child0_child0_child1.getComputedTop()).toBe(29); + expect(root_child0_child0_child1.getComputedWidth()).toBe(20); + expect(root_child0_child0_child1.getComputedHeight()).toBe(92); + + expect(root_child0_child0_child1_child0.getComputedLeft()).toBe(-97); + expect(root_child0_child0_child1_child0.getComputedTop()).toBe(16); + expect(root_child0_child0_child1_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0_child1_child0.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child2.getComputedLeft()).toBe(131); + expect(root_child0_child0_child2.getComputedTop()).toBe(140); + expect(root_child0_child0_child2.getComputedWidth()).toBe(20); + expect(root_child0_child0_child2.getComputedHeight()).toBe(92); + + expect(root_child0_child0_child2_child0.getComputedLeft()).toBe(-97); + expect(root_child0_child0_child2_child0.getComputedTop()).toBe(16); + expect(root_child0_child0_child2_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0_child2_child0.getComputedHeight()).toBe(50); + } finally { + if (typeof root !== 'undefined') { + root.freeRecursive(); + } + + config.free(); + } +}); +test('static_position_justify_flex_start_position_set_amalgamation', () => { + const config = Yoga.Config.create(); + let root; + + config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); + + try { + root = Yoga.Node.create(config); + root.setPositionType(PositionType.Absolute); + + const root_child0 = Yoga.Node.create(config); + root_child0.setPositionType(PositionType.Relative); + root_child0.setMargin(Edge.Left, 4); + root_child0.setMargin(Edge.Top, 5); + root_child0.setMargin(Edge.Right, 9); + root_child0.setMargin(Edge.Bottom, 1); + root_child0.setPadding(Edge.Left, 2); + root_child0.setPadding(Edge.Top, 9); + root_child0.setPadding(Edge.Right, 11); + root_child0.setPadding(Edge.Bottom, 13); + root_child0.setBorder(Edge.Left, 5); + root_child0.setBorder(Edge.Top, 6); + root_child0.setBorder(Edge.Right, 7); + root_child0.setBorder(Edge.Bottom, 8); + root.insertChild(root_child0, 0); + + const root_child0_child0 = Yoga.Node.create(config); + root_child0_child0.setMargin(Edge.Left, 8); + root_child0_child0.setMargin(Edge.Top, 6); + root_child0_child0.setMargin(Edge.Right, 3); + root_child0_child0.setMargin(Edge.Bottom, 9); + root_child0_child0.setPadding(Edge.Left, 1); + root_child0_child0.setPadding(Edge.Top, 7); + root_child0_child0.setPadding(Edge.Right, 9); + root_child0_child0.setPadding(Edge.Bottom, 4); + root_child0_child0.setBorder(Edge.Left, 8); + root_child0_child0.setBorder(Edge.Top, 10); + root_child0_child0.setBorder(Edge.Right, 2); + root_child0_child0.setBorder(Edge.Bottom, 1); + 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, 30); + root_child0_child0_child0.setMargin(Edge.Left, 9); + root_child0_child0_child0.setMargin(Edge.Top, 12); + root_child0_child0_child0.setMargin(Edge.Right, 4); + root_child0_child0_child0.setMargin(Edge.Bottom, 7); + root_child0_child0_child0.setPadding(Edge.Left, 5); + root_child0_child0_child0.setPadding(Edge.Top, 3); + root_child0_child0_child0.setPadding(Edge.Right, 8); + root_child0_child0_child0.setPadding(Edge.Bottom, 10); + root_child0_child0_child0.setBorder(Edge.Left, 2); + root_child0_child0_child0.setBorder(Edge.Top, 1); + root_child0_child0_child0.setBorder(Edge.Right, 5); + root_child0_child0_child0.setBorder(Edge.Bottom, 9); + root_child0_child0_child0.setWidth("21%"); + 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.Relative); + root_child0_child0_child0_child0.setMargin(Edge.Left, 9); + root_child0_child0_child0_child0.setMargin(Edge.Top, 12); + root_child0_child0_child0_child0.setMargin(Edge.Right, 4); + root_child0_child0_child0_child0.setMargin(Edge.Bottom, 7); + root_child0_child0_child0_child0.setPadding(Edge.Left, 5); + root_child0_child0_child0_child0.setPadding(Edge.Top, 3); + root_child0_child0_child0_child0.setPadding(Edge.Right, 8); + root_child0_child0_child0_child0.setPadding(Edge.Bottom, 10); + root_child0_child0_child0_child0.setBorder(Edge.Left, 2); + root_child0_child0_child0_child0.setBorder(Edge.Top, 1); + root_child0_child0_child0_child0.setBorder(Edge.Right, 5); + root_child0_child0_child0_child0.setBorder(Edge.Bottom, 9); + root_child0_child0_child0_child0.setWidth(100); + root_child0_child0_child0_child0.setHeight(50); + root_child0_child0_child0.insertChild(root_child0_child0_child0_child0, 0); + + const root_child0_child0_child1 = Yoga.Node.create(config); + root_child0_child0_child1.setPositionType(PositionType.Relative); + root_child0_child0_child1.setMargin(Edge.Left, 9); + root_child0_child0_child1.setMargin(Edge.Top, 12); + root_child0_child0_child1.setMargin(Edge.Right, 4); + root_child0_child0_child1.setMargin(Edge.Bottom, 7); + root_child0_child0_child1.setPadding(Edge.Left, 5); + root_child0_child0_child1.setPadding(Edge.Top, 3); + root_child0_child0_child1.setPadding(Edge.Right, 8); + root_child0_child0_child1.setPadding(Edge.Bottom, 10); + root_child0_child0_child1.setBorder(Edge.Left, 2); + root_child0_child0_child1.setBorder(Edge.Top, 1); + root_child0_child0_child1.setBorder(Edge.Right, 5); + root_child0_child0_child1.setBorder(Edge.Bottom, 9); + root_child0_child0_child1.setWidth("10%"); + root_child0_child0.insertChild(root_child0_child0_child1, 1); + + const root_child0_child0_child1_child0 = Yoga.Node.create(config); + root_child0_child0_child1_child0.setPositionType(PositionType.Relative); + root_child0_child0_child1_child0.setMargin(Edge.Left, 9); + root_child0_child0_child1_child0.setMargin(Edge.Top, 12); + root_child0_child0_child1_child0.setMargin(Edge.Right, 4); + root_child0_child0_child1_child0.setMargin(Edge.Bottom, 7); + root_child0_child0_child1_child0.setPadding(Edge.Left, 5); + root_child0_child0_child1_child0.setPadding(Edge.Top, 3); + root_child0_child0_child1_child0.setPadding(Edge.Right, 8); + root_child0_child0_child1_child0.setPadding(Edge.Bottom, 10); + root_child0_child0_child1_child0.setBorder(Edge.Left, 2); + root_child0_child0_child1_child0.setBorder(Edge.Top, 1); + root_child0_child0_child1_child0.setBorder(Edge.Right, 5); + root_child0_child0_child1_child0.setBorder(Edge.Bottom, 9); + root_child0_child0_child1_child0.setWidth(100); + root_child0_child0_child1_child0.setHeight(50); + root_child0_child0_child1.insertChild(root_child0_child0_child1_child0, 0); + + const root_child0_child0_child2 = Yoga.Node.create(config); + root_child0_child0_child2.setPositionType(PositionType.Relative); + root_child0_child0_child2.setMargin(Edge.Left, 9); + root_child0_child0_child2.setMargin(Edge.Top, 12); + root_child0_child0_child2.setMargin(Edge.Right, 4); + root_child0_child0_child2.setMargin(Edge.Bottom, 7); + root_child0_child0_child2.setPadding(Edge.Left, 5); + root_child0_child0_child2.setPadding(Edge.Top, 3); + root_child0_child0_child2.setPadding(Edge.Right, 8); + root_child0_child0_child2.setPadding(Edge.Bottom, 10); + root_child0_child0_child2.setBorder(Edge.Left, 2); + root_child0_child0_child2.setBorder(Edge.Top, 1); + root_child0_child0_child2.setBorder(Edge.Right, 5); + root_child0_child0_child2.setBorder(Edge.Bottom, 9); + root_child0_child0_child2.setWidth("10%"); + root_child0_child0.insertChild(root_child0_child0_child2, 2); + + const root_child0_child0_child2_child0 = Yoga.Node.create(config); + root_child0_child0_child2_child0.setPositionType(PositionType.Relative); + root_child0_child0_child2_child0.setMargin(Edge.Left, 9); + root_child0_child0_child2_child0.setMargin(Edge.Top, 12); + root_child0_child0_child2_child0.setMargin(Edge.Right, 4); + root_child0_child0_child2_child0.setMargin(Edge.Bottom, 7); + root_child0_child0_child2_child0.setPadding(Edge.Left, 5); + root_child0_child0_child2_child0.setPadding(Edge.Top, 3); + root_child0_child0_child2_child0.setPadding(Edge.Right, 8); + root_child0_child0_child2_child0.setPadding(Edge.Bottom, 10); + root_child0_child0_child2_child0.setBorder(Edge.Left, 2); + root_child0_child0_child2_child0.setBorder(Edge.Top, 1); + root_child0_child0_child2_child0.setBorder(Edge.Right, 5); + root_child0_child0_child2_child0.setBorder(Edge.Bottom, 9); + root_child0_child0_child2_child0.setWidth(100); + root_child0_child0_child2_child0.setHeight(50); + root_child0_child0_child2.insertChild(root_child0_child0_child2_child0, 0); + root.calculateLayout(undefined, undefined, Direction.LTR); + + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(215); + expect(root.getComputedHeight()).toBe(301); + + expect(root_child0.getComputedLeft()).toBe(4); + expect(root_child0.getComputedTop()).toBe(5); + expect(root_child0.getComputedWidth()).toBe(202); + expect(root_child0.getComputedHeight()).toBe(295); + + expect(root_child0_child0.getComputedLeft()).toBe(15); + expect(root_child0_child0.getComputedTop()).toBe(21); + expect(root_child0_child0.getComputedWidth()).toBe(166); + expect(root_child0_child0.getComputedHeight()).toBe(244); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(106); + expect(root_child0_child0_child0.getComputedTop()).toBe(29); + expect(root_child0_child0_child0.getComputedWidth()).toBe(40); + expect(root_child0_child0_child0.getComputedHeight()).toBe(92); + + expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(16); + expect(root_child0_child0_child0_child0.getComputedTop()).toBe(16); + expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child1.getComputedLeft()).toBe(18); + expect(root_child0_child0_child1.getComputedTop()).toBe(29); + expect(root_child0_child0_child1.getComputedWidth()).toBe(20); + expect(root_child0_child0_child1.getComputedHeight()).toBe(92); + + expect(root_child0_child0_child1_child0.getComputedLeft()).toBe(16); + expect(root_child0_child0_child1_child0.getComputedTop()).toBe(16); + expect(root_child0_child0_child1_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0_child1_child0.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child2.getComputedLeft()).toBe(18); + expect(root_child0_child0_child2.getComputedTop()).toBe(140); + expect(root_child0_child0_child2.getComputedWidth()).toBe(20); + expect(root_child0_child0_child2.getComputedHeight()).toBe(92); + + expect(root_child0_child0_child2_child0.getComputedLeft()).toBe(16); + expect(root_child0_child0_child2_child0.getComputedTop()).toBe(16); + expect(root_child0_child0_child2_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0_child2_child0.getComputedHeight()).toBe(50); + + root.calculateLayout(undefined, undefined, Direction.RTL); + + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(215); + expect(root.getComputedHeight()).toBe(301); + + expect(root_child0.getComputedLeft()).toBe(4); + expect(root_child0.getComputedTop()).toBe(5); + expect(root_child0.getComputedWidth()).toBe(202); + expect(root_child0.getComputedHeight()).toBe(295); + + expect(root_child0_child0.getComputedLeft()).toBe(15); + expect(root_child0_child0.getComputedTop()).toBe(21); + expect(root_child0_child0.getComputedWidth()).toBe(166); + expect(root_child0_child0.getComputedHeight()).toBe(244); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(106); + expect(root_child0_child0_child0.getComputedTop()).toBe(29); + expect(root_child0_child0_child0.getComputedWidth()).toBe(40); + expect(root_child0_child0_child0.getComputedHeight()).toBe(92); + + expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(-77); + expect(root_child0_child0_child0_child0.getComputedTop()).toBe(16); + expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child1.getComputedLeft()).toBe(131); + expect(root_child0_child0_child1.getComputedTop()).toBe(29); + expect(root_child0_child0_child1.getComputedWidth()).toBe(20); + expect(root_child0_child0_child1.getComputedHeight()).toBe(92); + + expect(root_child0_child0_child1_child0.getComputedLeft()).toBe(-97); + expect(root_child0_child0_child1_child0.getComputedTop()).toBe(16); + expect(root_child0_child0_child1_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0_child1_child0.getComputedHeight()).toBe(50); + + expect(root_child0_child0_child2.getComputedLeft()).toBe(131); + expect(root_child0_child0_child2.getComputedTop()).toBe(140); + expect(root_child0_child0_child2.getComputedWidth()).toBe(20); + expect(root_child0_child0_child2.getComputedHeight()).toBe(92); + + expect(root_child0_child0_child2_child0.getComputedLeft()).toBe(-97); + expect(root_child0_child0_child2_child0.getComputedTop()).toBe(16); + expect(root_child0_child0_child2_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0_child2_child0.getComputedHeight()).toBe(50); + } finally { + if (typeof root !== 'undefined') { + root.freeRecursive(); + } + + config.free(); + } +}); diff --git a/tests/generated/YGStaticPositionTest.cpp b/tests/generated/YGStaticPositionTest.cpp index 25a949ac06..dd60aeea3b 100644 --- a/tests/generated/YGStaticPositionTest.cpp +++ b/tests/generated/YGStaticPositionTest.cpp @@ -2756,3 +2756,1295 @@ TEST(YogaTest, static_position_containing_block_padding_and_border) { YGConfigFree(config); } + +TEST(YogaTest, static_position_amalgamation) { + const YGConfigRef config = YGConfigNew(); + YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); + + const YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); + + const YGNodeRef root_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root_child0, YGPositionTypeRelative); + YGNodeStyleSetMargin(root_child0, YGEdgeLeft, 4); + YGNodeStyleSetMargin(root_child0, YGEdgeTop, 5); + YGNodeStyleSetMargin(root_child0, YGEdgeRight, 9); + YGNodeStyleSetMargin(root_child0, YGEdgeBottom, 1); + YGNodeStyleSetPadding(root_child0, YGEdgeLeft, 2); + YGNodeStyleSetPadding(root_child0, YGEdgeTop, 9); + YGNodeStyleSetPadding(root_child0, YGEdgeRight, 11); + YGNodeStyleSetPadding(root_child0, YGEdgeBottom, 13); + YGNodeStyleSetBorder(root_child0, YGEdgeLeft, 5); + YGNodeStyleSetBorder(root_child0, YGEdgeTop, 6); + YGNodeStyleSetBorder(root_child0, YGEdgeRight, 7); + YGNodeStyleSetBorder(root_child0, YGEdgeBottom, 8); + YGNodeStyleSetWidth(root_child0, 500); + YGNodeStyleSetHeight(root_child0, 500); + YGNodeInsertChild(root, root_child0, 0); + + const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeLeft, 8); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeTop, 6); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeRight, 3); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeBottom, 9); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeLeft, 1); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeTop, 7); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeRight, 9); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeBottom, 4); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeLeft, 8); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeTop, 10); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeRight, 2); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeBottom, 1); + YGNodeStyleSetWidth(root_child0_child0, 200); + YGNodeStyleSetHeight(root_child0_child0, 200); + 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, 2); + YGNodeStyleSetPosition(root_child0_child0_child0, YGEdgeRight, 12); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeLeft, 9); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeTop, 12); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeRight, 4); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeBottom, 7); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeLeft, 5); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeTop, 3); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeRight, 8); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeBottom, 10); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeLeft, 2); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeTop, 1); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeRight, 5); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeBottom, 9); + YGNodeStyleSetWidthPercent(root_child0_child0_child0, 41); + YGNodeStyleSetHeightPercent(root_child0_child0_child0, 63); + 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(513, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(506, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(4, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(5, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(15, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(21, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child0_child0)); + + ASSERT_FLOAT_EQ(1, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(29, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(306, 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(513, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(506, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(4, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(5, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(279, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(21, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child0_child0)); + + ASSERT_FLOAT_EQ(-2, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(29, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(306, YGNodeLayoutGetHeight(root_child0_child0_child0)); + + YGNodeFreeRecursive(root); + + YGConfigFree(config); +} + +TEST(YogaTest, static_position_no_position_amalgamation) { + const YGConfigRef config = YGConfigNew(); + YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); + + const YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); + + const YGNodeRef root_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root_child0, YGPositionTypeRelative); + YGNodeStyleSetMargin(root_child0, YGEdgeLeft, 4); + YGNodeStyleSetMargin(root_child0, YGEdgeTop, 5); + YGNodeStyleSetMargin(root_child0, YGEdgeRight, 9); + YGNodeStyleSetMargin(root_child0, YGEdgeBottom, 1); + YGNodeStyleSetPadding(root_child0, YGEdgeLeft, 2); + YGNodeStyleSetPadding(root_child0, YGEdgeTop, 9); + YGNodeStyleSetPadding(root_child0, YGEdgeRight, 11); + YGNodeStyleSetPadding(root_child0, YGEdgeBottom, 13); + YGNodeStyleSetBorder(root_child0, YGEdgeLeft, 5); + YGNodeStyleSetBorder(root_child0, YGEdgeTop, 6); + YGNodeStyleSetBorder(root_child0, YGEdgeRight, 7); + YGNodeStyleSetBorder(root_child0, YGEdgeBottom, 8); + YGNodeStyleSetWidth(root_child0, 500); + YGNodeStyleSetHeight(root_child0, 500); + YGNodeInsertChild(root, root_child0, 0); + + const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeLeft, 8); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeTop, 6); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeRight, 3); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeBottom, 9); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeLeft, 1); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeTop, 7); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeRight, 9); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeBottom, 4); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeLeft, 8); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeTop, 10); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeRight, 2); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeBottom, 1); + YGNodeStyleSetWidth(root_child0_child0, 200); + YGNodeStyleSetHeight(root_child0_child0, 200); + YGNodeInsertChild(root_child0, root_child0_child0, 0); + + const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root_child0_child0_child0, YGPositionTypeAbsolute); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeLeft, 9); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeTop, 12); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeRight, 4); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeBottom, 7); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeLeft, 5); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeTop, 3); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeRight, 8); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeBottom, 10); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeLeft, 2); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeTop, 1); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeRight, 5); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeBottom, 9); + YGNodeStyleSetWidthPercent(root_child0_child0_child0, 41); + YGNodeStyleSetHeightPercent(root_child0_child0_child0, 63); + 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(513, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(506, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(4, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(5, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(15, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(21, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child0_child0)); + + ASSERT_FLOAT_EQ(18, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(29, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(306, 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(513, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(506, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(4, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(5, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(279, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(21, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child0_child0)); + + ASSERT_FLOAT_EQ(-15, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(29, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(306, YGNodeLayoutGetHeight(root_child0_child0_child0)); + + YGNodeFreeRecursive(root); + + YGConfigFree(config); +} + +TEST(YogaTest, static_position_zero_for_inset_amalgamation) { + const YGConfigRef config = YGConfigNew(); + YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); + + const YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); + + const YGNodeRef root_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root_child0, YGPositionTypeRelative); + YGNodeStyleSetMargin(root_child0, YGEdgeLeft, 4); + YGNodeStyleSetMargin(root_child0, YGEdgeTop, 5); + YGNodeStyleSetMargin(root_child0, YGEdgeRight, 9); + YGNodeStyleSetMargin(root_child0, YGEdgeBottom, 1); + YGNodeStyleSetPadding(root_child0, YGEdgeLeft, 2); + YGNodeStyleSetPadding(root_child0, YGEdgeTop, 9); + YGNodeStyleSetPadding(root_child0, YGEdgeRight, 11); + YGNodeStyleSetPadding(root_child0, YGEdgeBottom, 13); + YGNodeStyleSetBorder(root_child0, YGEdgeLeft, 5); + YGNodeStyleSetBorder(root_child0, YGEdgeTop, 6); + YGNodeStyleSetBorder(root_child0, YGEdgeRight, 7); + YGNodeStyleSetBorder(root_child0, YGEdgeBottom, 8); + YGNodeStyleSetWidth(root_child0, 500); + YGNodeStyleSetHeight(root_child0, 500); + YGNodeInsertChild(root, root_child0, 0); + + const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeLeft, 8); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeTop, 6); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeRight, 3); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeBottom, 9); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeLeft, 1); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeTop, 7); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeRight, 9); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeBottom, 4); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeLeft, 8); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeTop, 10); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeRight, 2); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeBottom, 1); + YGNodeStyleSetWidth(root_child0_child0, 200); + YGNodeStyleSetHeight(root_child0_child0, 200); + 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, 0); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeLeft, 9); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeTop, 12); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeRight, 4); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeBottom, 7); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeLeft, 5); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeTop, 3); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeRight, 8); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeBottom, 10); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeLeft, 2); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeTop, 1); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeRight, 5); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeBottom, 9); + YGNodeStyleSetWidthPercent(root_child0_child0_child0, 41); + YGNodeStyleSetHeightPercent(root_child0_child0_child0, 63); + 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(513, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(506, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(4, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(5, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(15, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(21, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child0_child0)); + + ASSERT_FLOAT_EQ(-1, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(29, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(306, 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(513, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(506, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(4, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(5, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(279, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(21, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child0_child0)); + + ASSERT_FLOAT_EQ(-265, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(29, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(306, YGNodeLayoutGetHeight(root_child0_child0_child0)); + + YGNodeFreeRecursive(root); + + YGConfigFree(config); +} + +TEST(YogaTest, static_position_start_inset_amalgamation) { + const YGConfigRef config = YGConfigNew(); + YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); + + const YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); + + const YGNodeRef root_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root_child0, YGPositionTypeRelative); + YGNodeStyleSetMargin(root_child0, YGEdgeLeft, 4); + YGNodeStyleSetMargin(root_child0, YGEdgeTop, 5); + YGNodeStyleSetMargin(root_child0, YGEdgeRight, 9); + YGNodeStyleSetMargin(root_child0, YGEdgeBottom, 1); + YGNodeStyleSetPadding(root_child0, YGEdgeLeft, 2); + YGNodeStyleSetPadding(root_child0, YGEdgeTop, 9); + YGNodeStyleSetPadding(root_child0, YGEdgeRight, 11); + YGNodeStyleSetPadding(root_child0, YGEdgeBottom, 13); + YGNodeStyleSetBorder(root_child0, YGEdgeLeft, 5); + YGNodeStyleSetBorder(root_child0, YGEdgeTop, 6); + YGNodeStyleSetBorder(root_child0, YGEdgeRight, 7); + YGNodeStyleSetBorder(root_child0, YGEdgeBottom, 8); + YGNodeStyleSetWidth(root_child0, 500); + YGNodeStyleSetHeight(root_child0, 500); + YGNodeInsertChild(root, root_child0, 0); + + const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeLeft, 8); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeTop, 6); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeRight, 3); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeBottom, 9); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeLeft, 1); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeTop, 7); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeRight, 9); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeBottom, 4); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeLeft, 8); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeTop, 10); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeRight, 2); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeBottom, 1); + YGNodeStyleSetWidth(root_child0_child0, 200); + YGNodeStyleSetHeight(root_child0_child0, 200); + 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, YGEdgeStart, 12); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeLeft, 9); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeTop, 12); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeRight, 4); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeBottom, 7); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeLeft, 5); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeTop, 3); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeRight, 8); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeBottom, 10); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeLeft, 2); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeTop, 1); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeRight, 5); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeBottom, 9); + YGNodeStyleSetWidthPercent(root_child0_child0_child0, 41); + YGNodeStyleSetHeightPercent(root_child0_child0_child0, 63); + 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(513, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(506, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(4, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(5, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(15, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(21, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child0_child0)); + + ASSERT_FLOAT_EQ(11, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(29, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(306, 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(513, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(506, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(4, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(5, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(279, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(21, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child0_child0)); + + ASSERT_FLOAT_EQ(-2, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(29, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(306, YGNodeLayoutGetHeight(root_child0_child0_child0)); + + YGNodeFreeRecursive(root); + + YGConfigFree(config); +} + +TEST(YogaTest, static_position_end_inset_amalgamation) { + const YGConfigRef config = YGConfigNew(); + YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); + + const YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); + + const YGNodeRef root_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root_child0, YGPositionTypeRelative); + YGNodeStyleSetMargin(root_child0, YGEdgeLeft, 4); + YGNodeStyleSetMargin(root_child0, YGEdgeTop, 5); + YGNodeStyleSetMargin(root_child0, YGEdgeRight, 9); + YGNodeStyleSetMargin(root_child0, YGEdgeBottom, 1); + YGNodeStyleSetPadding(root_child0, YGEdgeLeft, 2); + YGNodeStyleSetPadding(root_child0, YGEdgeTop, 9); + YGNodeStyleSetPadding(root_child0, YGEdgeRight, 11); + YGNodeStyleSetPadding(root_child0, YGEdgeBottom, 13); + YGNodeStyleSetBorder(root_child0, YGEdgeLeft, 5); + YGNodeStyleSetBorder(root_child0, YGEdgeTop, 6); + YGNodeStyleSetBorder(root_child0, YGEdgeRight, 7); + YGNodeStyleSetBorder(root_child0, YGEdgeBottom, 8); + YGNodeStyleSetWidth(root_child0, 500); + YGNodeStyleSetHeight(root_child0, 500); + YGNodeInsertChild(root, root_child0, 0); + + const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeLeft, 8); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeTop, 6); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeRight, 3); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeBottom, 9); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeLeft, 1); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeTop, 7); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeRight, 9); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeBottom, 4); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeLeft, 8); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeTop, 10); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeRight, 2); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeBottom, 1); + YGNodeStyleSetWidth(root_child0_child0, 200); + YGNodeStyleSetHeight(root_child0_child0, 200); + 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, YGEdgeEnd, 4); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeLeft, 9); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeTop, 12); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeRight, 4); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeBottom, 7); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeLeft, 5); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeTop, 3); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeRight, 8); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeBottom, 10); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeLeft, 2); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeTop, 1); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeRight, 5); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeBottom, 9); + YGNodeStyleSetWidthPercent(root_child0_child0_child0, 41); + YGNodeStyleSetHeightPercent(root_child0_child0_child0, 63); + 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(513, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(506, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(4, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(5, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(15, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(21, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child0_child0)); + + ASSERT_FLOAT_EQ(270, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(29, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(306, 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(513, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(506, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(4, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(5, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(279, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(21, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child0_child0)); + + ASSERT_FLOAT_EQ(-261, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(29, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(306, YGNodeLayoutGetHeight(root_child0_child0_child0)); + + YGNodeFreeRecursive(root); + + YGConfigFree(config); +} + +TEST(YogaTest, static_position_row_reverse_amalgamation) { + const YGConfigRef config = YGConfigNew(); + YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); + + const YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); + + const YGNodeRef root_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root_child0, YGPositionTypeRelative); + YGNodeStyleSetMargin(root_child0, YGEdgeLeft, 4); + YGNodeStyleSetMargin(root_child0, YGEdgeTop, 5); + YGNodeStyleSetMargin(root_child0, YGEdgeRight, 9); + YGNodeStyleSetMargin(root_child0, YGEdgeBottom, 1); + YGNodeStyleSetPadding(root_child0, YGEdgeLeft, 2); + YGNodeStyleSetPadding(root_child0, YGEdgeTop, 9); + YGNodeStyleSetPadding(root_child0, YGEdgeRight, 11); + YGNodeStyleSetPadding(root_child0, YGEdgeBottom, 13); + YGNodeStyleSetBorder(root_child0, YGEdgeLeft, 5); + YGNodeStyleSetBorder(root_child0, YGEdgeTop, 6); + YGNodeStyleSetBorder(root_child0, YGEdgeRight, 7); + YGNodeStyleSetBorder(root_child0, YGEdgeBottom, 8); + YGNodeInsertChild(root, root_child0, 0); + + const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetFlexDirection(root_child0_child0, YGFlexDirectionRowReverse); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeLeft, 8); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeTop, 6); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeRight, 3); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeBottom, 9); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeLeft, 1); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeTop, 7); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeRight, 9); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeBottom, 4); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeLeft, 8); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeTop, 10); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeRight, 2); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeBottom, 1); + YGNodeInsertChild(root_child0, root_child0_child0, 0); + + const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root_child0_child0_child0, YGPositionTypeAbsolute); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeLeft, 9); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeTop, 12); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeRight, 4); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeBottom, 7); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeLeft, 5); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeTop, 3); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeRight, 8); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeBottom, 10); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeLeft, 2); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeTop, 1); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeRight, 5); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeBottom, 9); + YGNodeStyleSetHeightPercent(root_child0_child0_child0, 12); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0); + + const YGNodeRef root_child0_child0_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root_child0_child0_child0_child0, YGPositionTypeRelative); + YGNodeStyleSetMargin(root_child0_child0_child0_child0, YGEdgeLeft, 9); + YGNodeStyleSetMargin(root_child0_child0_child0_child0, YGEdgeTop, 12); + YGNodeStyleSetMargin(root_child0_child0_child0_child0, YGEdgeRight, 4); + YGNodeStyleSetMargin(root_child0_child0_child0_child0, YGEdgeBottom, 7); + YGNodeStyleSetPadding(root_child0_child0_child0_child0, YGEdgeLeft, 5); + YGNodeStyleSetPadding(root_child0_child0_child0_child0, YGEdgeTop, 3); + YGNodeStyleSetPadding(root_child0_child0_child0_child0, YGEdgeRight, 8); + YGNodeStyleSetPadding(root_child0_child0_child0_child0, YGEdgeBottom, 10); + YGNodeStyleSetBorder(root_child0_child0_child0_child0, YGEdgeLeft, 2); + YGNodeStyleSetBorder(root_child0_child0_child0_child0, YGEdgeTop, 1); + YGNodeStyleSetBorder(root_child0_child0_child0_child0, YGEdgeRight, 5); + YGNodeStyleSetBorder(root_child0_child0_child0_child0, YGEdgeBottom, 9); + YGNodeStyleSetWidth(root_child0_child0_child0_child0, 100); + YGNodeStyleSetHeight(root_child0_child0_child0_child0, 50); + YGNodeInsertChild(root_child0_child0_child0, root_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(69, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(79, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(4, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(5, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(56, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(73, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(15, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(21, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(22, YGNodeLayoutGetHeight(root_child0_child0)); + + ASSERT_FLOAT_EQ(-128, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(29, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(133, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(23, YGNodeLayoutGetHeight(root_child0_child0_child0)); + + ASSERT_FLOAT_EQ(16, YGNodeLayoutGetLeft(root_child0_child0_child0_child0)); + ASSERT_FLOAT_EQ(16, YGNodeLayoutGetTop(root_child0_child0_child0_child0)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0_child0)); + + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(69, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(79, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(4, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(5, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(56, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(73, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(15, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(21, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(22, YGNodeLayoutGetHeight(root_child0_child0)); + + ASSERT_FLOAT_EQ(18, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(29, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(133, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(23, YGNodeLayoutGetHeight(root_child0_child0_child0)); + + ASSERT_FLOAT_EQ(16, YGNodeLayoutGetLeft(root_child0_child0_child0_child0)); + ASSERT_FLOAT_EQ(16, YGNodeLayoutGetTop(root_child0_child0_child0_child0)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0_child0)); + + YGNodeFreeRecursive(root); + + YGConfigFree(config); +} + +TEST(YogaTest, static_position_column_reverse_amalgamation) { + const YGConfigRef config = YGConfigNew(); + YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); + + const YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); + + const YGNodeRef root_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root_child0, YGPositionTypeRelative); + YGNodeStyleSetMargin(root_child0, YGEdgeLeft, 4); + YGNodeStyleSetMargin(root_child0, YGEdgeTop, 5); + YGNodeStyleSetMargin(root_child0, YGEdgeRight, 9); + YGNodeStyleSetMargin(root_child0, YGEdgeBottom, 1); + YGNodeStyleSetPadding(root_child0, YGEdgeLeft, 2); + YGNodeStyleSetPadding(root_child0, YGEdgeTop, 9); + YGNodeStyleSetPadding(root_child0, YGEdgeRight, 11); + YGNodeStyleSetPadding(root_child0, YGEdgeBottom, 13); + YGNodeStyleSetBorder(root_child0, YGEdgeLeft, 5); + YGNodeStyleSetBorder(root_child0, YGEdgeTop, 6); + YGNodeStyleSetBorder(root_child0, YGEdgeRight, 7); + YGNodeStyleSetBorder(root_child0, YGEdgeBottom, 8); + YGNodeInsertChild(root, root_child0, 0); + + const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetFlexDirection(root_child0_child0, YGFlexDirectionColumnReverse); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeLeft, 8); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeTop, 6); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeRight, 3); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeBottom, 9); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeLeft, 1); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeTop, 7); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeRight, 9); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeBottom, 4); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeLeft, 8); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeTop, 10); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeRight, 2); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeBottom, 1); + YGNodeInsertChild(root_child0, root_child0_child0, 0); + + const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root_child0_child0_child0, YGPositionTypeAbsolute); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeLeft, 9); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeTop, 12); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeRight, 4); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeBottom, 7); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeLeft, 5); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeTop, 3); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeRight, 8); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeBottom, 10); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeLeft, 2); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeTop, 1); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeRight, 5); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeBottom, 9); + YGNodeStyleSetWidthPercent(root_child0_child0_child0, 21); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0); + + const YGNodeRef root_child0_child0_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root_child0_child0_child0_child0, YGPositionTypeRelative); + YGNodeStyleSetMargin(root_child0_child0_child0_child0, YGEdgeLeft, 9); + YGNodeStyleSetMargin(root_child0_child0_child0_child0, YGEdgeTop, 12); + YGNodeStyleSetMargin(root_child0_child0_child0_child0, YGEdgeRight, 4); + YGNodeStyleSetMargin(root_child0_child0_child0_child0, YGEdgeBottom, 7); + YGNodeStyleSetPadding(root_child0_child0_child0_child0, YGEdgeLeft, 5); + YGNodeStyleSetPadding(root_child0_child0_child0_child0, YGEdgeTop, 3); + YGNodeStyleSetPadding(root_child0_child0_child0_child0, YGEdgeRight, 8); + YGNodeStyleSetPadding(root_child0_child0_child0_child0, YGEdgeBottom, 10); + YGNodeStyleSetBorder(root_child0_child0_child0_child0, YGEdgeLeft, 2); + YGNodeStyleSetBorder(root_child0_child0_child0_child0, YGEdgeTop, 1); + YGNodeStyleSetBorder(root_child0_child0_child0_child0, YGEdgeRight, 5); + YGNodeStyleSetBorder(root_child0_child0_child0_child0, YGEdgeBottom, 9); + YGNodeStyleSetWidth(root_child0_child0_child0_child0, 100); + YGNodeStyleSetHeight(root_child0_child0_child0_child0, 50); + YGNodeInsertChild(root_child0_child0_child0, root_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(69, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(79, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(4, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(5, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(56, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(73, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(15, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(21, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(22, YGNodeLayoutGetHeight(root_child0_child0)); + + ASSERT_FLOAT_EQ(18, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(-82, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(92, YGNodeLayoutGetHeight(root_child0_child0_child0)); + + ASSERT_FLOAT_EQ(16, YGNodeLayoutGetLeft(root_child0_child0_child0_child0)); + ASSERT_FLOAT_EQ(16, YGNodeLayoutGetTop(root_child0_child0_child0_child0)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0_child0)); + + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(69, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(79, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(4, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(5, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(56, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(73, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(15, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(21, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(22, YGNodeLayoutGetHeight(root_child0_child0)); + + ASSERT_FLOAT_EQ(-15, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(-82, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(92, YGNodeLayoutGetHeight(root_child0_child0_child0)); + + ASSERT_FLOAT_EQ(-97, YGNodeLayoutGetLeft(root_child0_child0_child0_child0)); + ASSERT_FLOAT_EQ(16, YGNodeLayoutGetTop(root_child0_child0_child0_child0)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0_child0)); + + YGNodeFreeRecursive(root); + + YGConfigFree(config); +} + +TEST(YogaTest, static_position_justify_flex_start_amalgamation) { + const YGConfigRef config = YGConfigNew(); + YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); + + const YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); + + const YGNodeRef root_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root_child0, YGPositionTypeRelative); + YGNodeStyleSetMargin(root_child0, YGEdgeLeft, 4); + YGNodeStyleSetMargin(root_child0, YGEdgeTop, 5); + YGNodeStyleSetMargin(root_child0, YGEdgeRight, 9); + YGNodeStyleSetMargin(root_child0, YGEdgeBottom, 1); + YGNodeStyleSetPadding(root_child0, YGEdgeLeft, 2); + YGNodeStyleSetPadding(root_child0, YGEdgeTop, 9); + YGNodeStyleSetPadding(root_child0, YGEdgeRight, 11); + YGNodeStyleSetPadding(root_child0, YGEdgeBottom, 13); + YGNodeStyleSetBorder(root_child0, YGEdgeLeft, 5); + YGNodeStyleSetBorder(root_child0, YGEdgeTop, 6); + YGNodeStyleSetBorder(root_child0, YGEdgeRight, 7); + YGNodeStyleSetBorder(root_child0, YGEdgeBottom, 8); + YGNodeInsertChild(root, root_child0, 0); + + const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeLeft, 8); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeTop, 6); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeRight, 3); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeBottom, 9); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeLeft, 1); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeTop, 7); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeRight, 9); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeBottom, 4); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeLeft, 8); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeTop, 10); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeRight, 2); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeBottom, 1); + YGNodeInsertChild(root_child0, root_child0_child0, 0); + + const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root_child0_child0_child0, YGPositionTypeAbsolute); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeLeft, 9); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeTop, 12); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeRight, 4); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeBottom, 7); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeLeft, 5); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeTop, 3); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeRight, 8); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeBottom, 10); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeLeft, 2); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeTop, 1); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeRight, 5); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeBottom, 9); + YGNodeStyleSetWidthPercent(root_child0_child0_child0, 21); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0); + + const YGNodeRef root_child0_child0_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root_child0_child0_child0_child0, YGPositionTypeRelative); + YGNodeStyleSetMargin(root_child0_child0_child0_child0, YGEdgeLeft, 9); + YGNodeStyleSetMargin(root_child0_child0_child0_child0, YGEdgeTop, 12); + YGNodeStyleSetMargin(root_child0_child0_child0_child0, YGEdgeRight, 4); + YGNodeStyleSetMargin(root_child0_child0_child0_child0, YGEdgeBottom, 7); + YGNodeStyleSetPadding(root_child0_child0_child0_child0, YGEdgeLeft, 5); + YGNodeStyleSetPadding(root_child0_child0_child0_child0, YGEdgeTop, 3); + YGNodeStyleSetPadding(root_child0_child0_child0_child0, YGEdgeRight, 8); + YGNodeStyleSetPadding(root_child0_child0_child0_child0, YGEdgeBottom, 10); + YGNodeStyleSetBorder(root_child0_child0_child0_child0, YGEdgeLeft, 2); + YGNodeStyleSetBorder(root_child0_child0_child0_child0, YGEdgeTop, 1); + YGNodeStyleSetBorder(root_child0_child0_child0_child0, YGEdgeRight, 5); + YGNodeStyleSetBorder(root_child0_child0_child0_child0, YGEdgeBottom, 9); + YGNodeStyleSetWidth(root_child0_child0_child0_child0, 100); + YGNodeStyleSetHeight(root_child0_child0_child0_child0, 50); + YGNodeInsertChild(root_child0_child0_child0, root_child0_child0_child0_child0, 0); + + const YGNodeRef root_child0_child0_child1 = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root_child0_child0_child1, YGPositionTypeRelative); + YGNodeStyleSetMargin(root_child0_child0_child1, YGEdgeLeft, 9); + YGNodeStyleSetMargin(root_child0_child0_child1, YGEdgeTop, 12); + YGNodeStyleSetMargin(root_child0_child0_child1, YGEdgeRight, 4); + YGNodeStyleSetMargin(root_child0_child0_child1, YGEdgeBottom, 7); + YGNodeStyleSetPadding(root_child0_child0_child1, YGEdgeLeft, 5); + YGNodeStyleSetPadding(root_child0_child0_child1, YGEdgeTop, 3); + YGNodeStyleSetPadding(root_child0_child0_child1, YGEdgeRight, 8); + YGNodeStyleSetPadding(root_child0_child0_child1, YGEdgeBottom, 10); + YGNodeStyleSetBorder(root_child0_child0_child1, YGEdgeLeft, 2); + YGNodeStyleSetBorder(root_child0_child0_child1, YGEdgeTop, 1); + YGNodeStyleSetBorder(root_child0_child0_child1, YGEdgeRight, 5); + YGNodeStyleSetBorder(root_child0_child0_child1, YGEdgeBottom, 9); + YGNodeStyleSetWidthPercent(root_child0_child0_child1, 10); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child1, 1); + + const YGNodeRef root_child0_child0_child1_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root_child0_child0_child1_child0, YGPositionTypeRelative); + YGNodeStyleSetMargin(root_child0_child0_child1_child0, YGEdgeLeft, 9); + YGNodeStyleSetMargin(root_child0_child0_child1_child0, YGEdgeTop, 12); + YGNodeStyleSetMargin(root_child0_child0_child1_child0, YGEdgeRight, 4); + YGNodeStyleSetMargin(root_child0_child0_child1_child0, YGEdgeBottom, 7); + YGNodeStyleSetPadding(root_child0_child0_child1_child0, YGEdgeLeft, 5); + YGNodeStyleSetPadding(root_child0_child0_child1_child0, YGEdgeTop, 3); + YGNodeStyleSetPadding(root_child0_child0_child1_child0, YGEdgeRight, 8); + YGNodeStyleSetPadding(root_child0_child0_child1_child0, YGEdgeBottom, 10); + YGNodeStyleSetBorder(root_child0_child0_child1_child0, YGEdgeLeft, 2); + YGNodeStyleSetBorder(root_child0_child0_child1_child0, YGEdgeTop, 1); + YGNodeStyleSetBorder(root_child0_child0_child1_child0, YGEdgeRight, 5); + YGNodeStyleSetBorder(root_child0_child0_child1_child0, YGEdgeBottom, 9); + YGNodeStyleSetWidth(root_child0_child0_child1_child0, 100); + YGNodeStyleSetHeight(root_child0_child0_child1_child0, 50); + YGNodeInsertChild(root_child0_child0_child1, root_child0_child0_child1_child0, 0); + + const YGNodeRef root_child0_child0_child2 = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root_child0_child0_child2, YGPositionTypeRelative); + YGNodeStyleSetMargin(root_child0_child0_child2, YGEdgeLeft, 9); + YGNodeStyleSetMargin(root_child0_child0_child2, YGEdgeTop, 12); + YGNodeStyleSetMargin(root_child0_child0_child2, YGEdgeRight, 4); + YGNodeStyleSetMargin(root_child0_child0_child2, YGEdgeBottom, 7); + YGNodeStyleSetPadding(root_child0_child0_child2, YGEdgeLeft, 5); + YGNodeStyleSetPadding(root_child0_child0_child2, YGEdgeTop, 3); + YGNodeStyleSetPadding(root_child0_child0_child2, YGEdgeRight, 8); + YGNodeStyleSetPadding(root_child0_child0_child2, YGEdgeBottom, 10); + YGNodeStyleSetBorder(root_child0_child0_child2, YGEdgeLeft, 2); + YGNodeStyleSetBorder(root_child0_child0_child2, YGEdgeTop, 1); + YGNodeStyleSetBorder(root_child0_child0_child2, YGEdgeRight, 5); + YGNodeStyleSetBorder(root_child0_child0_child2, YGEdgeBottom, 9); + YGNodeStyleSetWidthPercent(root_child0_child0_child2, 10); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child2, 2); + + const YGNodeRef root_child0_child0_child2_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root_child0_child0_child2_child0, YGPositionTypeRelative); + YGNodeStyleSetMargin(root_child0_child0_child2_child0, YGEdgeLeft, 9); + YGNodeStyleSetMargin(root_child0_child0_child2_child0, YGEdgeTop, 12); + YGNodeStyleSetMargin(root_child0_child0_child2_child0, YGEdgeRight, 4); + YGNodeStyleSetMargin(root_child0_child0_child2_child0, YGEdgeBottom, 7); + YGNodeStyleSetPadding(root_child0_child0_child2_child0, YGEdgeLeft, 5); + YGNodeStyleSetPadding(root_child0_child0_child2_child0, YGEdgeTop, 3); + YGNodeStyleSetPadding(root_child0_child0_child2_child0, YGEdgeRight, 8); + YGNodeStyleSetPadding(root_child0_child0_child2_child0, YGEdgeBottom, 10); + YGNodeStyleSetBorder(root_child0_child0_child2_child0, YGEdgeLeft, 2); + YGNodeStyleSetBorder(root_child0_child0_child2_child0, YGEdgeTop, 1); + YGNodeStyleSetBorder(root_child0_child0_child2_child0, YGEdgeRight, 5); + YGNodeStyleSetBorder(root_child0_child0_child2_child0, YGEdgeBottom, 9); + YGNodeStyleSetWidth(root_child0_child0_child2_child0, 100); + YGNodeStyleSetHeight(root_child0_child0_child2_child0, 50); + YGNodeInsertChild(root_child0_child0_child2, root_child0_child0_child2_child0, 0); + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(215, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(301, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(4, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(5, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(202, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(295, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(15, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(21, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(166, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(244, YGNodeLayoutGetHeight(root_child0_child0)); + + ASSERT_FLOAT_EQ(18, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(29, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(40, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(92, YGNodeLayoutGetHeight(root_child0_child0_child0)); + + ASSERT_FLOAT_EQ(16, YGNodeLayoutGetLeft(root_child0_child0_child0_child0)); + ASSERT_FLOAT_EQ(16, YGNodeLayoutGetTop(root_child0_child0_child0_child0)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0_child0)); + + ASSERT_FLOAT_EQ(18, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(29, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(92, YGNodeLayoutGetHeight(root_child0_child0_child1)); + + ASSERT_FLOAT_EQ(16, YGNodeLayoutGetLeft(root_child0_child0_child1_child0)); + ASSERT_FLOAT_EQ(16, YGNodeLayoutGetTop(root_child0_child0_child1_child0)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child1_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child1_child0)); + + ASSERT_FLOAT_EQ(18, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(140, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(92, YGNodeLayoutGetHeight(root_child0_child0_child2)); + + ASSERT_FLOAT_EQ(16, YGNodeLayoutGetLeft(root_child0_child0_child2_child0)); + ASSERT_FLOAT_EQ(16, YGNodeLayoutGetTop(root_child0_child0_child2_child0)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child2_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child2_child0)); + + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(215, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(301, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(4, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(5, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(202, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(295, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(15, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(21, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(166, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(244, YGNodeLayoutGetHeight(root_child0_child0)); + + ASSERT_FLOAT_EQ(111, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(29, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(40, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(92, YGNodeLayoutGetHeight(root_child0_child0_child0)); + + ASSERT_FLOAT_EQ(-77, YGNodeLayoutGetLeft(root_child0_child0_child0_child0)); + ASSERT_FLOAT_EQ(16, YGNodeLayoutGetTop(root_child0_child0_child0_child0)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0_child0)); + + ASSERT_FLOAT_EQ(131, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(29, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(92, YGNodeLayoutGetHeight(root_child0_child0_child1)); + + ASSERT_FLOAT_EQ(-97, YGNodeLayoutGetLeft(root_child0_child0_child1_child0)); + ASSERT_FLOAT_EQ(16, YGNodeLayoutGetTop(root_child0_child0_child1_child0)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child1_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child1_child0)); + + ASSERT_FLOAT_EQ(131, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(140, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(92, YGNodeLayoutGetHeight(root_child0_child0_child2)); + + ASSERT_FLOAT_EQ(-97, YGNodeLayoutGetLeft(root_child0_child0_child2_child0)); + ASSERT_FLOAT_EQ(16, YGNodeLayoutGetTop(root_child0_child0_child2_child0)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child2_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child2_child0)); + + YGNodeFreeRecursive(root); + + YGConfigFree(config); +} + +TEST(YogaTest, static_position_justify_flex_start_position_set_amalgamation) { + const YGConfigRef config = YGConfigNew(); + YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); + + const YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); + + const YGNodeRef root_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root_child0, YGPositionTypeRelative); + YGNodeStyleSetMargin(root_child0, YGEdgeLeft, 4); + YGNodeStyleSetMargin(root_child0, YGEdgeTop, 5); + YGNodeStyleSetMargin(root_child0, YGEdgeRight, 9); + YGNodeStyleSetMargin(root_child0, YGEdgeBottom, 1); + YGNodeStyleSetPadding(root_child0, YGEdgeLeft, 2); + YGNodeStyleSetPadding(root_child0, YGEdgeTop, 9); + YGNodeStyleSetPadding(root_child0, YGEdgeRight, 11); + YGNodeStyleSetPadding(root_child0, YGEdgeBottom, 13); + YGNodeStyleSetBorder(root_child0, YGEdgeLeft, 5); + YGNodeStyleSetBorder(root_child0, YGEdgeTop, 6); + YGNodeStyleSetBorder(root_child0, YGEdgeRight, 7); + YGNodeStyleSetBorder(root_child0, YGEdgeBottom, 8); + YGNodeInsertChild(root, root_child0, 0); + + const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeLeft, 8); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeTop, 6); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeRight, 3); + YGNodeStyleSetMargin(root_child0_child0, YGEdgeBottom, 9); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeLeft, 1); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeTop, 7); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeRight, 9); + YGNodeStyleSetPadding(root_child0_child0, YGEdgeBottom, 4); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeLeft, 8); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeTop, 10); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeRight, 2); + YGNodeStyleSetBorder(root_child0_child0, YGEdgeBottom, 1); + 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, YGEdgeRight, 30); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeLeft, 9); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeTop, 12); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeRight, 4); + YGNodeStyleSetMargin(root_child0_child0_child0, YGEdgeBottom, 7); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeLeft, 5); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeTop, 3); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeRight, 8); + YGNodeStyleSetPadding(root_child0_child0_child0, YGEdgeBottom, 10); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeLeft, 2); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeTop, 1); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeRight, 5); + YGNodeStyleSetBorder(root_child0_child0_child0, YGEdgeBottom, 9); + YGNodeStyleSetWidthPercent(root_child0_child0_child0, 21); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0); + + const YGNodeRef root_child0_child0_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root_child0_child0_child0_child0, YGPositionTypeRelative); + YGNodeStyleSetMargin(root_child0_child0_child0_child0, YGEdgeLeft, 9); + YGNodeStyleSetMargin(root_child0_child0_child0_child0, YGEdgeTop, 12); + YGNodeStyleSetMargin(root_child0_child0_child0_child0, YGEdgeRight, 4); + YGNodeStyleSetMargin(root_child0_child0_child0_child0, YGEdgeBottom, 7); + YGNodeStyleSetPadding(root_child0_child0_child0_child0, YGEdgeLeft, 5); + YGNodeStyleSetPadding(root_child0_child0_child0_child0, YGEdgeTop, 3); + YGNodeStyleSetPadding(root_child0_child0_child0_child0, YGEdgeRight, 8); + YGNodeStyleSetPadding(root_child0_child0_child0_child0, YGEdgeBottom, 10); + YGNodeStyleSetBorder(root_child0_child0_child0_child0, YGEdgeLeft, 2); + YGNodeStyleSetBorder(root_child0_child0_child0_child0, YGEdgeTop, 1); + YGNodeStyleSetBorder(root_child0_child0_child0_child0, YGEdgeRight, 5); + YGNodeStyleSetBorder(root_child0_child0_child0_child0, YGEdgeBottom, 9); + YGNodeStyleSetWidth(root_child0_child0_child0_child0, 100); + YGNodeStyleSetHeight(root_child0_child0_child0_child0, 50); + YGNodeInsertChild(root_child0_child0_child0, root_child0_child0_child0_child0, 0); + + const YGNodeRef root_child0_child0_child1 = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root_child0_child0_child1, YGPositionTypeRelative); + YGNodeStyleSetMargin(root_child0_child0_child1, YGEdgeLeft, 9); + YGNodeStyleSetMargin(root_child0_child0_child1, YGEdgeTop, 12); + YGNodeStyleSetMargin(root_child0_child0_child1, YGEdgeRight, 4); + YGNodeStyleSetMargin(root_child0_child0_child1, YGEdgeBottom, 7); + YGNodeStyleSetPadding(root_child0_child0_child1, YGEdgeLeft, 5); + YGNodeStyleSetPadding(root_child0_child0_child1, YGEdgeTop, 3); + YGNodeStyleSetPadding(root_child0_child0_child1, YGEdgeRight, 8); + YGNodeStyleSetPadding(root_child0_child0_child1, YGEdgeBottom, 10); + YGNodeStyleSetBorder(root_child0_child0_child1, YGEdgeLeft, 2); + YGNodeStyleSetBorder(root_child0_child0_child1, YGEdgeTop, 1); + YGNodeStyleSetBorder(root_child0_child0_child1, YGEdgeRight, 5); + YGNodeStyleSetBorder(root_child0_child0_child1, YGEdgeBottom, 9); + YGNodeStyleSetWidthPercent(root_child0_child0_child1, 10); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child1, 1); + + const YGNodeRef root_child0_child0_child1_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root_child0_child0_child1_child0, YGPositionTypeRelative); + YGNodeStyleSetMargin(root_child0_child0_child1_child0, YGEdgeLeft, 9); + YGNodeStyleSetMargin(root_child0_child0_child1_child0, YGEdgeTop, 12); + YGNodeStyleSetMargin(root_child0_child0_child1_child0, YGEdgeRight, 4); + YGNodeStyleSetMargin(root_child0_child0_child1_child0, YGEdgeBottom, 7); + YGNodeStyleSetPadding(root_child0_child0_child1_child0, YGEdgeLeft, 5); + YGNodeStyleSetPadding(root_child0_child0_child1_child0, YGEdgeTop, 3); + YGNodeStyleSetPadding(root_child0_child0_child1_child0, YGEdgeRight, 8); + YGNodeStyleSetPadding(root_child0_child0_child1_child0, YGEdgeBottom, 10); + YGNodeStyleSetBorder(root_child0_child0_child1_child0, YGEdgeLeft, 2); + YGNodeStyleSetBorder(root_child0_child0_child1_child0, YGEdgeTop, 1); + YGNodeStyleSetBorder(root_child0_child0_child1_child0, YGEdgeRight, 5); + YGNodeStyleSetBorder(root_child0_child0_child1_child0, YGEdgeBottom, 9); + YGNodeStyleSetWidth(root_child0_child0_child1_child0, 100); + YGNodeStyleSetHeight(root_child0_child0_child1_child0, 50); + YGNodeInsertChild(root_child0_child0_child1, root_child0_child0_child1_child0, 0); + + const YGNodeRef root_child0_child0_child2 = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root_child0_child0_child2, YGPositionTypeRelative); + YGNodeStyleSetMargin(root_child0_child0_child2, YGEdgeLeft, 9); + YGNodeStyleSetMargin(root_child0_child0_child2, YGEdgeTop, 12); + YGNodeStyleSetMargin(root_child0_child0_child2, YGEdgeRight, 4); + YGNodeStyleSetMargin(root_child0_child0_child2, YGEdgeBottom, 7); + YGNodeStyleSetPadding(root_child0_child0_child2, YGEdgeLeft, 5); + YGNodeStyleSetPadding(root_child0_child0_child2, YGEdgeTop, 3); + YGNodeStyleSetPadding(root_child0_child0_child2, YGEdgeRight, 8); + YGNodeStyleSetPadding(root_child0_child0_child2, YGEdgeBottom, 10); + YGNodeStyleSetBorder(root_child0_child0_child2, YGEdgeLeft, 2); + YGNodeStyleSetBorder(root_child0_child0_child2, YGEdgeTop, 1); + YGNodeStyleSetBorder(root_child0_child0_child2, YGEdgeRight, 5); + YGNodeStyleSetBorder(root_child0_child0_child2, YGEdgeBottom, 9); + YGNodeStyleSetWidthPercent(root_child0_child0_child2, 10); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child2, 2); + + const YGNodeRef root_child0_child0_child2_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root_child0_child0_child2_child0, YGPositionTypeRelative); + YGNodeStyleSetMargin(root_child0_child0_child2_child0, YGEdgeLeft, 9); + YGNodeStyleSetMargin(root_child0_child0_child2_child0, YGEdgeTop, 12); + YGNodeStyleSetMargin(root_child0_child0_child2_child0, YGEdgeRight, 4); + YGNodeStyleSetMargin(root_child0_child0_child2_child0, YGEdgeBottom, 7); + YGNodeStyleSetPadding(root_child0_child0_child2_child0, YGEdgeLeft, 5); + YGNodeStyleSetPadding(root_child0_child0_child2_child0, YGEdgeTop, 3); + YGNodeStyleSetPadding(root_child0_child0_child2_child0, YGEdgeRight, 8); + YGNodeStyleSetPadding(root_child0_child0_child2_child0, YGEdgeBottom, 10); + YGNodeStyleSetBorder(root_child0_child0_child2_child0, YGEdgeLeft, 2); + YGNodeStyleSetBorder(root_child0_child0_child2_child0, YGEdgeTop, 1); + YGNodeStyleSetBorder(root_child0_child0_child2_child0, YGEdgeRight, 5); + YGNodeStyleSetBorder(root_child0_child0_child2_child0, YGEdgeBottom, 9); + YGNodeStyleSetWidth(root_child0_child0_child2_child0, 100); + YGNodeStyleSetHeight(root_child0_child0_child2_child0, 50); + YGNodeInsertChild(root_child0_child0_child2, root_child0_child0_child2_child0, 0); + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(215, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(301, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(4, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(5, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(202, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(295, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(15, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(21, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(166, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(244, YGNodeLayoutGetHeight(root_child0_child0)); + + ASSERT_FLOAT_EQ(106, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(29, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(40, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(92, YGNodeLayoutGetHeight(root_child0_child0_child0)); + + ASSERT_FLOAT_EQ(16, YGNodeLayoutGetLeft(root_child0_child0_child0_child0)); + ASSERT_FLOAT_EQ(16, YGNodeLayoutGetTop(root_child0_child0_child0_child0)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0_child0)); + + ASSERT_FLOAT_EQ(18, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(29, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(92, YGNodeLayoutGetHeight(root_child0_child0_child1)); + + ASSERT_FLOAT_EQ(16, YGNodeLayoutGetLeft(root_child0_child0_child1_child0)); + ASSERT_FLOAT_EQ(16, YGNodeLayoutGetTop(root_child0_child0_child1_child0)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child1_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child1_child0)); + + ASSERT_FLOAT_EQ(18, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(140, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(92, YGNodeLayoutGetHeight(root_child0_child0_child2)); + + ASSERT_FLOAT_EQ(16, YGNodeLayoutGetLeft(root_child0_child0_child2_child0)); + ASSERT_FLOAT_EQ(16, YGNodeLayoutGetTop(root_child0_child0_child2_child0)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child2_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child2_child0)); + + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(215, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(301, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(4, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(5, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(202, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(295, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(15, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(21, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(166, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(244, YGNodeLayoutGetHeight(root_child0_child0)); + + ASSERT_FLOAT_EQ(106, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(29, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(40, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(92, YGNodeLayoutGetHeight(root_child0_child0_child0)); + + ASSERT_FLOAT_EQ(-77, YGNodeLayoutGetLeft(root_child0_child0_child0_child0)); + ASSERT_FLOAT_EQ(16, YGNodeLayoutGetTop(root_child0_child0_child0_child0)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child0_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0_child0)); + + ASSERT_FLOAT_EQ(131, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(29, YGNodeLayoutGetTop(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(92, YGNodeLayoutGetHeight(root_child0_child0_child1)); + + ASSERT_FLOAT_EQ(-97, YGNodeLayoutGetLeft(root_child0_child0_child1_child0)); + ASSERT_FLOAT_EQ(16, YGNodeLayoutGetTop(root_child0_child0_child1_child0)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child1_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child1_child0)); + + ASSERT_FLOAT_EQ(131, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(140, YGNodeLayoutGetTop(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(92, YGNodeLayoutGetHeight(root_child0_child0_child2)); + + ASSERT_FLOAT_EQ(-97, YGNodeLayoutGetLeft(root_child0_child0_child2_child0)); + ASSERT_FLOAT_EQ(16, YGNodeLayoutGetTop(root_child0_child0_child2_child0)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0_child2_child0)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child2_child0)); + + YGNodeFreeRecursive(root); + + YGConfigFree(config); +} diff --git a/yoga/algorithm/AbsoluteLayout.cpp b/yoga/algorithm/AbsoluteLayout.cpp index 8a041b5c32..f4082cb55e 100644 --- a/yoga/algorithm/AbsoluteLayout.cpp +++ b/yoga/algorithm/AbsoluteLayout.cpp @@ -72,7 +72,8 @@ static void alignAbsoluteChild( case Align::Stretch: case Align::SpaceEvenly: child->setLayoutPosition( - parent->getFlexStartBorder(crossAxis, direction) + + parent->getLayout().border(flexStartEdge(crossAxis)) + + parent->getLayout().padding(flexStartEdge(crossAxis)) + child->getFlexStartMargin( crossAxis, direction, containingBlockWidth), flexStartEdge(crossAxis));