diff --git a/tests/YGMeasureTest.cpp b/tests/YGMeasureTest.cpp index ec2d0ce96f..6b2c51877f 100644 --- a/tests/YGMeasureTest.cpp +++ b/tests/YGMeasureTest.cpp @@ -634,7 +634,7 @@ TEST(YogaTest, percent_with_text_node) { YGNodeStyleSetJustifyContent(root, YGJustifySpaceBetween); YGNodeStyleSetAlignItems(root, YGAlignCenter); YGNodeStyleSetWidth(root, 100); - YGNodeStyleSetHeight(root, 20); + YGNodeStyleSetHeight(root, 80); const YGNodeRef root_child0 = YGNodeNewWithConfig(config); YGNodeInsertChild(root, root_child0, 0); @@ -643,6 +643,7 @@ TEST(YogaTest, percent_with_text_node) { YGNodeSetMeasureFunc(root_child1, _measure_90_10); YGNodeStyleSetMaxWidthPercent(root_child1, 50); + YGNodeStyleSetPaddingPercent(root_child1, YGEdgeTop, 50); YGNodeInsertChild(root, root_child1, 1); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); @@ -650,17 +651,17 @@ TEST(YogaTest, percent_with_text_node) { ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root)); - ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root)); + ASSERT_FLOAT_EQ(80, YGNodeLayoutGetHeight(root)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); - ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1)); - ASSERT_FLOAT_EQ(5, YGNodeLayoutGetTop(root_child1)); + ASSERT_FLOAT_EQ(15, YGNodeLayoutGetTop(root_child1)); ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1)); - ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child1)); YGNodeFreeRecursive(root); diff --git a/yoga/Yoga.c b/yoga/Yoga.c index 4db790cf7b..719caa3d5f 100644 --- a/yoga/Yoga.c +++ b/yoga/Yoga.c @@ -1776,7 +1776,7 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions(const YGNodeRef node, ? measuredSize.width + paddingAndBorderAxisRow : availableWidth - marginAxisRow, parentWidth, - availableWidth); + parentWidth); node->layout.measuredDimensions[YGDimensionHeight] = YGNodeBoundAxis(node, YGFlexDirectionColumn, @@ -1785,7 +1785,7 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions(const YGNodeRef node, ? measuredSize.height + paddingAndBorderAxisColumn : availableHeight - marginAxisColumn, parentHeight, - availableWidth); + parentWidth); } }