From 051933423f8cd7226b9da20af2c7bb53ea22ea36 Mon Sep 17 00:00:00 2001 From: Joe Vilches Date: Thu, 26 Oct 2023 13:11:54 -0700 Subject: [PATCH] Backout "Add tests for absolute positioning of children with padding in the parent" Summary: Backing out D50670457 Github PR is: https://github.com/facebook/yoga/commit/4f98bfe40a72aed0d5888d9d5c5d9c2340da7f4f That PR started failing our workflows due to a build error in gtest. It seems unlikely that it is due to that change but backing it out to see if it fixes that issue. https://github.com/facebook/yoga/actions/runs/6657567207/job/18095847672 Differential Revision: D50708256 --- gentest/fixtures/YGAbsolutePositionTest.html | 16 -- .../facebook/yoga/YGAbsolutePositionTest.java | 175 ---------------- .../generated/YGAbsolutePositionTest.test.ts | 196 ------------------ tests/generated/YGAbsolutePositionTest.cpp | 182 ---------------- 4 files changed, 569 deletions(-) diff --git a/gentest/fixtures/YGAbsolutePositionTest.html b/gentest/fixtures/YGAbsolutePositionTest.html index 8ccdc14b3d..d0f5e9ee53 100644 --- a/gentest/fixtures/YGAbsolutePositionTest.html +++ b/gentest/fixtures/YGAbsolutePositionTest.html @@ -100,19 +100,3 @@
- -
-
-
- -
-
-
- -
-
-
- -
-
-
diff --git a/java/tests/com/facebook/yoga/YGAbsolutePositionTest.java b/java/tests/com/facebook/yoga/YGAbsolutePositionTest.java index 5b87cd30ff..bc684568b8 100644 --- a/java/tests/com/facebook/yoga/YGAbsolutePositionTest.java +++ b/java/tests/com/facebook/yoga/YGAbsolutePositionTest.java @@ -1215,181 +1215,6 @@ public void test_absolute_layout_percentage_height_based_on_padded_parent_and_al assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); } - @Test - @Ignore - public void test_absolute_layout_padding_left() { - YogaConfig config = YogaConfigFactory.create(); - config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); - - final YogaNode root = createNode(config); - root.setPositionType(YogaPositionType.ABSOLUTE); - root.setPadding(YogaEdge.LEFT, 100); - root.setWidth(200f); - root.setHeight(200f); - - final YogaNode root_child0 = createNode(config); - root_child0.setPositionType(YogaPositionType.ABSOLUTE); - root_child0.setWidth(50f); - root_child0.setHeight(50f); - root.addChildAt(root_child0, 0); - root.setDirection(YogaDirection.LTR); - root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); - - assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(0f, root.getLayoutY(), 0.0f); - assertEquals(200f, root.getLayoutWidth(), 0.0f); - assertEquals(200f, root.getLayoutHeight(), 0.0f); - - assertEquals(100f, root_child0.getLayoutX(), 0.0f); - assertEquals(0f, root_child0.getLayoutY(), 0.0f); - assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); - - root.setDirection(YogaDirection.RTL); - root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); - - assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(0f, root.getLayoutY(), 0.0f); - assertEquals(200f, root.getLayoutWidth(), 0.0f); - assertEquals(200f, root.getLayoutHeight(), 0.0f); - - assertEquals(150f, root_child0.getLayoutX(), 0.0f); - assertEquals(0f, root_child0.getLayoutY(), 0.0f); - assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); - } - - @Test - @Ignore - public void test_absolute_layout_padding_right() { - YogaConfig config = YogaConfigFactory.create(); - config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); - - final YogaNode root = createNode(config); - root.setPositionType(YogaPositionType.ABSOLUTE); - root.setPadding(YogaEdge.RIGHT, 100); - root.setWidth(200f); - root.setHeight(200f); - - final YogaNode root_child0 = createNode(config); - root_child0.setPositionType(YogaPositionType.ABSOLUTE); - root_child0.setWidth(50f); - root_child0.setHeight(50f); - root.addChildAt(root_child0, 0); - root.setDirection(YogaDirection.LTR); - root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); - - assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(0f, root.getLayoutY(), 0.0f); - assertEquals(200f, root.getLayoutWidth(), 0.0f); - assertEquals(200f, root.getLayoutHeight(), 0.0f); - - assertEquals(0f, root_child0.getLayoutX(), 0.0f); - assertEquals(0f, root_child0.getLayoutY(), 0.0f); - assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); - - root.setDirection(YogaDirection.RTL); - root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); - - assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(0f, root.getLayoutY(), 0.0f); - assertEquals(200f, root.getLayoutWidth(), 0.0f); - assertEquals(200f, root.getLayoutHeight(), 0.0f); - - assertEquals(50f, root_child0.getLayoutX(), 0.0f); - assertEquals(0f, root_child0.getLayoutY(), 0.0f); - assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); - } - - @Test - @Ignore - public void test_absolute_layout_padding_top() { - YogaConfig config = YogaConfigFactory.create(); - config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); - - final YogaNode root = createNode(config); - root.setPositionType(YogaPositionType.ABSOLUTE); - root.setPadding(YogaEdge.TOP, 100); - root.setWidth(200f); - root.setHeight(200f); - - final YogaNode root_child0 = createNode(config); - root_child0.setPositionType(YogaPositionType.ABSOLUTE); - root_child0.setWidth(50f); - root_child0.setHeight(50f); - root.addChildAt(root_child0, 0); - root.setDirection(YogaDirection.LTR); - root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); - - assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(0f, root.getLayoutY(), 0.0f); - assertEquals(200f, root.getLayoutWidth(), 0.0f); - assertEquals(200f, root.getLayoutHeight(), 0.0f); - - assertEquals(0f, root_child0.getLayoutX(), 0.0f); - assertEquals(100f, root_child0.getLayoutY(), 0.0f); - assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); - - root.setDirection(YogaDirection.RTL); - root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); - - assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(0f, root.getLayoutY(), 0.0f); - assertEquals(200f, root.getLayoutWidth(), 0.0f); - assertEquals(200f, root.getLayoutHeight(), 0.0f); - - assertEquals(150f, root_child0.getLayoutX(), 0.0f); - assertEquals(100f, root_child0.getLayoutY(), 0.0f); - assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); - } - - @Test - public void test_absolute_layout_padding_bottom() { - YogaConfig config = YogaConfigFactory.create(); - config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); - - final YogaNode root = createNode(config); - root.setPositionType(YogaPositionType.ABSOLUTE); - root.setPadding(YogaEdge.BOTTOM, 100); - root.setWidth(200f); - root.setHeight(200f); - - final YogaNode root_child0 = createNode(config); - root_child0.setPositionType(YogaPositionType.ABSOLUTE); - root_child0.setWidth(50f); - root_child0.setHeight(50f); - root.addChildAt(root_child0, 0); - root.setDirection(YogaDirection.LTR); - root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); - - assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(0f, root.getLayoutY(), 0.0f); - assertEquals(200f, root.getLayoutWidth(), 0.0f); - assertEquals(200f, root.getLayoutHeight(), 0.0f); - - assertEquals(0f, root_child0.getLayoutX(), 0.0f); - assertEquals(0f, root_child0.getLayoutY(), 0.0f); - assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); - - root.setDirection(YogaDirection.RTL); - root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); - - assertEquals(0f, root.getLayoutX(), 0.0f); - assertEquals(0f, root.getLayoutY(), 0.0f); - assertEquals(200f, root.getLayoutWidth(), 0.0f); - assertEquals(200f, root.getLayoutHeight(), 0.0f); - - assertEquals(150f, root_child0.getLayoutX(), 0.0f); - assertEquals(0f, root_child0.getLayoutY(), 0.0f); - assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); - assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); - } - private YogaNode createNode(YogaConfig config) { return mNodeFactory.create(config); } diff --git a/javascript/tests/generated/YGAbsolutePositionTest.test.ts b/javascript/tests/generated/YGAbsolutePositionTest.test.ts index 02af377952..5f9b2d1998 100644 --- a/javascript/tests/generated/YGAbsolutePositionTest.test.ts +++ b/javascript/tests/generated/YGAbsolutePositionTest.test.ts @@ -1359,199 +1359,3 @@ test('absolute_layout_percentage_height_based_on_padded_parent_and_align_items_c config.free(); } }); -test.skip('absolute_layout_padding_left', () => { - const config = Yoga.Config.create(); - let root; - - config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - - try { - root = Yoga.Node.create(config); - root.setPositionType(PositionType.Absolute); - root.setPadding(Edge.Left, 100); - root.setWidth(200); - root.setHeight(200); - - const root_child0 = Yoga.Node.create(config); - root_child0.setPositionType(PositionType.Absolute); - root_child0.setWidth(50); - root_child0.setHeight(50); - root.insertChild(root_child0, 0); - root.calculateLayout(undefined, undefined, Direction.LTR); - - expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(0); - expect(root.getComputedWidth()).toBe(200); - expect(root.getComputedHeight()).toBe(200); - - expect(root_child0.getComputedLeft()).toBe(100); - expect(root_child0.getComputedTop()).toBe(0); - expect(root_child0.getComputedWidth()).toBe(50); - expect(root_child0.getComputedHeight()).toBe(50); - - root.calculateLayout(undefined, undefined, Direction.RTL); - - expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(0); - expect(root.getComputedWidth()).toBe(200); - expect(root.getComputedHeight()).toBe(200); - - expect(root_child0.getComputedLeft()).toBe(150); - expect(root_child0.getComputedTop()).toBe(0); - expect(root_child0.getComputedWidth()).toBe(50); - expect(root_child0.getComputedHeight()).toBe(50); - } finally { - if (typeof root !== 'undefined') { - root.freeRecursive(); - } - - config.free(); - } -}); -test.skip('absolute_layout_padding_right', () => { - const config = Yoga.Config.create(); - let root; - - config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - - try { - root = Yoga.Node.create(config); - root.setPositionType(PositionType.Absolute); - root.setPadding(Edge.Right, 100); - root.setWidth(200); - root.setHeight(200); - - const root_child0 = Yoga.Node.create(config); - root_child0.setPositionType(PositionType.Absolute); - root_child0.setWidth(50); - root_child0.setHeight(50); - root.insertChild(root_child0, 0); - root.calculateLayout(undefined, undefined, Direction.LTR); - - expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(0); - expect(root.getComputedWidth()).toBe(200); - expect(root.getComputedHeight()).toBe(200); - - expect(root_child0.getComputedLeft()).toBe(0); - expect(root_child0.getComputedTop()).toBe(0); - expect(root_child0.getComputedWidth()).toBe(50); - expect(root_child0.getComputedHeight()).toBe(50); - - root.calculateLayout(undefined, undefined, Direction.RTL); - - expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(0); - expect(root.getComputedWidth()).toBe(200); - expect(root.getComputedHeight()).toBe(200); - - expect(root_child0.getComputedLeft()).toBe(50); - expect(root_child0.getComputedTop()).toBe(0); - expect(root_child0.getComputedWidth()).toBe(50); - expect(root_child0.getComputedHeight()).toBe(50); - } finally { - if (typeof root !== 'undefined') { - root.freeRecursive(); - } - - config.free(); - } -}); -test.skip('absolute_layout_padding_top', () => { - const config = Yoga.Config.create(); - let root; - - config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - - try { - root = Yoga.Node.create(config); - root.setPositionType(PositionType.Absolute); - root.setPadding(Edge.Top, 100); - root.setWidth(200); - root.setHeight(200); - - const root_child0 = Yoga.Node.create(config); - root_child0.setPositionType(PositionType.Absolute); - root_child0.setWidth(50); - root_child0.setHeight(50); - root.insertChild(root_child0, 0); - root.calculateLayout(undefined, undefined, Direction.LTR); - - expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(0); - expect(root.getComputedWidth()).toBe(200); - expect(root.getComputedHeight()).toBe(200); - - expect(root_child0.getComputedLeft()).toBe(0); - expect(root_child0.getComputedTop()).toBe(100); - expect(root_child0.getComputedWidth()).toBe(50); - expect(root_child0.getComputedHeight()).toBe(50); - - root.calculateLayout(undefined, undefined, Direction.RTL); - - expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(0); - expect(root.getComputedWidth()).toBe(200); - expect(root.getComputedHeight()).toBe(200); - - expect(root_child0.getComputedLeft()).toBe(150); - expect(root_child0.getComputedTop()).toBe(100); - expect(root_child0.getComputedWidth()).toBe(50); - expect(root_child0.getComputedHeight()).toBe(50); - } finally { - if (typeof root !== 'undefined') { - root.freeRecursive(); - } - - config.free(); - } -}); -test('absolute_layout_padding_bottom', () => { - const config = Yoga.Config.create(); - let root; - - config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true); - - try { - root = Yoga.Node.create(config); - root.setPositionType(PositionType.Absolute); - root.setPadding(Edge.Bottom, 100); - root.setWidth(200); - root.setHeight(200); - - const root_child0 = Yoga.Node.create(config); - root_child0.setPositionType(PositionType.Absolute); - root_child0.setWidth(50); - root_child0.setHeight(50); - root.insertChild(root_child0, 0); - root.calculateLayout(undefined, undefined, Direction.LTR); - - expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(0); - expect(root.getComputedWidth()).toBe(200); - expect(root.getComputedHeight()).toBe(200); - - expect(root_child0.getComputedLeft()).toBe(0); - expect(root_child0.getComputedTop()).toBe(0); - expect(root_child0.getComputedWidth()).toBe(50); - expect(root_child0.getComputedHeight()).toBe(50); - - root.calculateLayout(undefined, undefined, Direction.RTL); - - expect(root.getComputedLeft()).toBe(0); - expect(root.getComputedTop()).toBe(0); - expect(root.getComputedWidth()).toBe(200); - expect(root.getComputedHeight()).toBe(200); - - expect(root_child0.getComputedLeft()).toBe(150); - expect(root_child0.getComputedTop()).toBe(0); - expect(root_child0.getComputedWidth()).toBe(50); - expect(root_child0.getComputedHeight()).toBe(50); - } finally { - if (typeof root !== 'undefined') { - root.freeRecursive(); - } - - config.free(); - } -}); diff --git a/tests/generated/YGAbsolutePositionTest.cpp b/tests/generated/YGAbsolutePositionTest.cpp index c164c76fa8..ce614e8653 100644 --- a/tests/generated/YGAbsolutePositionTest.cpp +++ b/tests/generated/YGAbsolutePositionTest.cpp @@ -1224,185 +1224,3 @@ TEST(YogaTest, absolute_layout_percentage_height_based_on_padded_parent_and_alig YGConfigFree(config); } - -TEST(YogaTest, absolute_layout_padding_left) { - GTEST_SKIP(); - - const YGConfigRef config = YGConfigNew(); - YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); - - const YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); - YGNodeStyleSetPadding(root, YGEdgeLeft, 100); - YGNodeStyleSetWidth(root, 200); - YGNodeStyleSetHeight(root, 200); - - const YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute); - YGNodeStyleSetWidth(root_child0, 50); - YGNodeStyleSetHeight(root_child0, 50); - YGNodeInsertChild(root, root_child0, 0); - YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); - ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root)); - ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root)); - - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0)); - - YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); - ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root)); - ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root)); - - ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0)); - - YGNodeFreeRecursive(root); - - YGConfigFree(config); -} - -TEST(YogaTest, absolute_layout_padding_right) { - GTEST_SKIP(); - - const YGConfigRef config = YGConfigNew(); - YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); - - const YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); - YGNodeStyleSetPadding(root, YGEdgeRight, 100); - YGNodeStyleSetWidth(root, 200); - YGNodeStyleSetHeight(root, 200); - - const YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute); - YGNodeStyleSetWidth(root_child0, 50); - YGNodeStyleSetHeight(root_child0, 50); - YGNodeInsertChild(root, root_child0, 0); - YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); - ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root)); - ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root)); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0)); - - YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); - ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root)); - ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root)); - - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0)); - - YGNodeFreeRecursive(root); - - YGConfigFree(config); -} - -TEST(YogaTest, absolute_layout_padding_top) { - GTEST_SKIP(); - - const YGConfigRef config = YGConfigNew(); - YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); - - const YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); - YGNodeStyleSetPadding(root, YGEdgeTop, 100); - YGNodeStyleSetWidth(root, 200); - YGNodeStyleSetHeight(root, 200); - - const YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute); - YGNodeStyleSetWidth(root_child0, 50); - YGNodeStyleSetHeight(root_child0, 50); - YGNodeInsertChild(root, root_child0, 0); - YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); - ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root)); - ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root)); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0)); - - YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); - ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root)); - ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root)); - - ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0)); - - YGNodeFreeRecursive(root); - - YGConfigFree(config); -} - -TEST(YogaTest, absolute_layout_padding_bottom) { - const YGConfigRef config = YGConfigNew(); - YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); - - const YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); - YGNodeStyleSetPadding(root, YGEdgeBottom, 100); - YGNodeStyleSetWidth(root, 200); - YGNodeStyleSetHeight(root, 200); - - const YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute); - YGNodeStyleSetWidth(root_child0, 50); - YGNodeStyleSetHeight(root_child0, 50); - YGNodeInsertChild(root, root_child0, 0); - YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); - ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root)); - ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root)); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0)); - - YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); - ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root)); - ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root)); - - ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0)); - ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0)); - - YGNodeFreeRecursive(root); - - YGConfigFree(config); -}