diff --git a/wm/test/unittest/window_scene_session_impl_test4.cpp b/wm/test/unittest/window_scene_session_impl_test4.cpp index 0d53c35f1e..c9055c1d2e 100644 --- a/wm/test/unittest/window_scene_session_impl_test4.cpp +++ b/wm/test/unittest/window_scene_session_impl_test4.cpp @@ -759,6 +759,50 @@ HWTEST_F(WindowSceneSessionImplTest4, MoveTo03, Function | SmallTest | Level2) ASSERT_EQ(WMError::WM_OK, subWindow->MoveTo(5, 4)); WindowSceneSessionImpl::windowSessionMap_.erase(window->GetWindowName()); } + +/** + * @tc.name: UpdateNewSize01 + * @tc.desc: UpdateNewSize + * @tc.type: FUNC + */ +HWTEST_F(WindowSceneSessionImplTest4, UpdateNewSize01, Function | SmallTest | Level2) +{ + sptr subOption = new (std::nothrow) WindowOption(); + ASSERT_NE(nullptr, subOption); + subOption->SetWindowName("UpdateNewSize01SubWindow"); + sptr subWindow = new (std::nothrow) WindowSceneSessionImpl(subOption); + ASSERT_NE(nullptr, subWindow); + ASSERT_NE(nullptr, subWindow->property_); + subWindow->property_->SetPersistentId(1003); + SessionInfo subSessionInfo = {"CreateSubTestBundle", "CreateSubTestModule", "CreateSubTestAbility"}; + sptr subSession = new (std::nothrow) SessionMocker(subSessionInfo); + ASSERT_NE(nullptr, subSession); + subWindow->hostSession_ = subSession; + subWindow->UpdateNewSize(); + Rect windowRect = { 0, 0, 0, 0 }; + WindowLimits windowLimits = { 0, 0, 0, 0, 0.0, 0, 0 }; + subWindow->property_->SetRequestRect(windowRect); + subWindow->property_->SetWindowRect(windowRect); + subWindow->property_->SetWindowLimits(windowLimits); + subWindow->UpdateNewSize(); + windowRect.width_ = 10; + windowRect.height_ = 10; + subWindow->UpdateNewSize(); + windowRect.width_ = 0; + windowRect.height_ = 0; + ASSERT_NE(nullptr, subWindow->property_); + subWindow->property_->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING); + subWindow->UpdateNewSize(); + Rect windowRect1 = { 10, 10, 10, 10 }; + WindowLimits windowLimits1 = { 100, 100, 100, 100, 0.0, 0, 0 }; + subWindow->property_->SetRequestRect(windowRect1); + subWindow->property_->SetWindowLimits(windowLimits1); + subWindow->UpdateNewSize(); + Rect windowRect2 = { 200, 200, 200, 200 }; + subWindow->property_->SetRequestRect(windowRect2); + subWindow->UpdateNewSize(); +} + } } // namespace Rosen } // namespace OHOS \ No newline at end of file