From 34c7924792953b23ee97d3a41228c201cdcbed92 Mon Sep 17 00:00:00 2001 From: Joe Vilches Date: Mon, 16 Oct 2023 17:24:40 -0700 Subject: [PATCH] Revamp tests for row reverse + border after fix Differential Revision: D50348206 fbshipit-source-id: 0cd02d0261d8ecfce3fd0bf6f654cd17052bf99c --- gentest/fixtures/YGFlexDirectionTest.html | 4 +- .../com/facebook/yoga/YGAspectRatioTest.java | 56 +++---- .../facebook/yoga/YGFlexDirectionTest.java | 2 - .../tests/generated/YGAspectRatioTest.test.ts | 56 +++---- .../generated/YGFlexDirectionTest.test.ts | 4 +- tests/YGFlexDirectionErrataTest.cpp | 142 ++++++++++++++++++ tests/generated/YGAspectRatioTest.cpp | 56 +++---- tests/generated/YGFlexDirectionTest.cpp | 4 - 8 files changed, 230 insertions(+), 94 deletions(-) diff --git a/gentest/fixtures/YGFlexDirectionTest.html b/gentest/fixtures/YGFlexDirectionTest.html index 12583209ae..e857466834 100644 --- a/gentest/fixtures/YGFlexDirectionTest.html +++ b/gentest/fixtures/YGFlexDirectionTest.html @@ -113,7 +113,7 @@
-
+
@@ -125,7 +125,7 @@
-
+
diff --git a/java/tests/com/facebook/yoga/YGAspectRatioTest.java b/java/tests/com/facebook/yoga/YGAspectRatioTest.java index 809bafe929..bc06fb3482 100644 --- a/java/tests/com/facebook/yoga/YGAspectRatioTest.java +++ b/java/tests/com/facebook/yoga/YGAspectRatioTest.java @@ -95,28 +95,28 @@ public void test_aspect_ratio_does_not_stretch_cross_axis_dim() { assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); - assertEquals(300f, root_child0_child0.getLayoutWidth(), 0.0f); - assertEquals(197f, root_child0_child0.getLayoutHeight(), 0.0f); + assertEquals(285f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(187f, 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(197f, root_child0_child0_child0.getLayoutWidth(), 0.0f); - assertEquals(197f, root_child0_child0_child0.getLayoutHeight(), 0.0f); + assertEquals(187f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(187f, root_child0_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(197f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(187f, root_child0_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child1.getLayoutY(), 0.0f); assertEquals(5f, root_child0_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(197f, root_child0_child0_child1.getLayoutHeight(), 0.0f); + assertEquals(187f, root_child0_child0_child1.getLayoutHeight(), 0.0f); - assertEquals(202f, root_child0_child0_child2.getLayoutX(), 0.0f); + assertEquals(192f, root_child0_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child2.getLayoutY(), 0.0f); - assertEquals(98f, root_child0_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(197f, root_child0_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(93f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(187f, root_child0_child0_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0_child2_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child2_child0.getLayoutY(), 0.0f); - assertEquals(98f, root_child0_child0_child2_child0.getLayoutWidth(), 0.0f); - assertEquals(197f, root_child0_child0_child2_child0.getLayoutHeight(), 0.0f); + assertEquals(93f, root_child0_child0_child2_child0.getLayoutWidth(), 0.0f); + assertEquals(187f, root_child0_child0_child2_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0_child2_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child2_child0_child0.getLayoutY(), 0.0f); @@ -125,8 +125,8 @@ public void test_aspect_ratio_does_not_stretch_cross_axis_dim() { assertEquals(0f, root_child0_child0_child2_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child2_child0_child1.getLayoutY(), 0.0f); - assertEquals(98f, root_child0_child0_child2_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(197f, root_child0_child0_child2_child0_child1.getLayoutHeight(), 0.0f); + assertEquals(93f, root_child0_child0_child2_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(187f, root_child0_child0_child2_child0_child1.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); @@ -141,40 +141,40 @@ public void test_aspect_ratio_does_not_stretch_cross_axis_dim() { assertEquals(300f, root_child0.getLayoutWidth(), 0.0f); assertEquals(300f, root_child0.getLayoutHeight(), 0.0f); - assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); + assertEquals(30f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); - assertEquals(300f, root_child0_child0.getLayoutWidth(), 0.0f); - assertEquals(197f, root_child0_child0.getLayoutHeight(), 0.0f); + assertEquals(285f, root_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(187f, root_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(103f, root_child0_child0_child0.getLayoutX(), 0.0f); + assertEquals(98f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); - assertEquals(197f, root_child0_child0_child0.getLayoutWidth(), 0.0f); - assertEquals(197f, root_child0_child0_child0.getLayoutHeight(), 0.0f); + assertEquals(187f, root_child0_child0_child0.getLayoutWidth(), 0.0f); + assertEquals(187f, root_child0_child0_child0.getLayoutHeight(), 0.0f); - assertEquals(98f, root_child0_child0_child1.getLayoutX(), 0.0f); + assertEquals(93f, root_child0_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child1.getLayoutY(), 0.0f); assertEquals(5f, root_child0_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(197f, root_child0_child0_child1.getLayoutHeight(), 0.0f); + assertEquals(187f, root_child0_child0_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child2.getLayoutY(), 0.0f); - assertEquals(98f, root_child0_child0_child2.getLayoutWidth(), 0.0f); - assertEquals(197f, root_child0_child0_child2.getLayoutHeight(), 0.0f); + assertEquals(93f, root_child0_child0_child2.getLayoutWidth(), 0.0f); + assertEquals(187f, root_child0_child0_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0_child2_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child2_child0.getLayoutY(), 0.0f); - assertEquals(98f, root_child0_child0_child2_child0.getLayoutWidth(), 0.0f); - assertEquals(197f, root_child0_child0_child2_child0.getLayoutHeight(), 0.0f); + assertEquals(93f, root_child0_child0_child2_child0.getLayoutWidth(), 0.0f); + assertEquals(187f, root_child0_child0_child2_child0.getLayoutHeight(), 0.0f); - assertEquals(93f, root_child0_child0_child2_child0_child0.getLayoutX(), 0.0f); + assertEquals(88f, root_child0_child0_child2_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child2_child0_child0.getLayoutY(), 0.0f); assertEquals(5f, root_child0_child0_child2_child0_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child0_child2_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0_child2_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child2_child0_child1.getLayoutY(), 0.0f); - assertEquals(98f, root_child0_child0_child2_child0_child1.getLayoutWidth(), 0.0f); - assertEquals(197f, root_child0_child0_child2_child0_child1.getLayoutHeight(), 0.0f); + assertEquals(93f, root_child0_child0_child2_child0_child1.getLayoutWidth(), 0.0f); + assertEquals(187f, root_child0_child0_child2_child0_child1.getLayoutHeight(), 0.0f); } private YogaNode createNode(YogaConfig config) { diff --git a/java/tests/com/facebook/yoga/YGFlexDirectionTest.java b/java/tests/com/facebook/yoga/YGFlexDirectionTest.java index 7efb1329eb..3748ca3039 100644 --- a/java/tests/com/facebook/yoga/YGFlexDirectionTest.java +++ b/java/tests/com/facebook/yoga/YGFlexDirectionTest.java @@ -1329,7 +1329,6 @@ public void test_flex_direction_row_reverse_border_left() { } @Test - @Ignore public void test_flex_direction_row_reverse_border_start() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); @@ -1468,7 +1467,6 @@ public void test_flex_direction_row_reverse_border_right() { } @Test - @Ignore public void test_flex_direction_row_reverse_border_end() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true); diff --git a/javascript/tests/generated/YGAspectRatioTest.test.ts b/javascript/tests/generated/YGAspectRatioTest.test.ts index ea6b6c552f..c2ea8353c2 100644 --- a/javascript/tests/generated/YGAspectRatioTest.test.ts +++ b/javascript/tests/generated/YGAspectRatioTest.test.ts @@ -95,28 +95,28 @@ test.skip('aspect_ratio_does_not_stretch_cross_axis_dim', () => { expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); - expect(root_child0_child0.getComputedWidth()).toBe(300); - expect(root_child0_child0.getComputedHeight()).toBe(197); + expect(root_child0_child0.getComputedWidth()).toBe(285); + expect(root_child0_child0.getComputedHeight()).toBe(187); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); - expect(root_child0_child0_child0.getComputedWidth()).toBe(197); - expect(root_child0_child0_child0.getComputedHeight()).toBe(197); + expect(root_child0_child0_child0.getComputedWidth()).toBe(187); + expect(root_child0_child0_child0.getComputedHeight()).toBe(187); - expect(root_child0_child0_child1.getComputedLeft()).toBe(197); + expect(root_child0_child0_child1.getComputedLeft()).toBe(187); expect(root_child0_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child0_child1.getComputedWidth()).toBe(5); - expect(root_child0_child0_child1.getComputedHeight()).toBe(197); + expect(root_child0_child0_child1.getComputedHeight()).toBe(187); - expect(root_child0_child0_child2.getComputedLeft()).toBe(202); + expect(root_child0_child0_child2.getComputedLeft()).toBe(192); expect(root_child0_child0_child2.getComputedTop()).toBe(0); - expect(root_child0_child0_child2.getComputedWidth()).toBe(98); - expect(root_child0_child0_child2.getComputedHeight()).toBe(197); + expect(root_child0_child0_child2.getComputedWidth()).toBe(93); + expect(root_child0_child0_child2.getComputedHeight()).toBe(187); expect(root_child0_child0_child2_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child2_child0.getComputedTop()).toBe(0); - expect(root_child0_child0_child2_child0.getComputedWidth()).toBe(98); - expect(root_child0_child0_child2_child0.getComputedHeight()).toBe(197); + expect(root_child0_child0_child2_child0.getComputedWidth()).toBe(93); + expect(root_child0_child0_child2_child0.getComputedHeight()).toBe(187); expect(root_child0_child0_child2_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child2_child0_child0.getComputedTop()).toBe(0); @@ -125,8 +125,8 @@ test.skip('aspect_ratio_does_not_stretch_cross_axis_dim', () => { expect(root_child0_child0_child2_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child0_child2_child0_child1.getComputedTop()).toBe(0); - expect(root_child0_child0_child2_child0_child1.getComputedWidth()).toBe(98); - expect(root_child0_child0_child2_child0_child1.getComputedHeight()).toBe(197); + expect(root_child0_child0_child2_child0_child1.getComputedWidth()).toBe(93); + expect(root_child0_child0_child2_child0_child1.getComputedHeight()).toBe(187); root.calculateLayout(undefined, undefined, Direction.RTL); @@ -140,40 +140,40 @@ test.skip('aspect_ratio_does_not_stretch_cross_axis_dim', () => { expect(root_child0.getComputedWidth()).toBe(300); expect(root_child0.getComputedHeight()).toBe(300); - expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedLeft()).toBe(30); expect(root_child0_child0.getComputedTop()).toBe(0); - expect(root_child0_child0.getComputedWidth()).toBe(300); - expect(root_child0_child0.getComputedHeight()).toBe(197); + expect(root_child0_child0.getComputedWidth()).toBe(285); + expect(root_child0_child0.getComputedHeight()).toBe(187); - expect(root_child0_child0_child0.getComputedLeft()).toBe(103); + expect(root_child0_child0_child0.getComputedLeft()).toBe(98); expect(root_child0_child0_child0.getComputedTop()).toBe(0); - expect(root_child0_child0_child0.getComputedWidth()).toBe(197); - expect(root_child0_child0_child0.getComputedHeight()).toBe(197); + expect(root_child0_child0_child0.getComputedWidth()).toBe(187); + expect(root_child0_child0_child0.getComputedHeight()).toBe(187); - expect(root_child0_child0_child1.getComputedLeft()).toBe(98); + expect(root_child0_child0_child1.getComputedLeft()).toBe(93); expect(root_child0_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child0_child1.getComputedWidth()).toBe(5); - expect(root_child0_child0_child1.getComputedHeight()).toBe(197); + expect(root_child0_child0_child1.getComputedHeight()).toBe(187); expect(root_child0_child0_child2.getComputedLeft()).toBe(0); expect(root_child0_child0_child2.getComputedTop()).toBe(0); - expect(root_child0_child0_child2.getComputedWidth()).toBe(98); - expect(root_child0_child0_child2.getComputedHeight()).toBe(197); + expect(root_child0_child0_child2.getComputedWidth()).toBe(93); + expect(root_child0_child0_child2.getComputedHeight()).toBe(187); expect(root_child0_child0_child2_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child2_child0.getComputedTop()).toBe(0); - expect(root_child0_child0_child2_child0.getComputedWidth()).toBe(98); - expect(root_child0_child0_child2_child0.getComputedHeight()).toBe(197); + expect(root_child0_child0_child2_child0.getComputedWidth()).toBe(93); + expect(root_child0_child0_child2_child0.getComputedHeight()).toBe(187); - expect(root_child0_child0_child2_child0_child0.getComputedLeft()).toBe(93); + expect(root_child0_child0_child2_child0_child0.getComputedLeft()).toBe(88); expect(root_child0_child0_child2_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child2_child0_child0.getComputedWidth()).toBe(5); expect(root_child0_child0_child2_child0_child0.getComputedHeight()).toBe(0); expect(root_child0_child0_child2_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child0_child2_child0_child1.getComputedTop()).toBe(0); - expect(root_child0_child0_child2_child0_child1.getComputedWidth()).toBe(98); - expect(root_child0_child0_child2_child0_child1.getComputedHeight()).toBe(197); + expect(root_child0_child0_child2_child0_child1.getComputedWidth()).toBe(93); + expect(root_child0_child0_child2_child0_child1.getComputedHeight()).toBe(187); } finally { if (typeof root !== 'undefined') { root.freeRecursive(); diff --git a/javascript/tests/generated/YGFlexDirectionTest.test.ts b/javascript/tests/generated/YGFlexDirectionTest.test.ts index 926702b0f4..56e792cf5e 100644 --- a/javascript/tests/generated/YGFlexDirectionTest.test.ts +++ b/javascript/tests/generated/YGFlexDirectionTest.test.ts @@ -1440,7 +1440,7 @@ test('flex_direction_row_reverse_border_left', () => { config.free(); } }); -test.skip('flex_direction_row_reverse_border_start', () => { +test('flex_direction_row_reverse_border_start', () => { const config = Yoga.Config.create(); let root; @@ -1590,7 +1590,7 @@ test('flex_direction_row_reverse_border_right', () => { config.free(); } }); -test.skip('flex_direction_row_reverse_border_end', () => { +test('flex_direction_row_reverse_border_end', () => { const config = Yoga.Config.create(); let root; diff --git a/tests/YGFlexDirectionErrataTest.cpp b/tests/YGFlexDirectionErrataTest.cpp index e9f1734408..6ade1898c4 100644 --- a/tests/YGFlexDirectionErrataTest.cpp +++ b/tests/YGFlexDirectionErrataTest.cpp @@ -151,3 +151,145 @@ TEST(YogaTest, flex_direction_row_reverse_margin_end_errata) { YGConfigFree(config); } + +TEST(YogaTest, flex_direction_row_reverse_border_start_errata) { + const YGConfigRef config = YGConfigNew(); + YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); + YGConfigSetErrata(config, YGErrata::YGErrataStartingEndingEdgeFromFlexDirection); + + const YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetFlexDirection(root, YGFlexDirectionRowReverse); + YGNodeStyleSetBorder(root, YGEdgeStart, 100); + YGNodeStyleSetWidth(root, 100); + YGNodeStyleSetHeight(root, 100); + + const YGNodeRef root_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0, 10); + YGNodeInsertChild(root, root_child0, 0); + + const YGNodeRef root_child1 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child1, 10); + YGNodeInsertChild(root, root_child1, 1); + + const YGNodeRef root_child2 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child2, 10); + YGNodeInsertChild(root, root_child2, 2); + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(-10, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(-20, YGNodeLayoutGetLeft(root_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1)); + + ASSERT_FLOAT_EQ(-30, YGNodeLayoutGetLeft(root_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child2)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child2)); + + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(110, YGNodeLayoutGetLeft(root_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1)); + + ASSERT_FLOAT_EQ(120, YGNodeLayoutGetLeft(root_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child2)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child2)); + + YGNodeFreeRecursive(root); + + YGConfigFree(config); +} + +TEST(YogaTest, flex_direction_row_reverse_border_end_errata) { + const YGConfigRef config = YGConfigNew(); + YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); + YGConfigSetErrata(config, YGErrata::YGErrataStartingEndingEdgeFromFlexDirection); + + const YGNodeRef root = YGNodeNewWithConfig(config); + YGNodeStyleSetFlexDirection(root, YGFlexDirectionRowReverse); + YGNodeStyleSetBorder(root, YGEdgeEnd, 100); + YGNodeStyleSetWidth(root, 100); + YGNodeStyleSetHeight(root, 100); + + const YGNodeRef root_child0 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child0, 10); + YGNodeInsertChild(root, root_child0, 0); + + const YGNodeRef root_child1 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child1, 10); + YGNodeInsertChild(root, root_child1, 1); + + const YGNodeRef root_child2 = YGNodeNewWithConfig(config); + YGNodeStyleSetWidth(root_child2, 10); + YGNodeInsertChild(root, root_child2, 2); + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1)); + + ASSERT_FLOAT_EQ(70, YGNodeLayoutGetLeft(root_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child2)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child2)); + + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child1)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child1)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1)); + + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child2)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child2)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child2)); + + YGNodeFreeRecursive(root); + + YGConfigFree(config); +} diff --git a/tests/generated/YGAspectRatioTest.cpp b/tests/generated/YGAspectRatioTest.cpp index 11144e5ee9..3e823b321d 100644 --- a/tests/generated/YGAspectRatioTest.cpp +++ b/tests/generated/YGAspectRatioTest.cpp @@ -80,28 +80,28 @@ TEST(YogaTest, aspect_ratio_does_not_stretch_cross_axis_dim) { ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); - ASSERT_FLOAT_EQ(300, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(197, YGNodeLayoutGetHeight(root_child0_child0)); + ASSERT_FLOAT_EQ(285, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(187, 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(197, YGNodeLayoutGetWidth(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(197, YGNodeLayoutGetHeight(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(187, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(187, YGNodeLayoutGetHeight(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(197, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(187, YGNodeLayoutGetLeft(root_child0_child0_child1)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child1)); ASSERT_FLOAT_EQ(5, YGNodeLayoutGetWidth(root_child0_child0_child1)); - ASSERT_FLOAT_EQ(197, YGNodeLayoutGetHeight(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(187, YGNodeLayoutGetHeight(root_child0_child0_child1)); - ASSERT_FLOAT_EQ(202, YGNodeLayoutGetLeft(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(192, YGNodeLayoutGetLeft(root_child0_child0_child2)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child2)); - ASSERT_FLOAT_EQ(98, YGNodeLayoutGetWidth(root_child0_child0_child2)); - ASSERT_FLOAT_EQ(197, YGNodeLayoutGetHeight(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(93, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(187, YGNodeLayoutGetHeight(root_child0_child0_child2)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child2_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child2_child0)); - ASSERT_FLOAT_EQ(98, YGNodeLayoutGetWidth(root_child0_child0_child2_child0)); - ASSERT_FLOAT_EQ(197, YGNodeLayoutGetHeight(root_child0_child0_child2_child0)); + ASSERT_FLOAT_EQ(93, YGNodeLayoutGetWidth(root_child0_child0_child2_child0)); + ASSERT_FLOAT_EQ(187, YGNodeLayoutGetHeight(root_child0_child0_child2_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child2_child0_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child2_child0_child0)); @@ -110,8 +110,8 @@ TEST(YogaTest, aspect_ratio_does_not_stretch_cross_axis_dim) { ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child2_child0_child1)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child2_child0_child1)); - ASSERT_FLOAT_EQ(98, YGNodeLayoutGetWidth(root_child0_child0_child2_child0_child1)); - ASSERT_FLOAT_EQ(197, YGNodeLayoutGetHeight(root_child0_child0_child2_child0_child1)); + ASSERT_FLOAT_EQ(93, YGNodeLayoutGetWidth(root_child0_child0_child2_child0_child1)); + ASSERT_FLOAT_EQ(187, YGNodeLayoutGetHeight(root_child0_child0_child2_child0_child1)); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); @@ -125,40 +125,40 @@ TEST(YogaTest, aspect_ratio_does_not_stretch_cross_axis_dim) { ASSERT_FLOAT_EQ(300, YGNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(300, YGNodeLayoutGetHeight(root_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetLeft(root_child0_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); - ASSERT_FLOAT_EQ(300, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(197, YGNodeLayoutGetHeight(root_child0_child0)); + ASSERT_FLOAT_EQ(285, YGNodeLayoutGetWidth(root_child0_child0)); + ASSERT_FLOAT_EQ(187, YGNodeLayoutGetHeight(root_child0_child0)); - ASSERT_FLOAT_EQ(103, YGNodeLayoutGetLeft(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(98, YGNodeLayoutGetLeft(root_child0_child0_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(197, YGNodeLayoutGetWidth(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(197, YGNodeLayoutGetHeight(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(187, YGNodeLayoutGetWidth(root_child0_child0_child0)); + ASSERT_FLOAT_EQ(187, YGNodeLayoutGetHeight(root_child0_child0_child0)); - ASSERT_FLOAT_EQ(98, YGNodeLayoutGetLeft(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(93, YGNodeLayoutGetLeft(root_child0_child0_child1)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child1)); ASSERT_FLOAT_EQ(5, YGNodeLayoutGetWidth(root_child0_child0_child1)); - ASSERT_FLOAT_EQ(197, YGNodeLayoutGetHeight(root_child0_child0_child1)); + ASSERT_FLOAT_EQ(187, YGNodeLayoutGetHeight(root_child0_child0_child1)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child2)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child2)); - ASSERT_FLOAT_EQ(98, YGNodeLayoutGetWidth(root_child0_child0_child2)); - ASSERT_FLOAT_EQ(197, YGNodeLayoutGetHeight(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(93, YGNodeLayoutGetWidth(root_child0_child0_child2)); + ASSERT_FLOAT_EQ(187, YGNodeLayoutGetHeight(root_child0_child0_child2)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child2_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child2_child0)); - ASSERT_FLOAT_EQ(98, YGNodeLayoutGetWidth(root_child0_child0_child2_child0)); - ASSERT_FLOAT_EQ(197, YGNodeLayoutGetHeight(root_child0_child0_child2_child0)); + ASSERT_FLOAT_EQ(93, YGNodeLayoutGetWidth(root_child0_child0_child2_child0)); + ASSERT_FLOAT_EQ(187, YGNodeLayoutGetHeight(root_child0_child0_child2_child0)); - ASSERT_FLOAT_EQ(93, YGNodeLayoutGetLeft(root_child0_child0_child2_child0_child0)); + ASSERT_FLOAT_EQ(88, YGNodeLayoutGetLeft(root_child0_child0_child2_child0_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child2_child0_child0)); ASSERT_FLOAT_EQ(5, YGNodeLayoutGetWidth(root_child0_child0_child2_child0_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child0_child2_child0_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child2_child0_child1)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child2_child0_child1)); - ASSERT_FLOAT_EQ(98, YGNodeLayoutGetWidth(root_child0_child0_child2_child0_child1)); - ASSERT_FLOAT_EQ(197, YGNodeLayoutGetHeight(root_child0_child0_child2_child0_child1)); + ASSERT_FLOAT_EQ(93, YGNodeLayoutGetWidth(root_child0_child0_child2_child0_child1)); + ASSERT_FLOAT_EQ(187, YGNodeLayoutGetHeight(root_child0_child0_child2_child0_child1)); YGNodeFreeRecursive(root); diff --git a/tests/generated/YGFlexDirectionTest.cpp b/tests/generated/YGFlexDirectionTest.cpp index 8a1101c8b7..e21d24c071 100644 --- a/tests/generated/YGFlexDirectionTest.cpp +++ b/tests/generated/YGFlexDirectionTest.cpp @@ -1336,8 +1336,6 @@ TEST(YogaTest, flex_direction_row_reverse_border_left) { } TEST(YogaTest, flex_direction_row_reverse_border_start) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); @@ -1478,8 +1476,6 @@ TEST(YogaTest, flex_direction_row_reverse_border_right) { } TEST(YogaTest, flex_direction_row_reverse_border_end) { - GTEST_SKIP(); - const YGConfigRef config = YGConfigNew(); YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);