From 5e6dd8fdb76945b895aefa6b3b35df3f31ecc74f Mon Sep 17 00:00:00 2001 From: Joe Vilches Date: Thu, 7 Dec 2023 14:39:14 -0800 Subject: [PATCH 1/5] Make positionAbsoluteChild the sole place that matters when determining absolute node's position (#1481) Summary: X-link: https://github.com/facebook/react-native/pull/41684 Absolute nodes can be laid out by themselves and do not have to care about what is happening to their siblings. Because of this we can make `positionAbsoluteChild` the sole place where we handle this logic. Right now that is scattered around algorithm with many `if (child is absolute)` cases everywhere. This makes implementing position static a lot harder since we are relying on the CB to do all this work, not the parent. With this change the only time we set position for an absolute node and it matter (i.e. not overwritten) is in `positionAbsoluteChild` Reviewed By: NickGerleman Differential Revision: D51290723 --- enums.py | 3 + java/com/facebook/yoga/YogaErrata.java | 2 + javascript/src/generated/YGEnums.ts | 2 + yoga/YGEnums.cpp | 2 + yoga/YGEnums.h | 1 + yoga/algorithm/AbsoluteLayout.cpp | 212 ++++++++++++++++++++++--- yoga/algorithm/CalculateLayout.h | 17 +- yoga/enums/Errata.h | 1 + 8 files changed, 215 insertions(+), 25 deletions(-) diff --git a/enums.py b/enums.py index c7c3b29b0e..7e2a918edc 100755 --- a/enums.py +++ b/enums.py @@ -72,6 +72,9 @@ ("StartingEndingEdgeFromFlexDirection", 1 << 1), # Position: static behaves like position: relative within Yoga ("PositionStaticBehavesLikeRelative", 1 << 2), + # Positioning of absolute nodes will have various bugs related to + # justification, alignment, and insets + ("AbsolutePositioning", 1 << 3), # Enable all incorrect behavior (preserve compatibility) ("All", 0x7FFFFFFF), # Enable all errata except for "StretchFlexBasis" (Defaults behavior diff --git a/java/com/facebook/yoga/YogaErrata.java b/java/com/facebook/yoga/YogaErrata.java index 99f53f5a81..04307de408 100644 --- a/java/com/facebook/yoga/YogaErrata.java +++ b/java/com/facebook/yoga/YogaErrata.java @@ -14,6 +14,7 @@ public enum YogaErrata { STRETCH_FLEX_BASIS(1), STARTING_ENDING_EDGE_FROM_FLEX_DIRECTION(2), POSITION_STATIC_BEHAVES_LIKE_RELATIVE(4), + ABSOLUTE_POSITIONING(8), ALL(2147483647), CLASSIC(2147483646); @@ -33,6 +34,7 @@ public static YogaErrata fromInt(int value) { case 1: return STRETCH_FLEX_BASIS; case 2: return STARTING_ENDING_EDGE_FROM_FLEX_DIRECTION; case 4: return POSITION_STATIC_BEHAVES_LIKE_RELATIVE; + case 8: return ABSOLUTE_POSITIONING; case 2147483647: return ALL; case 2147483646: return CLASSIC; default: throw new IllegalArgumentException("Unknown enum value: " + value); diff --git a/javascript/src/generated/YGEnums.ts b/javascript/src/generated/YGEnums.ts index af4dc5f46f..2c7a6a57eb 100644 --- a/javascript/src/generated/YGEnums.ts +++ b/javascript/src/generated/YGEnums.ts @@ -52,6 +52,7 @@ export enum Errata { StretchFlexBasis = 1, StartingEndingEdgeFromFlexDirection = 2, PositionStaticBehavesLikeRelative = 4, + AbsolutePositioning = 8, All = 2147483647, Classic = 2147483646, } @@ -164,6 +165,7 @@ const constants = { ERRATA_STRETCH_FLEX_BASIS: Errata.StretchFlexBasis, ERRATA_STARTING_ENDING_EDGE_FROM_FLEX_DIRECTION: Errata.StartingEndingEdgeFromFlexDirection, ERRATA_POSITION_STATIC_BEHAVES_LIKE_RELATIVE: Errata.PositionStaticBehavesLikeRelative, + ERRATA_ABSOLUTE_POSITIONING: Errata.AbsolutePositioning, ERRATA_ALL: Errata.All, ERRATA_CLASSIC: Errata.Classic, EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS: ExperimentalFeature.WebFlexBasis, diff --git a/yoga/YGEnums.cpp b/yoga/YGEnums.cpp index 04fd7be933..d14db83cbf 100644 --- a/yoga/YGEnums.cpp +++ b/yoga/YGEnums.cpp @@ -99,6 +99,8 @@ const char* YGErrataToString(const YGErrata value) { return "starting-ending-edge-from-flex-direction"; case YGErrataPositionStaticBehavesLikeRelative: return "position-static-behaves-like-relative"; + case YGErrataAbsolutePositioning: + return "absolute-positioning"; case YGErrataAll: return "all"; case YGErrataClassic: diff --git a/yoga/YGEnums.h b/yoga/YGEnums.h index e0454394da..e6076decef 100644 --- a/yoga/YGEnums.h +++ b/yoga/YGEnums.h @@ -58,6 +58,7 @@ YG_ENUM_DECL( YGErrataStretchFlexBasis = 1, YGErrataStartingEndingEdgeFromFlexDirection = 2, YGErrataPositionStaticBehavesLikeRelative = 4, + YGErrataAbsolutePositioning = 8, YGErrataAll = 2147483647, YGErrataClassic = 2147483646) YG_DEFINE_ENUM_FLAG_OPERATORS(YGErrata) diff --git a/yoga/algorithm/AbsoluteLayout.cpp b/yoga/algorithm/AbsoluteLayout.cpp index bf3a335435..22574cf805 100644 --- a/yoga/algorithm/AbsoluteLayout.cpp +++ b/yoga/algorithm/AbsoluteLayout.cpp @@ -13,23 +13,88 @@ namespace facebook::yoga { -/* - * Absolutely positioned nodes do not participate in flex layout and thus their - * positions can be determined independently from the rest of their siblings. - * For each axis there are essentially two cases: - * - * 1) The node has insets defined. In this case we can just use these to - * determine the position of the node. - * 2) The node does not have insets defined. In this case we look at the style - * of the parent to position the node. Things like justify content and - * align content will move absolute children around. If none of these - * special properties are defined, the child is positioned at the start - * (defined by flex direction) of the leading flex line. - * - * This function does that positioning for the given axis. The spec has more - * information on this topic: https://www.w3.org/TR/css-flexbox-1/#abspos-items - */ -static void positionAbsoluteChild( +static void justifyAbsoluteChild( + const yoga::Node* const parent, + yoga::Node* child, + const Direction direction, + const FlexDirection mainAxis, + const float containingBlockWidth) { + const Justify parentJustifyContent = parent->getStyle().justifyContent(); + switch (parentJustifyContent) { + case Justify::FlexStart: + case Justify::SpaceBetween: + child->setLayoutPosition( + child->getFlexStartMargin(mainAxis, direction, containingBlockWidth) + + parent->getFlexStartBorder(mainAxis, direction), + flexStartEdge(mainAxis)); + break; + case Justify::FlexEnd: + child->setLayoutPosition( + (parent->getLayout().measuredDimension(dimension(mainAxis)) - + child->getLayout().measuredDimension(dimension(mainAxis))), + flexStartEdge(mainAxis)); + break; + case Justify::Center: + case Justify::SpaceAround: + case Justify::SpaceEvenly: + child->setLayoutPosition( + (parent->getLayout().measuredDimension(dimension(mainAxis)) - + child->getLayout().measuredDimension(dimension(mainAxis))) / + 2.0f, + flexStartEdge(mainAxis)); + break; + } +} + +static void alignAbsoluteChild( + const yoga::Node* const parent, + yoga::Node* child, + const Direction direction, + const FlexDirection crossAxis, + const float containingBlockWidth) { + Align itemAlign = resolveChildAlignment(parent, child); + const Wrap parentWrap = parent->getStyle().flexWrap(); + if (parentWrap == Wrap::WrapReverse) { + if (itemAlign == Align::FlexEnd) { + itemAlign = Align::FlexStart; + } else if (itemAlign != Align::Center) { + itemAlign = Align::FlexEnd; + } + } + + switch (itemAlign) { + case Align::Auto: + case Align::FlexStart: + case Align::Baseline: + case Align::SpaceAround: + case Align::SpaceBetween: + case Align::Stretch: + case Align::SpaceEvenly: + child->setLayoutPosition( + parent->getFlexStartBorder(crossAxis, direction) + + child->getFlexStartMargin( + crossAxis, direction, containingBlockWidth), + flexStartEdge(crossAxis)); + break; + case Align::FlexEnd: + child->setLayoutPosition( + (parent->getLayout().measuredDimension(dimension(crossAxis)) - + child->getLayout().measuredDimension(dimension(crossAxis))), + flexStartEdge(crossAxis)); + break; + case Align::Center: + child->setLayoutPosition( + (parent->getLayout().measuredDimension(dimension(crossAxis)) - + child->getLayout().measuredDimension(dimension(crossAxis))) / + 2.0f, + flexStartEdge(crossAxis)); + break; + } +} + +// To ensure no breaking changes, we preserve the legacy way of positioning +// absolute children and determine if we should use it using an errata. +static void positionAbsoluteChildLegacy( const yoga::Node* const containingNode, const yoga::Node* const parent, yoga::Node* child, @@ -93,6 +158,109 @@ static void positionAbsoluteChild( } } +/* + * Absolutely positioned nodes do not participate in flex layout and thus their + * positions can be determined independently from the rest of their siblings. + * For each axis there are essentially two cases: + * + * 1) The node has insets defined. In this case we can just use these to + * determine the position of the node. + * 2) The node does not have insets defined. In this case we look at the style + * of the parent to position the node. Things like justify content and + * align content will move absolute children around. If none of these + * special properties are defined, the child is positioned at the start + * (defined by flex direction) of the leading flex line. + * + * This function does that positioning for the given axis. The spec has more + * information on this topic: https://www.w3.org/TR/css-flexbox-1/#abspos-items + */ +static void positionAbsoluteChildImpl( + const yoga::Node* const containingNode, + const yoga::Node* const parent, + yoga::Node* child, + const Direction direction, + const FlexDirection axis, + const bool isMainAxis, + const float containingBlockWidth, + const float containingBlockHeight) { + const bool isAxisRow = isRow(axis); + const float containingBlockSize = + isAxisRow ? containingBlockWidth : containingBlockHeight; + + // The inline-start position takes priority over the end position in the case + // that they are both set and the node has a fixed width. Thus we only have 2 + // cases here: if inline-start is defined and if inline-end is defined. + // + // Despite checking inline-start to honor prioritization of insets, we write + // to the flex-start edge because this algorithm works by positioning on the + // flex-start edge and then filling in the flex-end direction at the end if + // necessary. + if (child->isInlineStartPositionDefined(axis, direction)) { + const float positionRelativeToInlineStart = + child->getInlineStartPosition( + axis, + direction, + containingNode->getLayout().measuredDimension(dimension(axis))) + + containingNode->getInlineStartBorder(axis, direction) + + child->getInlineStartMargin(axis, direction, containingBlockSize); + const float positionRelativeToFlexStart = + inlineStartEdge(axis, direction) != flexStartEdge(axis) + ? getPositionOfOppositeEdge( + positionRelativeToInlineStart, axis, containingNode, child) + : positionRelativeToInlineStart; + + child->setLayoutPosition(positionRelativeToFlexStart, flexStartEdge(axis)); + } else if (child->isInlineEndPositionDefined(axis, direction)) { + const float positionRelativeToInlineStart = + containingNode->getLayout().measuredDimension(dimension(axis)) - + child->getLayout().measuredDimension(dimension(axis)) - + containingNode->getInlineEndBorder(axis, direction) - + child->getInlineEndMargin(axis, direction, containingBlockSize) - + child->getInlineEndPosition(axis, direction, containingBlockSize); + const float positionRelativeToFlexStart = + inlineStartEdge(axis, direction) != flexStartEdge(axis) + ? getPositionOfOppositeEdge( + positionRelativeToInlineStart, axis, containingNode, child) + : positionRelativeToInlineStart; + + child->setLayoutPosition(positionRelativeToFlexStart, flexStartEdge(axis)); + } else { + isMainAxis ? justifyAbsoluteChild( + parent, child, direction, axis, containingBlockWidth) + : alignAbsoluteChild( + parent, child, direction, axis, containingBlockWidth); + } +} + +static void positionAbsoluteChild( + const yoga::Node* const containingNode, + const yoga::Node* const parent, + yoga::Node* child, + const Direction direction, + const FlexDirection axis, + const bool isMainAxis, + const float containingBlockWidth, + const float containingBlockHeight) { + child->hasErrata(Errata::AbsolutePositioning) ? positionAbsoluteChildLegacy( + containingNode, + parent, + child, + direction, + axis, + isMainAxis, + containingBlockWidth, + containingBlockHeight) + : positionAbsoluteChildImpl( + containingNode, + parent, + child, + direction, + axis, + isMainAxis, + containingBlockWidth, + containingBlockHeight); +} + void layoutAbsoluteChild( const yoga::Node* const containingNode, const yoga::Node* const node, @@ -155,8 +323,8 @@ void layoutAbsoluteChild( .unwrap() + marginColumn; } else { - // If the child doesn't have a specified height, compute the height based on - // the top/bottom offsets if they're defined. + // If the child doesn't have a specified height, compute the height based + // on the top/bottom offsets if they're defined. if (child->isFlexStartPositionDefined(FlexDirection::Column, direction) && child->isFlexEndPositionDefined(FlexDirection::Column, direction)) { childHeight = @@ -203,9 +371,9 @@ void layoutAbsoluteChild( : SizingMode::StretchFit; // If the size of the owner is defined then try to constrain the absolute - // child to that size as well. This allows text within the absolute child to - // wrap to the size of its owner. This is the same behavior as many browsers - // implement. + // child to that size as well. This allows text within the absolute child + // to wrap to the size of its owner. This is the same behavior as many + // browsers implement. if (!isMainAxisRow && yoga::isUndefined(childWidth) && widthMode != SizingMode::MaxContent && yoga::isDefined(containingBlockWidth) && containingBlockWidth > 0) { diff --git a/yoga/algorithm/CalculateLayout.h b/yoga/algorithm/CalculateLayout.h index 26f4aa47a9..955cbdbb59 100644 --- a/yoga/algorithm/CalculateLayout.h +++ b/yoga/algorithm/CalculateLayout.h @@ -35,14 +35,25 @@ bool calculateLayoutInternal( const uint32_t depth, const uint32_t generationCount); +// Given an offset to an edge, returns the offset to the opposite edge on the +// same axis. This assumes that the width/height of both nodes is determined at +// this point. +inline float getPositionOfOppositeEdge( + float position, + FlexDirection axis, + const yoga::Node* const containingNode, + const yoga::Node* const node) { + return containingNode->getLayout().measuredDimension(dimension(axis)) - + node->getLayout().measuredDimension(dimension(axis)) - position; +} + inline void setChildTrailingPosition( const yoga::Node* const node, yoga::Node* const child, const FlexDirection axis) { - const float size = child->getLayout().measuredDimension(dimension(axis)); child->setLayoutPosition( - node->getLayout().measuredDimension(dimension(axis)) - size - - child->getLayout().position(flexStartEdge(axis)), + getPositionOfOppositeEdge( + child->getLayout().position(flexStartEdge(axis)), axis, node, child), flexEndEdge(axis)); } diff --git a/yoga/enums/Errata.h b/yoga/enums/Errata.h index 134f5fffc0..5bda0c0b9c 100644 --- a/yoga/enums/Errata.h +++ b/yoga/enums/Errata.h @@ -20,6 +20,7 @@ enum class Errata : uint32_t { StretchFlexBasis = YGErrataStretchFlexBasis, StartingEndingEdgeFromFlexDirection = YGErrataStartingEndingEdgeFromFlexDirection, PositionStaticBehavesLikeRelative = YGErrataPositionStaticBehavesLikeRelative, + AbsolutePositioning = YGErrataAbsolutePositioning, All = YGErrataAll, Classic = YGErrataClassic, }; From 340a792a95ebb288b3f8d7acaf1027edc478a31b Mon Sep 17 00:00:00 2001 From: Joe Vilches Date: Thu, 7 Dec 2023 14:39:14 -0800 Subject: [PATCH 2/5] Make position static behave like position static (#1482) Summary: X-link: https://github.com/facebook/react-native/pull/41685 This is the final step (that I know of) to get the core features of static working. Here we turn on all of the tests and pass down the correct owner size for the call to `calculateLayoutInternal` that is in `layoutAbsoluteChild` Reviewed By: NickGerleman Differential Revision: D51293606 --- gentest/fixtures/YGStaticPositionTest.html | 68 +++++++++---------- .../facebook/yoga/YGStaticPositionTest.java | 34 ---------- .../generated/YGStaticPositionTest.test.ts | 68 +++++++++---------- tests/generated/YGStaticPositionTest.cpp | 68 ------------------- yoga/algorithm/AbsoluteLayout.cpp | 8 +-- 5 files changed, 72 insertions(+), 174 deletions(-) diff --git a/gentest/fixtures/YGStaticPositionTest.html b/gentest/fixtures/YGStaticPositionTest.html index 30b781172b..3cb5e55599 100644 --- a/gentest/fixtures/YGStaticPositionTest.html +++ b/gentest/fixtures/YGStaticPositionTest.html @@ -10,7 +10,7 @@ -
+
@@ -19,7 +19,7 @@
-
+
@@ -34,7 +34,7 @@
-
+
@@ -43,7 +43,7 @@
-
+
@@ -52,7 +52,7 @@
-
+
@@ -61,7 +61,7 @@
-
+
@@ -70,7 +70,7 @@
-
+
@@ -79,7 +79,7 @@
-
+
@@ -88,7 +88,7 @@
-
+
@@ -97,7 +97,7 @@
-
+
@@ -106,7 +106,7 @@
-
+
@@ -115,7 +115,7 @@
-
+
@@ -124,7 +124,7 @@
-
+
@@ -133,7 +133,7 @@
-
+
@@ -142,7 +142,7 @@
-
+
@@ -151,7 +151,7 @@
-
+
@@ -160,7 +160,7 @@
-
+
@@ -169,7 +169,7 @@
-
+
@@ -178,7 +178,7 @@
-
+
@@ -187,7 +187,7 @@
-
+
@@ -196,7 +196,7 @@
-
+
@@ -205,7 +205,7 @@
-
+
@@ -214,7 +214,7 @@
-
+
@@ -223,7 +223,7 @@
-
+
@@ -232,7 +232,7 @@
-
+
@@ -241,7 +241,7 @@
-
+
@@ -250,7 +250,7 @@
-
+
@@ -259,7 +259,7 @@
-
+
@@ -268,7 +268,7 @@
-
+
@@ -277,7 +277,7 @@
-
+
@@ -286,7 +286,7 @@
-
+
@@ -295,7 +295,7 @@
-
+
@@ -311,14 +311,14 @@
-
+
-
+
diff --git a/java/tests/com/facebook/yoga/YGStaticPositionTest.java b/java/tests/com/facebook/yoga/YGStaticPositionTest.java index f41d5dd06e..efa19ace25 100644 --- a/java/tests/com/facebook/yoga/YGStaticPositionTest.java +++ b/java/tests/com/facebook/yoga/YGStaticPositionTest.java @@ -110,7 +110,6 @@ public void test_static_position_insets_have_no_effect_right_bottom() { } @Test - @Ignore public void test_static_position_absolute_child_insets_relative_to_positioned_ancestor() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -185,7 +184,6 @@ public void test_static_position_absolute_child_insets_relative_to_positioned_an } @Test - @Ignore public void test_static_position_absolute_child_insets_relative_to_positioned_ancestor_deep() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -311,7 +309,6 @@ public void test_static_position_absolute_child_insets_relative_to_positioned_an } @Test - @Ignore public void test_static_position_absolute_child_width_percentage() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -383,7 +380,6 @@ public void test_static_position_absolute_child_width_percentage() { } @Test - @Ignore public void test_static_position_relative_child_width_percentage() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -454,7 +450,6 @@ public void test_static_position_relative_child_width_percentage() { } @Test - @Ignore public void test_static_position_static_child_width_percentage() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -526,7 +521,6 @@ public void test_static_position_static_child_width_percentage() { } @Test - @Ignore public void test_static_position_absolute_child_height_percentage() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -598,7 +592,6 @@ public void test_static_position_absolute_child_height_percentage() { } @Test - @Ignore public void test_static_position_relative_child_height_percentage() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -669,7 +662,6 @@ public void test_static_position_relative_child_height_percentage() { } @Test - @Ignore public void test_static_position_static_child_height_percentage() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -741,7 +733,6 @@ public void test_static_position_static_child_height_percentage() { } @Test - @Ignore public void test_static_position_absolute_child_left_percentage() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -814,7 +805,6 @@ public void test_static_position_absolute_child_left_percentage() { } @Test - @Ignore public void test_static_position_relative_child_left_percentage() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -886,7 +876,6 @@ public void test_static_position_relative_child_left_percentage() { } @Test - @Ignore public void test_static_position_static_child_left_percentage() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -959,7 +948,6 @@ public void test_static_position_static_child_left_percentage() { } @Test - @Ignore public void test_static_position_absolute_child_right_percentage() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -1032,7 +1020,6 @@ public void test_static_position_absolute_child_right_percentage() { } @Test - @Ignore public void test_static_position_relative_child_right_percentage() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -1104,7 +1091,6 @@ public void test_static_position_relative_child_right_percentage() { } @Test - @Ignore public void test_static_position_static_child_right_percentage() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -1177,7 +1163,6 @@ public void test_static_position_static_child_right_percentage() { } @Test - @Ignore public void test_static_position_absolute_child_top_percentage() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -1250,7 +1235,6 @@ public void test_static_position_absolute_child_top_percentage() { } @Test - @Ignore public void test_static_position_relative_child_top_percentage() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -1322,7 +1306,6 @@ public void test_static_position_relative_child_top_percentage() { } @Test - @Ignore public void test_static_position_static_child_top_percentage() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -1395,7 +1378,6 @@ public void test_static_position_static_child_top_percentage() { } @Test - @Ignore public void test_static_position_absolute_child_bottom_percentage() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -1468,7 +1450,6 @@ public void test_static_position_absolute_child_bottom_percentage() { } @Test - @Ignore public void test_static_position_relative_child_bottom_percentage() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -1540,7 +1521,6 @@ public void test_static_position_relative_child_bottom_percentage() { } @Test - @Ignore public void test_static_position_static_child_bottom_percentage() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -1613,7 +1593,6 @@ public void test_static_position_static_child_bottom_percentage() { } @Test - @Ignore public void test_static_position_absolute_child_margin_percentage() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -1689,7 +1668,6 @@ public void test_static_position_absolute_child_margin_percentage() { } @Test - @Ignore public void test_static_position_relative_child_margin_percentage() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -1764,7 +1742,6 @@ public void test_static_position_relative_child_margin_percentage() { } @Test - @Ignore public void test_static_position_static_child_margin_percentage() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -1840,7 +1817,6 @@ public void test_static_position_static_child_margin_percentage() { } @Test - @Ignore public void test_static_position_absolute_child_padding_percentage() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -1916,7 +1892,6 @@ public void test_static_position_absolute_child_padding_percentage() { } @Test - @Ignore public void test_static_position_relative_child_padding_percentage() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -1991,7 +1966,6 @@ public void test_static_position_relative_child_padding_percentage() { } @Test - @Ignore public void test_static_position_static_child_padding_percentage() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -2067,7 +2041,6 @@ public void test_static_position_static_child_padding_percentage() { } @Test - @Ignore public void test_static_position_absolute_child_border_percentage() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -2139,7 +2112,6 @@ public void test_static_position_absolute_child_border_percentage() { } @Test - @Ignore public void test_static_position_relative_child_border_percentage() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -2210,7 +2182,6 @@ public void test_static_position_relative_child_border_percentage() { } @Test - @Ignore public void test_static_position_static_child_border_percentage() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -2282,7 +2253,6 @@ public void test_static_position_static_child_border_percentage() { } @Test - @Ignore public void test_static_position_absolute_child_containing_block_padding_box() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -2358,7 +2328,6 @@ public void test_static_position_absolute_child_containing_block_padding_box() { } @Test - @Ignore public void test_static_position_relative_child_containing_block_padding_box() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -2433,7 +2402,6 @@ public void test_static_position_relative_child_containing_block_padding_box() { } @Test - @Ignore public void test_static_position_static_child_containing_block_padding_box() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -2569,7 +2537,6 @@ public void test_static_position_absolute_child_containing_block_content_box() { } @Test - @Ignore public void test_static_position_relative_child_containing_block_content_box() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -2628,7 +2595,6 @@ public void test_static_position_relative_child_containing_block_content_box() { } @Test - @Ignore public void test_static_position_static_child_containing_block_content_box() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); diff --git a/javascript/tests/generated/YGStaticPositionTest.test.ts b/javascript/tests/generated/YGStaticPositionTest.test.ts index 0084609542..023f8d28fb 100644 --- a/javascript/tests/generated/YGStaticPositionTest.test.ts +++ b/javascript/tests/generated/YGStaticPositionTest.test.ts @@ -121,7 +121,7 @@ test('static_position_insets_have_no_effect_right_bottom', () => { config.free(); } }); -test.skip('static_position_absolute_child_insets_relative_to_positioned_ancestor', () => { +test('static_position_absolute_child_insets_relative_to_positioned_ancestor', () => { const config = Yoga.Config.create(); let root; @@ -201,7 +201,7 @@ test.skip('static_position_absolute_child_insets_relative_to_positioned_ancestor config.free(); } }); -test.skip('static_position_absolute_child_insets_relative_to_positioned_ancestor_deep', () => { +test('static_position_absolute_child_insets_relative_to_positioned_ancestor_deep', () => { const config = Yoga.Config.create(); let root; @@ -332,7 +332,7 @@ test.skip('static_position_absolute_child_insets_relative_to_positioned_ancestor config.free(); } }); -test.skip('static_position_absolute_child_width_percentage', () => { +test('static_position_absolute_child_width_percentage', () => { const config = Yoga.Config.create(); let root; @@ -409,7 +409,7 @@ test.skip('static_position_absolute_child_width_percentage', () => { config.free(); } }); -test.skip('static_position_relative_child_width_percentage', () => { +test('static_position_relative_child_width_percentage', () => { const config = Yoga.Config.create(); let root; @@ -485,7 +485,7 @@ test.skip('static_position_relative_child_width_percentage', () => { config.free(); } }); -test.skip('static_position_static_child_width_percentage', () => { +test('static_position_static_child_width_percentage', () => { const config = Yoga.Config.create(); let root; @@ -562,7 +562,7 @@ test.skip('static_position_static_child_width_percentage', () => { config.free(); } }); -test.skip('static_position_absolute_child_height_percentage', () => { +test('static_position_absolute_child_height_percentage', () => { const config = Yoga.Config.create(); let root; @@ -639,7 +639,7 @@ test.skip('static_position_absolute_child_height_percentage', () => { config.free(); } }); -test.skip('static_position_relative_child_height_percentage', () => { +test('static_position_relative_child_height_percentage', () => { const config = Yoga.Config.create(); let root; @@ -715,7 +715,7 @@ test.skip('static_position_relative_child_height_percentage', () => { config.free(); } }); -test.skip('static_position_static_child_height_percentage', () => { +test('static_position_static_child_height_percentage', () => { const config = Yoga.Config.create(); let root; @@ -792,7 +792,7 @@ test.skip('static_position_static_child_height_percentage', () => { config.free(); } }); -test.skip('static_position_absolute_child_left_percentage', () => { +test('static_position_absolute_child_left_percentage', () => { const config = Yoga.Config.create(); let root; @@ -870,7 +870,7 @@ test.skip('static_position_absolute_child_left_percentage', () => { config.free(); } }); -test.skip('static_position_relative_child_left_percentage', () => { +test('static_position_relative_child_left_percentage', () => { const config = Yoga.Config.create(); let root; @@ -947,7 +947,7 @@ test.skip('static_position_relative_child_left_percentage', () => { config.free(); } }); -test.skip('static_position_static_child_left_percentage', () => { +test('static_position_static_child_left_percentage', () => { const config = Yoga.Config.create(); let root; @@ -1025,7 +1025,7 @@ test.skip('static_position_static_child_left_percentage', () => { config.free(); } }); -test.skip('static_position_absolute_child_right_percentage', () => { +test('static_position_absolute_child_right_percentage', () => { const config = Yoga.Config.create(); let root; @@ -1103,7 +1103,7 @@ test.skip('static_position_absolute_child_right_percentage', () => { config.free(); } }); -test.skip('static_position_relative_child_right_percentage', () => { +test('static_position_relative_child_right_percentage', () => { const config = Yoga.Config.create(); let root; @@ -1180,7 +1180,7 @@ test.skip('static_position_relative_child_right_percentage', () => { config.free(); } }); -test.skip('static_position_static_child_right_percentage', () => { +test('static_position_static_child_right_percentage', () => { const config = Yoga.Config.create(); let root; @@ -1258,7 +1258,7 @@ test.skip('static_position_static_child_right_percentage', () => { config.free(); } }); -test.skip('static_position_absolute_child_top_percentage', () => { +test('static_position_absolute_child_top_percentage', () => { const config = Yoga.Config.create(); let root; @@ -1336,7 +1336,7 @@ test.skip('static_position_absolute_child_top_percentage', () => { config.free(); } }); -test.skip('static_position_relative_child_top_percentage', () => { +test('static_position_relative_child_top_percentage', () => { const config = Yoga.Config.create(); let root; @@ -1413,7 +1413,7 @@ test.skip('static_position_relative_child_top_percentage', () => { config.free(); } }); -test.skip('static_position_static_child_top_percentage', () => { +test('static_position_static_child_top_percentage', () => { const config = Yoga.Config.create(); let root; @@ -1491,7 +1491,7 @@ test.skip('static_position_static_child_top_percentage', () => { config.free(); } }); -test.skip('static_position_absolute_child_bottom_percentage', () => { +test('static_position_absolute_child_bottom_percentage', () => { const config = Yoga.Config.create(); let root; @@ -1569,7 +1569,7 @@ test.skip('static_position_absolute_child_bottom_percentage', () => { config.free(); } }); -test.skip('static_position_relative_child_bottom_percentage', () => { +test('static_position_relative_child_bottom_percentage', () => { const config = Yoga.Config.create(); let root; @@ -1646,7 +1646,7 @@ test.skip('static_position_relative_child_bottom_percentage', () => { config.free(); } }); -test.skip('static_position_static_child_bottom_percentage', () => { +test('static_position_static_child_bottom_percentage', () => { const config = Yoga.Config.create(); let root; @@ -1724,7 +1724,7 @@ test.skip('static_position_static_child_bottom_percentage', () => { config.free(); } }); -test.skip('static_position_absolute_child_margin_percentage', () => { +test('static_position_absolute_child_margin_percentage', () => { const config = Yoga.Config.create(); let root; @@ -1805,7 +1805,7 @@ test.skip('static_position_absolute_child_margin_percentage', () => { config.free(); } }); -test.skip('static_position_relative_child_margin_percentage', () => { +test('static_position_relative_child_margin_percentage', () => { const config = Yoga.Config.create(); let root; @@ -1885,7 +1885,7 @@ test.skip('static_position_relative_child_margin_percentage', () => { config.free(); } }); -test.skip('static_position_static_child_margin_percentage', () => { +test('static_position_static_child_margin_percentage', () => { const config = Yoga.Config.create(); let root; @@ -1966,7 +1966,7 @@ test.skip('static_position_static_child_margin_percentage', () => { config.free(); } }); -test.skip('static_position_absolute_child_padding_percentage', () => { +test('static_position_absolute_child_padding_percentage', () => { const config = Yoga.Config.create(); let root; @@ -2047,7 +2047,7 @@ test.skip('static_position_absolute_child_padding_percentage', () => { config.free(); } }); -test.skip('static_position_relative_child_padding_percentage', () => { +test('static_position_relative_child_padding_percentage', () => { const config = Yoga.Config.create(); let root; @@ -2127,7 +2127,7 @@ test.skip('static_position_relative_child_padding_percentage', () => { config.free(); } }); -test.skip('static_position_static_child_padding_percentage', () => { +test('static_position_static_child_padding_percentage', () => { const config = Yoga.Config.create(); let root; @@ -2208,7 +2208,7 @@ test.skip('static_position_static_child_padding_percentage', () => { config.free(); } }); -test.skip('static_position_absolute_child_border_percentage', () => { +test('static_position_absolute_child_border_percentage', () => { const config = Yoga.Config.create(); let root; @@ -2285,7 +2285,7 @@ test.skip('static_position_absolute_child_border_percentage', () => { config.free(); } }); -test.skip('static_position_relative_child_border_percentage', () => { +test('static_position_relative_child_border_percentage', () => { const config = Yoga.Config.create(); let root; @@ -2361,7 +2361,7 @@ test.skip('static_position_relative_child_border_percentage', () => { config.free(); } }); -test.skip('static_position_static_child_border_percentage', () => { +test('static_position_static_child_border_percentage', () => { const config = Yoga.Config.create(); let root; @@ -2438,7 +2438,7 @@ test.skip('static_position_static_child_border_percentage', () => { config.free(); } }); -test.skip('static_position_absolute_child_containing_block_padding_box', () => { +test('static_position_absolute_child_containing_block_padding_box', () => { const config = Yoga.Config.create(); let root; @@ -2519,7 +2519,7 @@ test.skip('static_position_absolute_child_containing_block_padding_box', () => { config.free(); } }); -test.skip('static_position_relative_child_containing_block_padding_box', () => { +test('static_position_relative_child_containing_block_padding_box', () => { const config = Yoga.Config.create(); let root; @@ -2599,7 +2599,7 @@ test.skip('static_position_relative_child_containing_block_padding_box', () => { config.free(); } }); -test.skip('static_position_static_child_containing_block_padding_box', () => { +test('static_position_static_child_containing_block_padding_box', () => { const config = Yoga.Config.create(); let root; @@ -2745,7 +2745,7 @@ test.skip('static_position_absolute_child_containing_block_content_box', () => { config.free(); } }); -test.skip('static_position_relative_child_containing_block_content_box', () => { +test('static_position_relative_child_containing_block_content_box', () => { const config = Yoga.Config.create(); let root; @@ -2809,7 +2809,7 @@ test.skip('static_position_relative_child_containing_block_content_box', () => { config.free(); } }); -test.skip('static_position_static_child_containing_block_content_box', () => { +test('static_position_static_child_containing_block_content_box', () => { const config = Yoga.Config.create(); let root; diff --git a/tests/generated/YGStaticPositionTest.cpp b/tests/generated/YGStaticPositionTest.cpp index ba1436e44c..7ff13b6668 100644 --- a/tests/generated/YGStaticPositionTest.cpp +++ b/tests/generated/YGStaticPositionTest.cpp @@ -98,8 +98,6 @@ TEST(YogaTest, static_position_insets_have_no_effect_right_bottom) { } TEST(YogaTest, static_position_absolute_child_insets_relative_to_positioned_ancestor) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -175,8 +173,6 @@ TEST(YogaTest, static_position_absolute_child_insets_relative_to_positioned_ance } TEST(YogaTest, static_position_absolute_child_insets_relative_to_positioned_ancestor_deep) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -303,8 +299,6 @@ TEST(YogaTest, static_position_absolute_child_insets_relative_to_positioned_ance } TEST(YogaTest, static_position_absolute_child_width_percentage) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -377,8 +371,6 @@ TEST(YogaTest, static_position_absolute_child_width_percentage) { } TEST(YogaTest, static_position_relative_child_width_percentage) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -450,8 +442,6 @@ TEST(YogaTest, static_position_relative_child_width_percentage) { } TEST(YogaTest, static_position_static_child_width_percentage) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -524,8 +514,6 @@ TEST(YogaTest, static_position_static_child_width_percentage) { } TEST(YogaTest, static_position_absolute_child_height_percentage) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -598,8 +586,6 @@ TEST(YogaTest, static_position_absolute_child_height_percentage) { } TEST(YogaTest, static_position_relative_child_height_percentage) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -671,8 +657,6 @@ TEST(YogaTest, static_position_relative_child_height_percentage) { } TEST(YogaTest, static_position_static_child_height_percentage) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -745,8 +729,6 @@ TEST(YogaTest, static_position_static_child_height_percentage) { } TEST(YogaTest, static_position_absolute_child_left_percentage) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -820,8 +802,6 @@ TEST(YogaTest, static_position_absolute_child_left_percentage) { } TEST(YogaTest, static_position_relative_child_left_percentage) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -894,8 +874,6 @@ TEST(YogaTest, static_position_relative_child_left_percentage) { } TEST(YogaTest, static_position_static_child_left_percentage) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -969,8 +947,6 @@ TEST(YogaTest, static_position_static_child_left_percentage) { } TEST(YogaTest, static_position_absolute_child_right_percentage) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -1044,8 +1020,6 @@ TEST(YogaTest, static_position_absolute_child_right_percentage) { } TEST(YogaTest, static_position_relative_child_right_percentage) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -1118,8 +1092,6 @@ TEST(YogaTest, static_position_relative_child_right_percentage) { } TEST(YogaTest, static_position_static_child_right_percentage) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -1193,8 +1165,6 @@ TEST(YogaTest, static_position_static_child_right_percentage) { } TEST(YogaTest, static_position_absolute_child_top_percentage) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -1268,8 +1238,6 @@ TEST(YogaTest, static_position_absolute_child_top_percentage) { } TEST(YogaTest, static_position_relative_child_top_percentage) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -1342,8 +1310,6 @@ TEST(YogaTest, static_position_relative_child_top_percentage) { } TEST(YogaTest, static_position_static_child_top_percentage) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -1417,8 +1383,6 @@ TEST(YogaTest, static_position_static_child_top_percentage) { } TEST(YogaTest, static_position_absolute_child_bottom_percentage) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -1492,8 +1456,6 @@ TEST(YogaTest, static_position_absolute_child_bottom_percentage) { } TEST(YogaTest, static_position_relative_child_bottom_percentage) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -1566,8 +1528,6 @@ TEST(YogaTest, static_position_relative_child_bottom_percentage) { } TEST(YogaTest, static_position_static_child_bottom_percentage) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -1641,8 +1601,6 @@ TEST(YogaTest, static_position_static_child_bottom_percentage) { } TEST(YogaTest, static_position_absolute_child_margin_percentage) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -1719,8 +1677,6 @@ TEST(YogaTest, static_position_absolute_child_margin_percentage) { } TEST(YogaTest, static_position_relative_child_margin_percentage) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -1796,8 +1752,6 @@ TEST(YogaTest, static_position_relative_child_margin_percentage) { } TEST(YogaTest, static_position_static_child_margin_percentage) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -1874,8 +1828,6 @@ TEST(YogaTest, static_position_static_child_margin_percentage) { } TEST(YogaTest, static_position_absolute_child_padding_percentage) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -1952,8 +1904,6 @@ TEST(YogaTest, static_position_absolute_child_padding_percentage) { } TEST(YogaTest, static_position_relative_child_padding_percentage) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -2029,8 +1979,6 @@ TEST(YogaTest, static_position_relative_child_padding_percentage) { } TEST(YogaTest, static_position_static_child_padding_percentage) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -2107,8 +2055,6 @@ TEST(YogaTest, static_position_static_child_padding_percentage) { } TEST(YogaTest, static_position_absolute_child_border_percentage) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -2181,8 +2127,6 @@ TEST(YogaTest, static_position_absolute_child_border_percentage) { } TEST(YogaTest, static_position_relative_child_border_percentage) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -2254,8 +2198,6 @@ TEST(YogaTest, static_position_relative_child_border_percentage) { } TEST(YogaTest, static_position_static_child_border_percentage) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -2328,8 +2270,6 @@ TEST(YogaTest, static_position_static_child_border_percentage) { } TEST(YogaTest, static_position_absolute_child_containing_block_padding_box) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -2406,8 +2346,6 @@ TEST(YogaTest, static_position_absolute_child_containing_block_padding_box) { } TEST(YogaTest, static_position_relative_child_containing_block_padding_box) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -2483,8 +2421,6 @@ TEST(YogaTest, static_position_relative_child_containing_block_padding_box) { } TEST(YogaTest, static_position_static_child_containing_block_padding_box) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -2623,8 +2559,6 @@ TEST(YogaTest, static_position_absolute_child_containing_block_content_box) { } TEST(YogaTest, static_position_relative_child_containing_block_content_box) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -2684,8 +2618,6 @@ TEST(YogaTest, static_position_relative_child_containing_block_content_box) { } TEST(YogaTest, static_position_static_child_containing_block_content_box) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); diff --git a/yoga/algorithm/AbsoluteLayout.cpp b/yoga/algorithm/AbsoluteLayout.cpp index 22574cf805..cbccf07b9f 100644 --- a/yoga/algorithm/AbsoluteLayout.cpp +++ b/yoga/algorithm/AbsoluteLayout.cpp @@ -388,8 +388,8 @@ void layoutAbsoluteChild( direction, childWidthSizingMode, childHeightSizingMode, - childWidth, - childHeight, + containingBlockWidth, + containingBlockHeight, false, LayoutPassReason::kAbsMeasureChild, layoutMarkerData, @@ -408,8 +408,8 @@ void layoutAbsoluteChild( direction, SizingMode::StretchFit, SizingMode::StretchFit, - childWidth, - childHeight, + containingBlockWidth, + containingBlockHeight, true, LayoutPassReason::kAbsLayout, layoutMarkerData, From e74e6bd537491df43c889c6bdf2f81da885417b5 Mon Sep 17 00:00:00 2001 From: Joe Vilches Date: Thu, 7 Dec 2023 14:39:14 -0800 Subject: [PATCH 3/5] Fix issue where percentages were off of the border box, not padding box (#1485) Summary: X-link: https://github.com/facebook/react-native/pull/41686 The size of the containing block is the size of the padding box of the containing node for absolute nodes. We were looking at `containingNode->getLayout().measuredDimension(Dimension::Width)` which is the border box. So we need to subtract the border from this. Added a test that was failing before this change as well Reviewed By: NickGerleman Differential Revision: D51330526 --- gentest/fixtures/YGAbsolutePositionTest.html | 2 +- gentest/fixtures/YGStaticPositionTest.html | 10 +++ .../facebook/yoga/YGStaticPositionTest.java | 79 +++++++++++++++++ .../generated/YGStaticPositionTest.test.ts | 85 +++++++++++++++++++ tests/generated/YGStaticPositionTest.cpp | 80 +++++++++++++++++ yoga/algorithm/AbsoluteLayout.cpp | 9 +- yoga/node/Node.cpp | 5 ++ yoga/node/Node.h | 1 + 8 files changed, 267 insertions(+), 4 deletions(-) diff --git a/gentest/fixtures/YGAbsolutePositionTest.html b/gentest/fixtures/YGAbsolutePositionTest.html index 16bd6e3909..71aa3a15b6 100644 --- a/gentest/fixtures/YGAbsolutePositionTest.html +++ b/gentest/fixtures/YGAbsolutePositionTest.html @@ -93,7 +93,7 @@
-
+
diff --git a/gentest/fixtures/YGStaticPositionTest.html b/gentest/fixtures/YGStaticPositionTest.html index 3cb5e55599..345c11cede 100644 --- a/gentest/fixtures/YGStaticPositionTest.html +++ b/gentest/fixtures/YGStaticPositionTest.html @@ -324,3 +324,13 @@
+ +
+
+
+
+
+
+
+
diff --git a/java/tests/com/facebook/yoga/YGStaticPositionTest.java b/java/tests/com/facebook/yoga/YGStaticPositionTest.java index efa19ace25..87052d51f5 100644 --- a/java/tests/com/facebook/yoga/YGStaticPositionTest.java +++ b/java/tests/com/facebook/yoga/YGStaticPositionTest.java @@ -2653,6 +2653,85 @@ public void test_static_position_static_child_containing_block_content_box() { assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); } + @Test + public void test_static_position_containing_block_padding_and_border() { + 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.setPadding(YogaEdge.LEFT, 9); + root_child0.setPadding(YogaEdge.TOP, 8); + root_child0.setPadding(YogaEdge.RIGHT, 1); + root_child0.setPadding(YogaEdge.BOTTOM, 4); + root_child0.setBorder(YogaEdge.LEFT, 2f); + root_child0.setBorder(YogaEdge.TOP, 5f); + root_child0.setBorder(YogaEdge.RIGHT, 7f); + root_child0.setBorder(YogaEdge.BOTTOM, 4f); + root_child0.setWidth(400f); + root_child0.setHeight(400f); + root.addChildAt(root_child0, 0); + + final YogaNode root_child0_child0 = createNode(config); + root_child0_child0.setPositionType(YogaPositionType.STATIC); + root_child0_child0.setWidth(100f); + root_child0_child0.setHeight(100f); + root_child0.addChildAt(root_child0_child0, 0); + + final YogaNode root_child0_child0_child0 = createNode(config); + root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); + root_child0_child0_child0.setWidthPercent(41f); + root_child0_child0_child0.setHeightPercent(61f); + root_child0_child0.addChildAt(root_child0_child0_child0, 0); + root.setDirection(YogaDirection.LTR); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(400f, root.getLayoutWidth(), 0.0f); + assertEquals(400f, root.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0.getLayoutY(), 0.0f); + assertEquals(400f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(400f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(11f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(13f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(160f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(239f, root_child0_child0_child0.getLayoutHeight(), 0.0f); + + root.setDirection(YogaDirection.RTL); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(400f, root.getLayoutWidth(), 0.0f); + assertEquals(400f, root.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0.getLayoutY(), 0.0f); + assertEquals(400f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(400f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(292f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(13f, root_child0_child0.getLayoutY(), 0.0f); + assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); + + assertEquals(-60f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); + assertEquals(160f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(239f, root_child0_child0_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 023f8d28fb..16a57ced16 100644 --- a/javascript/tests/generated/YGStaticPositionTest.test.ts +++ b/javascript/tests/generated/YGStaticPositionTest.test.ts @@ -2874,3 +2874,88 @@ test('static_position_static_child_containing_block_content_box', () => { config.free(); } }); +test('static_position_containing_block_padding_and_border', () => { + 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.setPadding(Edge.Left, 9); + root_child0.setPadding(Edge.Top, 8); + root_child0.setPadding(Edge.Right, 1); + root_child0.setPadding(Edge.Bottom, 4); + root_child0.setBorder(Edge.Left, 2); + root_child0.setBorder(Edge.Top, 5); + root_child0.setBorder(Edge.Right, 7); + root_child0.setBorder(Edge.Bottom, 4); + root_child0.setWidth(400); + root_child0.setHeight(400); + root.insertChild(root_child0, 0); + + const root_child0_child0 = Yoga.Node.create(config); + root_child0_child0.setPositionType(PositionType.Static); + root_child0_child0.setWidth(100); + root_child0_child0.setHeight(100); + root_child0.insertChild(root_child0_child0, 0); + + const root_child0_child0_child0 = Yoga.Node.create(config); + root_child0_child0_child0.setPositionType(PositionType.Absolute); + root_child0_child0_child0.setWidth("41%"); + root_child0_child0_child0.setHeight("61%"); + root_child0_child0.insertChild(root_child0_child0_child0, 0); + root.calculateLayout(undefined, undefined, Direction.LTR); + + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(400); + expect(root.getComputedHeight()).toBe(400); + + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(400); + expect(root_child0.getComputedHeight()).toBe(400); + + expect(root_child0_child0.getComputedLeft()).toBe(11); + expect(root_child0_child0.getComputedTop()).toBe(13); + expect(root_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0.getComputedHeight()).toBe(100); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(160); + expect(root_child0_child0_child0.getComputedHeight()).toBe(239); + + root.calculateLayout(undefined, undefined, Direction.RTL); + + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(400); + expect(root.getComputedHeight()).toBe(400); + + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(400); + expect(root_child0.getComputedHeight()).toBe(400); + + expect(root_child0_child0.getComputedLeft()).toBe(292); + expect(root_child0_child0.getComputedTop()).toBe(13); + expect(root_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0.getComputedHeight()).toBe(100); + + expect(root_child0_child0_child0.getComputedLeft()).toBe(-60); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(160); + expect(root_child0_child0_child0.getComputedHeight()).toBe(239); + } finally { + if (typeof root !== 'undefined') { + root.freeRecursive(); + } + + config.free(); + } +}); diff --git a/tests/generated/YGStaticPositionTest.cpp b/tests/generated/YGStaticPositionTest.cpp index 7ff13b6668..f622a80967 100644 --- a/tests/generated/YGStaticPositionTest.cpp +++ b/tests/generated/YGStaticPositionTest.cpp @@ -2676,3 +2676,83 @@ TEST(YogaTest, static_position_static_child_containing_block_content_box) { YGConfigFree(config); } + +TEST(YogaTest, static_position_containing_block_padding_and_border) { + const YGConfigRef config = YGConfigNew(); + YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); + + const YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); + + const YGNodeRef root_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetPadding(root_child0, YGEdgeLeft, 9); + YGNodeStyleSetPadding(root_child0, YGEdgeTop, 8); + YGNodeStyleSetPadding(root_child0, YGEdgeRight, 1); + YGNodeStyleSetPadding(root_child0, YGEdgeBottom, 4); + YGNodeStyleSetBorder(root_child0, YGEdgeLeft, 2); + YGNodeStyleSetBorder(root_child0, YGEdgeTop, 5); + YGNodeStyleSetBorder(root_child0, YGEdgeRight, 7); + YGNodeStyleSetBorder(root_child0, YGEdgeBottom, 4); + YGNodeStyleSetWidth(root_child0, 400); + YGNodeStyleSetHeight(root_child0, 400); + YGNodeInsertChild(root, root_child0, 0); + + const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic); + YGNodeStyleSetWidth(root_child0_child0, 100); + YGNodeStyleSetHeight(root_child0_child0, 100); + YGNodeInsertChild(root_child0, root_child0_child0, 0); + + const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetPositionType(root_child0_child0_child0, YGPositionTypeAbsolute); + YGNodeStyleSetWidthPercent(root_child0_child0_child0, 41); + YGNodeStyleSetHeightPercent(root_child0_child0_child0, 61); + YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0); + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(11, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(13, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(239, YGNodeLayoutGetHeight(root_child0_child0_child0)); + + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(292, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(13, YGNodeLayoutGetTop(root_child0_child0)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0)); + + ASSERT_FLOAT_EQ(-60, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(239, YGNodeLayoutGetHeight(root_child0_child0_child0)); + + YGNodeFreeRecursive(root); + + YGConfigFree(config); +} diff --git a/yoga/algorithm/AbsoluteLayout.cpp b/yoga/algorithm/AbsoluteLayout.cpp index cbccf07b9f..d421db5487 100644 --- a/yoga/algorithm/AbsoluteLayout.cpp +++ b/yoga/algorithm/AbsoluteLayout.cpp @@ -25,7 +25,8 @@ static void justifyAbsoluteChild( case Justify::SpaceBetween: child->setLayoutPosition( child->getFlexStartMargin(mainAxis, direction, containingBlockWidth) + - parent->getFlexStartBorder(mainAxis, direction), + parent->getLayout().border(flexStartEdge(mainAxis)) + + parent->getLayout().padding(flexStartEdge(mainAxis)), flexStartEdge(mainAxis)); break; case Justify::FlexEnd: @@ -458,8 +459,10 @@ void layoutAbsoluteDescendants( containingNode, currentNode, child, - containingNode->getLayout().measuredDimension(Dimension::Width), - containingNode->getLayout().measuredDimension(Dimension::Height), + containingNode->getLayout().measuredDimension(Dimension::Width) - + containingNode->getBorderForAxis(FlexDirection::Row), + containingNode->getLayout().measuredDimension(Dimension::Height) - + containingNode->getBorderForAxis(FlexDirection::Column), widthSizingMode, currentNodeDirection, layoutMarkerData, diff --git a/yoga/node/Node.cpp b/yoga/node/Node.cpp index f26a588e17..36eefbb525 100644 --- a/yoga/node/Node.cpp +++ b/yoga/node/Node.cpp @@ -377,6 +377,11 @@ float Node::getFlexEndPaddingAndBorder( getFlexEndBorder(axis, direction); } +float Node::getBorderForAxis(FlexDirection axis) const { + return getInlineStartBorder(axis, Direction::LTR) + + getInlineEndBorder(axis, Direction::LTR); +} + float Node::getMarginForAxis(FlexDirection axis, float widthSize) const { // The total margin for a given axis does not depend on the direction // so hardcoding LTR here to avoid piping direction to this function diff --git a/yoga/node/Node.h b/yoga/node/Node.h index aa60b3d830..bbde5eac36 100644 --- a/yoga/node/Node.h +++ b/yoga/node/Node.h @@ -287,6 +287,7 @@ class YG_EXPORT Node : public ::YGNode { FlexDirection axis, Direction direction, float widthSize) const; + float getBorderForAxis(FlexDirection axis) const; float getMarginForAxis(FlexDirection axis, float widthSize) const; float getGapForAxis(FlexDirection axis) const; // Setters From 5e8bc3baa8697f2cea322b40225171beb2423bde Mon Sep 17 00:00:00 2001 From: Joe Vilches Date: Thu, 7 Dec 2023 14:39:14 -0800 Subject: [PATCH 4/5] Relayout test for containing block changing size (#1483) Summary: This test is for ensuring caching does not break layout when a CB changes. No changes were needed to get this passing it just works this way with the implementation we chose earlier. Reviewed By: NickGerleman Differential Revision: D51333812 --- tests/YGRelayoutTest.cpp | 160 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) diff --git a/tests/YGRelayoutTest.cpp b/tests/YGRelayoutTest.cpp index 01ae5c4177..b7faf6b402 100644 --- a/tests/YGRelayoutTest.cpp +++ b/tests/YGRelayoutTest.cpp @@ -49,3 +49,163 @@ TEST(YogaTest, recalculate_resolvedDimonsion_onchange) { YGNodeFreeRecursive(root); } + +TEST(YogaTest, relayout_containing_block_size_changes) { + 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); + YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic); + 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)); + + // Relayout starts here + YGNodeStyleSetWidth(root_child0, 456); + YGNodeStyleSetHeight(root_child0, 432); + + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(469, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(438, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(4, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(5, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(456, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(432, 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(182, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(263, 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(469, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(438, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(4, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(5, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(456, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(432, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(235, 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(16, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(29, YGNodeLayoutGetTop(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(182, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(263, YGNodeLayoutGetHeight(root_child0_child0_child0)); + + YGNodeFreeRecursive(root); + + YGConfigFree(config); +} From 215d8ffa0b976330f4f005a4dad5af0f37382ff7 Mon Sep 17 00:00:00 2001 From: Joe Vilches Date: Thu, 7 Dec 2023 14:39:14 -0800 Subject: [PATCH 5/5] Fix bug with align start not taking into account parent padding (#1484) Summary: X-link: https://github.com/facebook/react-native/pull/41687 Tsia. Added test and accounted for parent padding Reviewed By: NickGerleman Differential Revision: D51374086 --- gentest/fixtures/YGStaticPositionTest.html | 141 ++ .../facebook/yoga/YGStaticPositionTest.java | 1271 ++++++++++++++++ .../generated/YGStaticPositionTest.test.ts | 1325 +++++++++++++++++ tests/generated/YGStaticPositionTest.cpp | 1280 ++++++++++++++++ yoga/algorithm/AbsoluteLayout.cpp | 3 +- 5 files changed, 4019 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 87052d51f5..7d4aca762f 100644 --- a/java/tests/com/facebook/yoga/YGStaticPositionTest.java +++ b/java/tests/com/facebook/yoga/YGStaticPositionTest.java @@ -2732,6 +2732,1277 @@ 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.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.setPositionType(YogaPositionType.STATIC); + 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.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.setPositionType(YogaPositionType.STATIC); + 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.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.setPositionType(YogaPositionType.STATIC); + 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.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.setPositionType(YogaPositionType.STATIC); + 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.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.setPositionType(YogaPositionType.STATIC); + 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.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.setPositionType(YogaPositionType.STATIC); + 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.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.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.setPositionType(YogaPositionType.STATIC); + 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.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.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.setPositionType(YogaPositionType.STATIC); + 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.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.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.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.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.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.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.setPositionType(YogaPositionType.STATIC); + 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.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.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.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.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.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 16a57ced16..96b8ffab14 100644 --- a/javascript/tests/generated/YGStaticPositionTest.test.ts +++ b/javascript/tests/generated/YGStaticPositionTest.test.ts @@ -2959,3 +2959,1328 @@ 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.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.setPositionType(PositionType.Static); + 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.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.setPositionType(PositionType.Static); + 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.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.setPositionType(PositionType.Static); + 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.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.setPositionType(PositionType.Static); + 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.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.setPositionType(PositionType.Static); + 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.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.setPositionType(PositionType.Static); + 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.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.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.setPositionType(PositionType.Static); + 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.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.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.setPositionType(PositionType.Static); + 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.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.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.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.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.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.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.setPositionType(PositionType.Static); + 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.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.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.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.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.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 f622a80967..16e5c3890f 100644 --- a/tests/generated/YGStaticPositionTest.cpp +++ b/tests/generated/YGStaticPositionTest.cpp @@ -2756,3 +2756,1283 @@ 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); + 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); + YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic); + 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); + 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); + YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic); + 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); + 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); + YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic); + 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); + 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); + YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic); + 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); + 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); + YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic); + 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); + 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); + YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic); + 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); + 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); + 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); + YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic); + 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); + 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); + 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); + YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic); + 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); + 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); + 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); + 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); + 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); + 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 d421db5487..dae3719b21 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));