From e3cdbaca5c0f22300932b00e141f07b6df6d6c87 Mon Sep 17 00:00:00 2001 From: xherror Date: Tue, 19 Aug 2025 20:09:47 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=AA=97=E5=8F=A3=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E9=80=82=E9=85=8DGLB=EF=BC=8CSetDecorButtonS?= =?UTF-8?q?tyle=E3=80=81setWindowShadowRadius=E3=80=81setWindowTitle?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=8A=9F=E8=83=BD=E4=B8=8D=E7=AC=A6=E5=90=88?= =?UTF-8?q?=E9=A2=84=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xherror --- wm/src/window_scene_session_impl.cpp | 4 ++-- .../animation/window_scene_session_impl_animation_test.cpp | 6 +++++- wm/test/unittest/window_scene_session_impl_test4.cpp | 7 +++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/wm/src/window_scene_session_impl.cpp b/wm/src/window_scene_session_impl.cpp index fe124cc038..2100922291 100644 --- a/wm/src/window_scene_session_impl.cpp +++ b/wm/src/window_scene_session_impl.cpp @@ -3306,7 +3306,7 @@ WMError WindowSceneSessionImpl::SetWindowTitle(const std::string& title) return WMError::WM_OK; } if (!(windowSystemConfig_.IsPcWindow() || windowSystemConfig_.IsPadWindow() || - IsDeviceFeatureCapableForFreeMultiWindow())) { + windowSystemConfig_.IsPhoneWindow() || IsDeviceFeatureCapableForFreeMultiWindow())) { TLOGE(WmsLogTag::WMS_DECOR, "device not support"); return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } @@ -4744,7 +4744,7 @@ WMError WindowSceneSessionImpl::SetWindowShadowRadius(float radius) return WMError::WM_ERROR_INVALID_WINDOW; } if (!windowSystemConfig_.IsPcWindow() && !windowSystemConfig_.IsPadWindow() && - !IsDeviceFeatureCapableForFreeMultiWindow()) { + !windowSystemConfig_.IsPhoneWindow() && !IsDeviceFeatureCapableForFreeMultiWindow()) { TLOGE(WmsLogTag::WMS_ATTRIBUTE, "This is not PC or Pad, not supported."); return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } diff --git a/wm/test/unittest/animation/window_scene_session_impl_animation_test.cpp b/wm/test/unittest/animation/window_scene_session_impl_animation_test.cpp index 16bd7bbce3..89374e2385 100644 --- a/wm/test/unittest/animation/window_scene_session_impl_animation_test.cpp +++ b/wm/test/unittest/animation/window_scene_session_impl_animation_test.cpp @@ -220,7 +220,7 @@ HWTEST_F(WindowSceneSessionImplAnimationTest, SetWindowShadowRadius, TestSize.Le window->windowSystemConfig_.windowUIType_ = WindowUIType::PHONE_WINDOW; window->property_->SetWindowType(WindowType::WINDOW_TYPE_FLOAT); ret = window->SetWindowShadowRadius(1.0f); - EXPECT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, ret); + EXPECT_EQ(WMError::WM_ERROR_NULLPTR, ret); window->windowSystemConfig_.windowUIType_ = WindowUIType::PC_WINDOW; window->property_->SetWindowType(WindowType::WINDOW_TYPE_DIALOG); @@ -238,6 +238,10 @@ HWTEST_F(WindowSceneSessionImplAnimationTest, SetWindowShadowRadius, TestSize.Le ret = window->SetWindowShadowRadius(1.0f); EXPECT_EQ(WMError::WM_OK, ret); + window->windowSystemConfig_.windowUIType_ = WindowUIType::PHONE_WINDOW; + ret = window->SetWindowShadowRadius(1.0f); + EXPECT_EQ(WMError::WM_OK, ret); + const std::string feature = "large_screen"; std::string deviceType = OHOS::system::GetParameter("const.product.devicetype", ""); auto context = std::make_shared(); diff --git a/wm/test/unittest/window_scene_session_impl_test4.cpp b/wm/test/unittest/window_scene_session_impl_test4.cpp index 63098e0ae3..750409212c 100644 --- a/wm/test/unittest/window_scene_session_impl_test4.cpp +++ b/wm/test/unittest/window_scene_session_impl_test4.cpp @@ -1100,6 +1100,13 @@ HWTEST_F(WindowSceneSessionImplTest4, SetWindowTitle, TestSize.Level1) EXPECT_EQ(window->Create(abilityContext_, session), WMError::WM_OK); EXPECT_EQ(window->SetWindowTitle(title), WMError::WM_OK); + window->windowSystemConfig_.windowUIType_ = WindowUIType::PHONE_WINDOW; + window->windowSystemConfig_.freeMultiWindowSupport_ = true; + window->windowSystemConfig_.isSystemDecorEnable_ = true; + window->property_->SetDecorEnable(true); + EXPECT_EQ(window->SetWindowTitle(title), WMError::WM_OK); + + window->windowSystemConfig_.windowUIType_ = WindowUIType::PAD_WINDOW; window->property_->SetPcAppInpadCompatibleMode(true); window->windowSystemConfig_.freeMultiWindowEnable_ = false; -- Gitee From e390a168d5b5e2ef393dc42e274eb91c38460f6a Mon Sep 17 00:00:00 2001 From: xherror Date: Tue, 19 Aug 2025 20:09:47 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=AA=97=E5=8F=A3=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E9=80=82=E9=85=8DGLB=EF=BC=8CSetDecorButtonS?= =?UTF-8?q?tyle=E3=80=81setWindowShadowRadius=E3=80=81setWindowTitle?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=8A=9F=E8=83=BD=E4=B8=8D=E7=AC=A6=E5=90=88?= =?UTF-8?q?=E9=A2=84=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wm/test/unittest/window_scene_session_impl_test4.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/wm/test/unittest/window_scene_session_impl_test4.cpp b/wm/test/unittest/window_scene_session_impl_test4.cpp index 750409212c..640a8286ce 100644 --- a/wm/test/unittest/window_scene_session_impl_test4.cpp +++ b/wm/test/unittest/window_scene_session_impl_test4.cpp @@ -1081,8 +1081,6 @@ HWTEST_F(WindowSceneSessionImplTest4, SetWindowTitle, TestSize.Level1) sptr session = sptr::MakeSptr(sessionInfo); window->hostSession_ = session; window->property_->SetPersistentId(1); - window->windowSystemConfig_.windowUIType_ = WindowUIType::PHONE_WINDOW; - EXPECT_EQ(window->SetWindowTitle(title), WMError::WM_ERROR_DEVICE_NOT_SUPPORT); window->windowSystemConfig_.windowUIType_ = WindowUIType::PC_WINDOW; window->windowSystemConfig_.freeMultiWindowSupport_ = false; window->windowSystemConfig_.isSystemDecorEnable_ = false; -- Gitee