diff --git a/tests/YGFlexDirectionErrataTest.cpp b/tests/YGFlexDirectionErrataTest.cpp deleted file mode 100644 index 969c517718..0000000000 --- a/tests/YGFlexDirectionErrataTest.cpp +++ /dev/null @@ -1,801 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// clang-format off - -#include -#include - -TEST(YogaTest, flex_direction_row_reverse_margin_start_errata) { - const YGConfigRef config = YGConfigNew(); - YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); - YGConfigSetErrata(config, YGErrata::YGErrataStartingEndingEdgeFromFlexDirection); - - const YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexDirection(root, YGFlexDirectionRowReverse); - YGNodeStyleSetMargin(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(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); -} - -TEST(YogaTest, flex_direction_row_reverse_margin_end_errata) { - const YGConfigRef config = YGConfigNew(); - YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); - YGConfigSetErrata(config, YGErrata::YGErrataStartingEndingEdgeFromFlexDirection); - - const YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexDirection(root, YGFlexDirectionRowReverse); - YGNodeStyleSetMargin(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(100, 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(100, 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); -} - -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); -} - -TEST(YogaTest, flex_direction_row_reverse_padding_start_errata) { - const YGConfigRef config = YGConfigNew(); - YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); - YGConfigSetErrata(config, YGErrata::YGErrataStartingEndingEdgeFromFlexDirection); - - const YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexDirection(root, YGFlexDirectionRowReverse); - YGNodeStyleSetPadding(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_padding_end_errata) { - const YGConfigRef config = YGConfigNew(); - YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); - YGConfigSetErrata(config, YGErrata::YGErrataStartingEndingEdgeFromFlexDirection); - - const YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetFlexDirection(root, YGFlexDirectionRowReverse); - YGNodeStyleSetPadding(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); -} - -TEST(YogaTest, flex_direction_row_reverse_pos_left_errata) { - const YGConfigRef config = YGConfigNew(); - YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); - YGConfigSetErrata(config, YGErrata::YGErrataStartingEndingEdgeFromFlexDirection); - - const YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); - YGNodeStyleSetWidth(root, 100); - YGNodeStyleSetHeight(root, 100); - - const YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetPositionType(root_child0, YGPositionTypeRelative); - YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRowReverse); - YGNodeStyleSetPosition(root_child0, YGEdgeLeft, 100); - YGNodeStyleSetWidth(root_child0, 100); - YGNodeStyleSetHeight(root_child0, 100); - YGNodeInsertChild(root, root_child0, 0); - - const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeRelative); - YGNodeStyleSetWidth(root_child0_child0, 10); - YGNodeInsertChild(root_child0, root_child0_child0, 0); - - const YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config); - YGNodeStyleSetPositionType(root_child0_child1, YGPositionTypeRelative); - YGNodeStyleSetWidth(root_child0_child1, 10); - YGNodeInsertChild(root_child0, root_child0_child1, 1); - - const YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config); - YGNodeStyleSetPositionType(root_child0_child2, YGPositionTypeRelative); - YGNodeStyleSetWidth(root_child0_child2, 10); - YGNodeInsertChild(root_child0, root_child0_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(-100, YGNodeLayoutGetLeft(root_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0)); - - ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); - ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0)); - - ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1)); - - ASSERT_FLOAT_EQ(70, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_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(100, YGNodeLayoutGetWidth(root_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0)); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); - ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0)); - - ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1)); - - ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child2)); - - YGNodeFreeRecursive(root); - - YGConfigFree(config); -} - -TEST(YogaTest, flex_direction_row_reverse_pos_right_errata) { - const YGConfigRef config = YGConfigNew(); - YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); - YGConfigSetErrata(config, YGErrata::YGErrataStartingEndingEdgeFromFlexDirection); - - const YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); - YGNodeStyleSetWidth(root, 100); - YGNodeStyleSetHeight(root, 100); - - const YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetPositionType(root_child0, YGPositionTypeRelative); - YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRowReverse); - YGNodeStyleSetPosition(root_child0, YGEdgeRight, 100); - YGNodeStyleSetWidth(root_child0, 100); - YGNodeStyleSetHeight(root_child0, 100); - YGNodeInsertChild(root, root_child0, 0); - - const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeRelative); - YGNodeStyleSetWidth(root_child0_child0, 10); - YGNodeInsertChild(root_child0, root_child0_child0, 0); - - const YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config); - YGNodeStyleSetPositionType(root_child0_child1, YGPositionTypeRelative); - YGNodeStyleSetWidth(root_child0_child1, 10); - YGNodeInsertChild(root_child0, root_child0_child1, 1); - - const YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config); - YGNodeStyleSetPositionType(root_child0_child2, YGPositionTypeRelative); - YGNodeStyleSetWidth(root_child0_child2, 10); - YGNodeInsertChild(root_child0, root_child0_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(100, YGNodeLayoutGetLeft(root_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0)); - - ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); - ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0)); - - ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1)); - - ASSERT_FLOAT_EQ(70, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_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(100, YGNodeLayoutGetWidth(root_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0)); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0)); - ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0)); - - ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1)); - - ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child2)); - - YGNodeFreeRecursive(root); - - YGConfigFree(config); -} - -TEST(YogaTest, flex_direction_column_reverse_pos_top_errata) { - const YGConfigRef config = YGConfigNew(); - YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); - YGConfigSetErrata(config, YGErrata::YGErrataStartingEndingEdgeFromFlexDirection); - - const YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); - YGNodeStyleSetWidth(root, 100); - YGNodeStyleSetHeight(root, 100); - - const YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetPositionType(root_child0, YGPositionTypeRelative); - YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionColumnReverse); - YGNodeStyleSetPosition(root_child0, YGEdgeTop, 100); - YGNodeStyleSetWidth(root_child0, 100); - YGNodeStyleSetHeight(root_child0, 100); - YGNodeInsertChild(root, root_child0, 0); - - const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeRelative); - YGNodeStyleSetWidth(root_child0_child0, 10); - YGNodeInsertChild(root_child0, root_child0_child0, 0); - - const YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config); - YGNodeStyleSetPositionType(root_child0_child1, YGPositionTypeRelative); - YGNodeStyleSetWidth(root_child0_child1, 10); - YGNodeInsertChild(root_child0, root_child0_child1, 1); - - const YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config); - YGNodeStyleSetPositionType(root_child0_child2, YGPositionTypeRelative); - YGNodeStyleSetWidth(root_child0_child2, 10); - YGNodeInsertChild(root_child0, root_child0_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(0, YGNodeLayoutGetLeft(root_child0)); - ASSERT_FLOAT_EQ(-100, YGNodeLayoutGetTop(root_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0)); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0)); - ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child0)); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child1)); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_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(-100, YGNodeLayoutGetTop(root_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0)); - - ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0)); - ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child0)); - - ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child1)); - - ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child2)); - - YGNodeFreeRecursive(root); - - YGConfigFree(config); -} - -TEST(YogaTest, flex_direction_column_reverse_pos_bottom_errata) { - const YGConfigRef config = YGConfigNew(); - YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true); - YGConfigSetErrata(config, YGErrata::YGErrataStartingEndingEdgeFromFlexDirection); - - const YGNodeRef root = YGNodeNewWithConfig(config); - YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute); - YGNodeStyleSetWidth(root, 100); - YGNodeStyleSetHeight(root, 100); - - const YGNodeRef root_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetPositionType(root_child0, YGPositionTypeRelative); - YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionColumnReverse); - YGNodeStyleSetPosition(root_child0, YGEdgeBottom, 100); - YGNodeStyleSetWidth(root_child0, 100); - YGNodeStyleSetHeight(root_child0, 100); - YGNodeInsertChild(root, root_child0, 0); - - const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config); - YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeRelative); - YGNodeStyleSetWidth(root_child0_child0, 10); - YGNodeInsertChild(root_child0, root_child0_child0, 0); - - const YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config); - YGNodeStyleSetPositionType(root_child0_child1, YGPositionTypeRelative); - YGNodeStyleSetWidth(root_child0_child1, 10); - YGNodeInsertChild(root_child0, root_child0_child1, 1); - - const YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config); - YGNodeStyleSetPositionType(root_child0_child2, YGPositionTypeRelative); - YGNodeStyleSetWidth(root_child0_child2, 10); - YGNodeInsertChild(root_child0, root_child0_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(0, YGNodeLayoutGetLeft(root_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0)); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0)); - ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child0)); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child1)); - - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_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(100, YGNodeLayoutGetTop(root_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0)); - - ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0_child0)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0)); - ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child0)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child0)); - - ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0_child1)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child1)); - ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child1)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child1)); - - ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0_child2)); - ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child2)); - ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child2)); - ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child2)); - - YGNodeFreeRecursive(root); - - YGConfigFree(config); -} diff --git a/yoga/algorithm/CalculateLayout.cpp b/yoga/algorithm/CalculateLayout.cpp index 6cf2962159..9e181d5be6 100644 --- a/yoga/algorithm/CalculateLayout.cpp +++ b/yoga/algorithm/CalculateLayout.cpp @@ -920,13 +920,9 @@ static void justifyMainAxis( const auto& style = node->getStyle(); const float leadingPaddingAndBorderMain = - node->hasErrata(Errata::StartingEndingEdgeFromFlexDirection) - ? node->getInlineStartPaddingAndBorder(mainAxis, direction, ownerWidth) - : node->getFlexStartPaddingAndBorder(mainAxis, direction, ownerWidth); + node->getFlexStartPaddingAndBorder(mainAxis, direction, ownerWidth); const float trailingPaddingAndBorderMain = - node->hasErrata(Errata::StartingEndingEdgeFromFlexDirection) - ? node->getInlineEndPaddingAndBorder(mainAxis, direction, ownerWidth) - : node->getFlexEndPaddingAndBorder(mainAxis, direction, ownerWidth); + node->getFlexEndPaddingAndBorder(mainAxis, direction, ownerWidth); const float gap = node->getGapForAxis(mainAxis); // If we are using "at most" rules in the main axis, make sure that diff --git a/yoga/node/Node.cpp b/yoga/node/Node.cpp index 1c83840875..2d26eb3772 100644 --- a/yoga/node/Node.cpp +++ b/yoga/node/Node.cpp @@ -84,33 +84,25 @@ Style::Length Node::computeEdgeValueForColumn(Edge edge) const { Edge Node::getInlineStartEdgeUsingErrata( FlexDirection flexDirection, Direction direction) const { - return hasErrata(Errata::StartingEndingEdgeFromFlexDirection) - ? flexStartEdge(flexDirection) - : inlineStartEdge(flexDirection, direction); + return inlineStartEdge(flexDirection, direction); } Edge Node::getInlineEndEdgeUsingErrata( FlexDirection flexDirection, Direction direction) const { - return hasErrata(Errata::StartingEndingEdgeFromFlexDirection) - ? flexEndEdge(flexDirection) - : inlineEndEdge(flexDirection, direction); + return inlineEndEdge(flexDirection, direction); } Edge Node::getFlexStartRelativeEdgeUsingErrata( FlexDirection flexDirection, Direction direction) const { - return hasErrata(Errata::StartingEndingEdgeFromFlexDirection) - ? Edge::Start - : flexStartRelativeEdge(flexDirection, direction); + return flexStartRelativeEdge(flexDirection, direction); } Edge Node::getFlexEndRelativeEdgeUsingErrata( FlexDirection flexDirection, Direction direction) const { - return hasErrata(Errata::StartingEndingEdgeFromFlexDirection) - ? Edge::End - : flexEndRelativeEdge(flexDirection, direction); + return flexEndRelativeEdge(flexDirection, direction); } bool Node::isFlexStartPositionDefined(FlexDirection axis, Direction direction)