diff --git a/frameworks/core/components_ng/pattern/toast/toast_layout_algorithm.cpp b/frameworks/core/components_ng/pattern/toast/toast_layout_algorithm.cpp index 92fa4944c0821757e528eefa04f263ba5badfd1b..3f69769f309f62f008589224057ed44c4747d3c2 100644 --- a/frameworks/core/components_ng/pattern/toast/toast_layout_algorithm.cpp +++ b/frameworks/core/components_ng/pattern/toast/toast_layout_algorithm.cpp @@ -82,6 +82,12 @@ void ToastLayoutAlgorithm::Layout(LayoutWrapper* layoutWrapper) toastProperty->ResetToastOffset(); } auto text = layoutWrapper->GetOrCreateChildByIndex(0); + CHECK_NULL_VOID(text); + auto padding = toastProperty->CreatePaddingAndBorder(); + OffsetF textOffset = padding.Offset(); + auto geometryNode = text->GetGeometryNode(); + CHECK_NULL_VOID(geometryNode); + geometryNode->SetFrameOffset(textOffset); text->Layout(); } diff --git a/test/unittest/core/pattern/overlay/overlay_manager_toast_test_ng.cpp b/test/unittest/core/pattern/overlay/overlay_manager_toast_test_ng.cpp index 5aa1662a36fad2ad6706e9eac5f245b478adef2a..10a47a78d6691e80163e7ec25158b986e999f395 100644 --- a/test/unittest/core/pattern/overlay/overlay_manager_toast_test_ng.cpp +++ b/test/unittest/core/pattern/overlay/overlay_manager_toast_test_ng.cpp @@ -796,6 +796,13 @@ HWTEST_F(OverlayManagerToastTestNg, ToastLayoutAlgorithmLayout002, TestSize.Leve toastPattern->GetToastInfo().alignment = static_cast(ToastAlignment::DEFAULT); toastLayoutAlgorithm.Layout(layoutWrapper); + + auto context = toastNode->GetContext(); + ASSERT_NE(context, nullptr); + auto toastTheme = context->GetTheme(); + ASSERT_NE(toastTheme, nullptr); + toastTheme->toastDoubleBorderEnable_ = true; + toastLayoutAlgorithm.Layout(layoutWrapper); } /**