diff --git a/frameworks/core/components_ng/layout/box_layout_algorithm.cpp b/frameworks/core/components_ng/layout/box_layout_algorithm.cpp index fc64e434ce9ea01163c4061d438ebdcd6dc18497..5e43c8cd24dfbb6d26be3f111c1a24ecf9011202 100644 --- a/frameworks/core/components_ng/layout/box_layout_algorithm.cpp +++ b/frameworks/core/components_ng/layout/box_layout_algorithm.cpp @@ -130,9 +130,7 @@ void BoxLayoutAlgorithm::PerformMeasureSelfWithChildList( auto margin = layoutProperty->CreateMargin(); CalcSingleSideMarginFrame(margin, singleSideFrame, maxWidth, maxHeight); } - auto childSize = layoutProperty->GetLayoutPolicyProperty()->IsMatch() - ? SizeF() - : child->GetGeometryNode()->GetMarginFrameSize(); + auto childSize = child->GetGeometryNode()->GetMarginFrameSize(); if (maxWidth < childSize.Width()) { maxWidth = childSize.Width(); } diff --git a/test/unittest/core/layout/box/box_layout_algorithm_test.cpp b/test/unittest/core/layout/box/box_layout_algorithm_test.cpp index 87dc27a777c4a26421c4fc36882f527fc958fda0..13f6911182195c39117a8320a8d86825bb7e6012 100644 --- a/test/unittest/core/layout/box/box_layout_algorithm_test.cpp +++ b/test/unittest/core/layout/box/box_layout_algorithm_test.cpp @@ -534,39 +534,4 @@ HWTEST_F(BoxLayoutAlgorithmTest, CalcLayoutPolicySingleSide001, TestSize.Level1) EXPECT_EQ(maxWidth, 60.0f); EXPECT_EQ(maxHeight, 50.0f); } - -/** - * @tc.name: WrapAndMatchParent001 - * @tc.desc:test parent wrap and child match parent - * @tc.type: FUNC - */ -HWTEST_F(BoxLayoutAlgorithmTest, WrapAndMatchParent001, TestSize.Level1) -{ - RefPtr row1; - auto layoutWrapper = CreateBox([this, &row1]() { - row1 = CreateRow([](RowModelNG model) { - }); - }); - auto geometryNode = layoutWrapper->GetGeometryNode(); - ASSERT_NE(geometryNode, nullptr); - EXPECT_FALSE(geometryNode->GetContent()); - - LayoutConstraintF parentLayoutConstraint; - auto layoutProperty = layoutWrapper->GetLayoutProperty(); - layoutProperty->UpdateLayoutConstraint(parentLayoutConstraint); - layoutProperty->UpdateContentConstraint(); - - auto childLayoutProperty = row1->GetLayoutProperty(); - ASSERT_NE(childLayoutProperty, nullptr); - childLayoutProperty->UpdateLayoutPolicyProperty(LayoutCalPolicy::MATCH_PARENT, false); - auto childGeometryNode = row1->GetGeometryNode(); - ASSERT_NE(childGeometryNode, nullptr); - childGeometryNode->SetFrameSize(SizeF(60.0f, 60.0f)); - BoxLayoutAlgorithm boxLayoutAlgorithm; - std::list> childList; - childList = layoutWrapper->GetAllChildrenWithBuild(); - boxLayoutAlgorithm.PerformMeasureSelfWithChildList(Referenced::RawPtr(layoutWrapper), childList); - - EXPECT_TRUE(NearEqual(geometryNode->GetFrameSize().Height(), 0.0f)); -} } // namespace OHOS::Ace::NG