From 86fc7e114e59f25ccce1a8cd4c9e9d804700d3c3 Mon Sep 17 00:00:00 2001 From: hfwang0318 Date: Thu, 13 Feb 2025 14:51:38 +0800 Subject: [PATCH 1/3] add tdd for ListWindowInfo Signed-off-by: hfwang0318 --- .../unittest/scene_session_manager_test10.cpp | 287 ++++++++++++++++++ window_scene/test/unittest/session_test4.cpp | 115 +++++++ 2 files changed, 402 insertions(+) diff --git a/window_scene/test/unittest/scene_session_manager_test10.cpp b/window_scene/test/unittest/scene_session_manager_test10.cpp index eddba9494c..1ce51a4139 100644 --- a/window_scene/test/unittest/scene_session_manager_test10.cpp +++ b/window_scene/test/unittest/scene_session_manager_test10.cpp @@ -36,6 +36,7 @@ public: void SetUp() override; void TearDown() override; void InitTestSceneSession(DisplayId displayId, int32_t windowId, int32_t zOrder, bool visible, WSRect rect); + void InitTestSceneSessionForListWindowInfo(); static sptr ssm_; private: @@ -100,6 +101,87 @@ void SceneSessionManagerTest10::InitTestSceneSession(DisplayId displayId, EXPECT_EQ(windowId, sceneSession->GetPersistentId()); } +void SceneSessionManagerTest10::InitTestSceneSessionForListWindowInfo() +{ + SessionInfo sessionInfo1; + sessionInfo1.isSystem_ = false; + sptr sceneSession1 = sptr::MakeSptr(sessionInfo1, nullptr); + sceneSession1->SetVisibilityState(WINDOW_VISIBILITY_STATE_TOTALLY_OCCUSION); + WSRect rect = { 0, 0, 100, 100 }; + sceneSession1->SetSessionRect(rect); + sceneSession1->SetSessionGlobalRect(rect); + sceneSession1->SetSessionState(SessionState::STATE_FOREGROUND); + int32_t zOrder = 100; + sceneSession1->SetZOrder(zOrder); + sceneSession1->GetSessionProperty()->SetDisplayId(0); + ssm_->sceneSessionMap_.insert({ sceneSession1->GetPersistentId(), sceneSession1 }); + + SessionInfo sessionInfo2; + sessionInfo2.isSystem_ = false; + sptr sceneSession2 = sptr::MakeSptr(sessionInfo2, nullptr); + sceneSession2->SetVisibilityState(WINDOW_VISIBILITY_STATE_PARTICALLY_OCCLUSION); + rect = { 0, 0, 120, 120 }; + sceneSession2->SetSessionRect(rect); + sceneSession2->SetSessionGlobalRect(rect); + sceneSession2->SetSessionState(SessionState::STATE_FOREGROUND); + zOrder = 101; + sceneSession2->SetZOrder(zOrder); + sceneSession2->GetSessionProperty()->SetDisplayId(0); + ssm_->sceneSessionMap_.insert({ sceneSession2->GetPersistentId(), sceneSession2 }); + + SessionInfo sessionInfo3; + sessionInfo3.isSystem_ = false; + sptr sceneSession3 = sptr::MakeSptr(sessionInfo3, nullptr); + sceneSession3->SetVisibilityState(WINDOW_VISIBILITY_STATE_NO_OCCLUSION); + rect = { 0, 100, 120, 120 }; + sceneSession3->SetSessionRect(rect); + sceneSession3->SetSessionGlobalRect(rect); + sceneSession3->SetSessionState(SessionState::STATE_FOREGROUND); + zOrder = 102; + sceneSession3->SetZOrder(zOrder); + sceneSession3->GetSessionProperty()->SetDisplayId(0); + ssm_->sceneSessionMap_.insert({ sceneSession3->GetPersistentId(), sceneSession3 }); + + SessionInfo sessionInfo4; + sessionInfo4.isSystem_ = false; + sptr sceneSession4 = sptr::MakeSptr(sessionInfo4, nullptr); + sceneSession4->SetVisibilityState(WINDOW_VISIBILITY_STATE_NO_OCCLUSION); + rect = { 0, 3000, 120, 120 }; + sceneSession4->SetSessionRect(rect); + sceneSession4->SetSessionGlobalRect(rect); + sceneSession4->SetSessionState(SessionState::STATE_FOREGROUND); + zOrder = 103; + sceneSession4->SetZOrder(zOrder); + sceneSession4->GetSessionProperty()->SetDisplayId(0); + ssm_->sceneSessionMap_.insert({ sceneSession4->GetPersistentId(), sceneSession4 }); + + SessionInfo sessionInfo5; + sessionInfo5.isSystem_ = false; + sptr sceneSession5 = sptr::MakeSptr(sessionInfo5, nullptr); + sceneSession5->SetVisibilityState(WINDOW_VISIBILITY_STATE_TOTALLY_OCCUSION); + rect = { 0, 0, 100, 100 }; + sceneSession5->SetSessionRect(rect); + sceneSession5->SetSessionGlobalRect(rect); + sceneSession5->SetSessionState(SessionState::STATE_BACKGROUND); + zOrder = 0; + sceneSession5->SetZOrder(zOrder); + sceneSession5->GetSessionProperty()->SetDisplayId(0); + ssm_->sceneSessionMap_.insert({ sceneSession5->GetPersistentId(), sceneSession5 }); + + SessionInfo sessionInfo6; + sessionInfo6.isSystem_ = true; + sptr sceneSession6 = sptr::MakeSptr(sessionInfo6, nullptr); + sceneSession6->SetVisibilityState(WINDOW_VISIBILITY_STATE_NO_OCCLUSION); + rect = { 0, 200, 120, 120 }; + sceneSession6->SetSessionRect(rect); + sceneSession6->SetSessionGlobalRect(rect); + sceneSession6->SetSessionState(SessionState::STATE_FOREGROUND); + zOrder = 104; + sceneSession6->SetZOrder(zOrder); + sceneSession6->GetSessionProperty()->SetDisplayId(11); + ssm_->sceneSessionMap_.insert({ sceneSession6->GetPersistentId(), sceneSession6 }); +} + namespace { /** * @tc.name: RequestSceneSessionDestructionInner @@ -1059,6 +1141,211 @@ HWTEST_F(SceneSessionManagerTest10, MinimizeMainSession, Function | SmallTest | result = ssm_->MinimizeMainSession(sessionInfo.bundleName_, sessionInfo.appIndex_, 1); ASSERT_EQ(WMError::WM_ERROR_INVALID_PERMISSION, result); } + +/** + * @tc.name: ListWindowInfo + * @tc.desc: WM_ERROR_INVALID_PERMISSION + * @tc.type: FUNC + */ +HWTEST_F(SceneSessionManagerTest10, ListWindowInfo01, Function | SmallTest | Level3) +{ + WindowInfoOption windowInfoOption; + std::vector> infos; + ASSERT_EQ(ssm_->ListWindowInfo(windowInfoOption, infos), WMError::WM_ERROR_INVALID_PERMISSION); +} + +/** + * @tc.name: FilterForListWindowInfo01 + * @tc.desc: ALL + * @tc.type: FUNC + */ +HWTEST_F(SceneSessionManagerTest10, FilterForListWindowInfo01, Function | SmallTest | Level3) +{ + ssm_->sceneSessionMap_.clear(); + InitTestSceneSessionForListWindowInfo(); + WindowInfoOption windowInfoOption; + windowInfoOption.windowInfoFilterOption = WindowInfoFilterOption::ALL; + windowInfoOption.windowInfoTypeOption = WindowInfoTypeOption::ALL; + windowInfoOption.displayId = DISPLAY_ID_INVALID; + windowInfoOption.windowId = 0; + int32_t filterNum = 0; + for (const auto& [_, sceneSession] : ssm_->sceneSessionMap_) { + if (ssm_->FilterForListWindowInfo(windowInfoOption, sceneSession)) { + filterNum++; + } + } + ASSERT_EQ(filterNum, 6); + ssm_->sceneSessionMap_.clear(); +} + +/** + * @tc.name: FilterForListWindowInfo02 + * @tc.desc: EXCLUDE_SYSTEM + * @tc.type: FUNC + */ +HWTEST_F(SceneSessionManagerTest10, FilterForListWindowInfo02, Function | SmallTest | Level3) +{ + ssm_->sceneSessionMap_.clear(); + InitTestSceneSessionForListWindowInfo(); + WindowInfoOption windowInfoOption; + windowInfoOption.windowInfoFilterOption = WindowInfoFilterOption::EXCLUDE_SYSTEM; + windowInfoOption.windowInfoTypeOption = WindowInfoTypeOption::ALL; + windowInfoOption.displayId = DISPLAY_ID_INVALID; + windowInfoOption.windowId = 0; + int32_t filterNum = 0; + for (const auto& [_, sceneSession] : ssm_->sceneSessionMap_) { + if (ssm_->FilterForListWindowInfo(windowInfoOption, sceneSession)) { + filterNum++; + } + } + ASSERT_EQ(filterNum, 5); + ssm_->sceneSessionMap_.clear(); +} + +/** + * @tc.name: FilterForListWindowInfo03 + * @tc.desc: VISIBLE + * @tc.type: FUNC + */ +HWTEST_F(SceneSessionManagerTest10, FilterForListWindowInfo03, Function | SmallTest | Level3) +{ + ssm_->sceneSessionMap_.clear(); + InitTestSceneSessionForListWindowInfo(); + WindowInfoOption windowInfoOption; + windowInfoOption.windowInfoFilterOption = WindowInfoFilterOption::VISIBLE; + windowInfoOption.windowInfoTypeOption = WindowInfoTypeOption::ALL; + windowInfoOption.displayId = DISPLAY_ID_INVALID; + windowInfoOption.windowId = 0; + int32_t filterNum = 0; + for (const auto& [_, sceneSession] : ssm_->sceneSessionMap_) { + if (ssm_->FilterForListWindowInfo(windowInfoOption, sceneSession)) { + filterNum++; + } + } + ASSERT_EQ(filterNum, 4); + ssm_->sceneSessionMap_.clear(); +} + +/** + * @tc.name: FilterForListWindowInfo04 + * @tc.desc: FOREGROUND + * @tc.type: FUNC + */ +HWTEST_F(SceneSessionManagerTest10, FilterForListWindowInfo04, Function | SmallTest | Level3) +{ + ssm_->sceneSessionMap_.clear(); + InitTestSceneSessionForListWindowInfo(); + WindowInfoOption windowInfoOption; + windowInfoOption.windowInfoFilterOption = WindowInfoFilterOption::FOREGROUND; + windowInfoOption.windowInfoTypeOption = WindowInfoTypeOption::ALL; + windowInfoOption.displayId = DISPLAY_ID_INVALID; + windowInfoOption.windowId = 0; + int32_t filterNum = 0; + for (const auto& [_, sceneSession] : ssm_->sceneSessionMap_) { + if (ssm_->FilterForListWindowInfo(windowInfoOption, sceneSession)) { + filterNum++; + } + } + ASSERT_EQ(filterNum, 5); + ssm_->sceneSessionMap_.clear(); +} + +/** + * @tc.name: FilterForListWindowInfo05 + * @tc.desc: EXCLUDE_SYSTEM | VISIBLE + * @tc.type: FUNC + */ +HWTEST_F(SceneSessionManagerTest10, FilterForListWindowInfo05, Function | SmallTest | Level3) +{ + ssm_->sceneSessionMap_.clear(); + InitTestSceneSessionForListWindowInfo(); + WindowInfoOption windowInfoOption; + windowInfoOption.windowInfoFilterOption = WindowInfoFilterOption::EXCLUDE_SYSTEM | WindowInfoFilterOption::VISIBLE; + windowInfoOption.windowInfoTypeOption = WindowInfoTypeOption::ALL; + windowInfoOption.displayId = DISPLAY_ID_INVALID; + windowInfoOption.windowId = 0; + int32_t filterNum = 0; + for (const auto& [_, sceneSession] : ssm_->sceneSessionMap_) { + if (ssm_->FilterForListWindowInfo(windowInfoOption, sceneSession)) { + filterNum++; + } + } + ASSERT_EQ(filterNum, 3); + ssm_->sceneSessionMap_.clear(); +} + +/** + * @tc.name: FilterForListWindowInfo06 + * @tc.desc: EXCLUDE_SYSTEM | FOREGROUND + * @tc.type: FUNC + */ +HWTEST_F(SceneSessionManagerTest10, FilterForListWindowInfo06, Function | SmallTest | Level3) +{ + ssm_->sceneSessionMap_.clear(); + InitTestSceneSessionForListWindowInfo(); + WindowInfoOption windowInfoOption; + windowInfoOption.windowInfoFilterOption = WindowInfoFilterOption::EXCLUDE_SYSTEM | + WindowInfoFilterOption::FOREGROUND; + windowInfoOption.windowInfoTypeOption = WindowInfoTypeOption::ALL; + windowInfoOption.displayId = DISPLAY_ID_INVALID; + windowInfoOption.windowId = 0; + int32_t filterNum = 0; + for (const auto& [_, sceneSession] : ssm_->sceneSessionMap_) { + if (ssm_->FilterForListWindowInfo(windowInfoOption, sceneSession)) { + filterNum++; + } + } + ASSERT_EQ(filterNum, 4); + ssm_->sceneSessionMap_.clear(); +} + +/** + * @tc.name: FilterForListWindowInfo07 + * @tc.desc: FOREGROUND | VISIBLE + * @tc.type: FUNC + */ +HWTEST_F(SceneSessionManagerTest10, FilterForListWindowInfo07, Function | SmallTest | Level3) +{ + ssm_->sceneSessionMap_.clear(); + InitTestSceneSessionForListWindowInfo(); + WindowInfoOption windowInfoOption; + windowInfoOption.windowInfoFilterOption = WindowInfoFilterOption::FOREGROUND | WindowInfoFilterOption::VISIBLE; + windowInfoOption.windowInfoTypeOption = WindowInfoTypeOption::ALL; + windowInfoOption.displayId = DISPLAY_ID_INVALID; + windowInfoOption.windowId = 0; + int32_t filterNum = 0; + for (const auto& [_, sceneSession] : ssm_->sceneSessionMap_) { + if (ssm_->FilterForListWindowInfo(windowInfoOption, sceneSession)) { + filterNum++; + } + } + ASSERT_EQ(filterNum, 4); + ssm_->sceneSessionMap_.clear(); +} + +/** + * @tc.name: FilterForListWindowInfo08 + * @tc.desc: displayId = 0 + * @tc.type: FUNC + */ +HWTEST_F(SceneSessionManagerTest10, FilterForListWindowInfo08, Function | SmallTest | Level3) +{ + ssm_->sceneSessionMap_.clear(); + InitTestSceneSessionForListWindowInfo(); + WindowInfoOption windowInfoOption; + windowInfoOption.windowInfoFilterOption = WindowInfoFilterOption::ALL; + windowInfoOption.windowInfoTypeOption = WindowInfoTypeOption::ALL; + windowInfoOption.displayId = 0; + windowInfoOption.windowId = 0; + int32_t filterNum = 0; + for (const auto& [_, sceneSession] : ssm_->sceneSessionMap_) { + if (ssm_->FilterForListWindowInfo(windowInfoOption, sceneSession)) { + filterNum++; + } + } + ASSERT_EQ(filterNum, 5); + ssm_->sceneSessionMap_.clear(); +} } // namespace } } \ No newline at end of file diff --git a/window_scene/test/unittest/session_test4.cpp b/window_scene/test/unittest/session_test4.cpp index adf3c777d1..75866b98d7 100644 --- a/window_scene/test/unittest/session_test4.cpp +++ b/window_scene/test/unittest/session_test4.cpp @@ -938,6 +938,121 @@ HWTEST_F(WindowSessionTest4, GetIsMidScene, Function | SmallTest | Level2) ASSERT_EQ(result, WSError::WS_OK); ASSERT_EQ(isMidScene, false); } + +/** + * @tc.name: GetWindowUIInfoForWindowInfo01 + * @tc.desc: GetWindowUIInfoForWindowInfo Test + * @tc.type: FUNC + */ +HWTEST_F(WindowSessionTest4, GetWindowUIInfoForWindowInfo01, Function | SmallTest | Level2) +{ + SessionInfo sessionInfo; + sessionInfo.isSystem_ = false; + sptr sceneSession = sptr::MakeSptr(sessionInfo, nullptr); + sceneSession->SetVisibilityState(WINDOW_VISIBILITY_STATE_TOTALLY_OCCUSION); + WSRect rect = { 0, 0, 100, 100 }; + sceneSession->SetSessionRect(rect); + sceneSession->SetSessionGlobalRect(rect); + sceneSession->SetSessionState(SessionState::STATE_FOREGROUND); + int32_t zOrder = 100; + sceneSession->SetZOrder(zOrder); + sceneSession->GetSessionProperty()->SetDisplayId(0); + + WindowUIInfo windowUIInfo = sceneSession->GetWindowUIInfoForWindowInfo(); + ASSERT_EQ(windowUIInfo.visibilityState, sceneSession->GetVisibilityState()); +} + +/** + * @tc.name: GetWindowDisplayInfoForWindowInfo01 + * @tc.desc: GetWindowDisplayInfoForWindowInfo Test + * @tc.type: FUNC + */ +HWTEST_F(WindowSessionTest4, GetWindowDisplayInfoForWindowInfo01, Function | SmallTest | Level2) +{ + SessionInfo sessionInfo; + sessionInfo.isSystem_ = false; + sptr sceneSession = sptr::MakeSptr(sessionInfo, nullptr); + sceneSession->SetVisibilityState(WINDOW_VISIBILITY_STATE_TOTALLY_OCCUSION); + WSRect rect = { 5, 0, 100, 100 }; + sceneSession->SetSessionRect(rect); + sceneSession->SetSessionGlobalRect(rect); + sceneSession->SetSessionState(SessionState::STATE_FOREGROUND); + int32_t zOrder = 100; + sceneSession->SetZOrder(zOrder); + sceneSession->GetSessionProperty()->SetDisplayId(11); + + WindowDisplayInfo windowDisplayInfo = sceneSession->GetWindowDisplayInfoForWindowInfo(); + ASSERT_EQ(windowDisplayInfo.displayId, sceneSession->GetSessionProperty()->GetDisplayId()); +} + +/** + * @tc.name: GetWindowLayoutInfoForWindowInfo01 + * @tc.desc: GetWindowLayoutInfoForWindowInfo Test + * @tc.type: FUNC + */ +HWTEST_F(WindowSessionTest4, GetWindowLayoutInfoForWindowInfo01, Function | SmallTest | Level2) +{ + SessionInfo sessionInfo; + sessionInfo.isSystem_ = false; + sptr sceneSession = sptr::MakeSptr(sessionInfo, nullptr); + sceneSession->SetVisibilityState(WINDOW_VISIBILITY_STATE_TOTALLY_OCCUSION); + WSRect rect = { 5, 0, 100, 100 }; + sceneSession->SetSessionRect(rect); + sceneSession->SetSessionGlobalRect(rect); + sceneSession->SetSessionState(SessionState::STATE_FOREGROUND); + int32_t zOrder = 100; + sceneSession->SetZOrder(zOrder); + sceneSession->GetSessionProperty()->SetDisplayId(0); + + WindowLayoutInfo windowLayoutInfo = sceneSession->GetWindowLayoutInfoForWindowInfo(); + ASSERT_EQ(windowLayoutInfo.rect.posX_, 5); + ASSERT_EQ(windowLayoutInfo.rect.posY_, 0); + ASSERT_EQ(windowLayoutInfo.rect.width_, 100); + ASSERT_EQ(windowLayoutInfo.rect.height_, 100); +} + +/** + * @tc.name: GetWindowMetaInfoForWindowInfo01 + * @tc.desc: GetWindowMetaInfoForWindowInfo Test + * @tc.type: FUNC + */ +HWTEST_F(WindowSessionTest4, GetWindowMetaInfoForWindowInfo01, Function | SmallTest | Level2) +{ + SessionInfo sessionInfo; + sessionInfo.isSystem_ = false; + sessionInfo.bundleName_ = "bundleName"; + sessionInfo.abilityName_ = "abilityName"; + sptr sceneSession = sptr::MakeSptr(sessionInfo, nullptr); + sceneSession->GetSessionProperty()->SetWindowName("sceneSession"); + sceneSession->SetVisibilityState(WINDOW_VISIBILITY_STATE_TOTALLY_OCCUSION); + WSRect rect = { 5, 0, 100, 100 }; + sceneSession->SetSessionRect(rect); + sceneSession->SetSessionGlobalRect(rect); + sceneSession->SetSessionState(SessionState::STATE_FOREGROUND); + int32_t zOrder = 100; + sceneSession->SetZOrder(zOrder); + sceneSession->GetSessionProperty()->SetDisplayId(0); + SessionInfo sessionInfo1; + sessionInfo1.isSystem_ = true; + sessionInfo1.abilityName_ = "abilityName1"; + sptr sceneSession1 = sptr::MakeSptr(sessionInfo1, nullptr); + sceneSession1->SetVisibilityState(WINDOW_VISIBILITY_STATE_TOTALLY_OCCUSION); + rect = { 200, 0, 100, 100 }; + sceneSession1->SetSessionRect(rect); + sceneSession1->SetSessionGlobalRect(rect); + sceneSession1->SetSessionState(SessionState::STATE_FOREGROUND); + zOrder = 100; + sceneSession1->SetZOrder(zOrder); + sceneSession1->GetSessionProperty()->SetDisplayId(0); + + WindowMetaInfo windowMetaInfo = sceneSession->GetWindowMetaInfoForWindowInfo(); + ASSERT_EQ(windowMetaInfo.windowId, sceneSession->GetWindowId()); + ASSERT_EQ(windowMetaInfo.windowName, sceneSession->GetSessionProperty()->GetWindowName()); + ASSERT_EQ(windowMetaInfo.bundleName, sceneSession->GetSessionInfo().bundleName_); + ASSERT_EQ(windowMetaInfo.abilityName, sceneSession->GetSessionInfo().abilityName_); + WindowMetaInfo windowMetaInfo1 = sceneSession1->GetWindowMetaInfoForWindowInfo(); + ASSERT_EQ(windowMetaInfo1 .windowName, sceneSession1->GetSessionInfo().abilityName_); +} } } // namespace Rosen } // namespace OHOS -- Gitee From 997ae2b7f10a455b25cbc860df11c980ff4d6eba Mon Sep 17 00:00:00 2001 From: hfwang0318 Date: Thu, 13 Feb 2025 07:14:12 +0000 Subject: [PATCH 2/3] update window_scene/test/unittest/scene_session_manager_test10.cpp. Signed-off-by: hfwang0318 --- .../unittest/scene_session_manager_test10.cpp | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/window_scene/test/unittest/scene_session_manager_test10.cpp b/window_scene/test/unittest/scene_session_manager_test10.cpp index 1ce51a4139..f1ebac0c54 100644 --- a/window_scene/test/unittest/scene_session_manager_test10.cpp +++ b/window_scene/test/unittest/scene_session_manager_test10.cpp @@ -111,8 +111,6 @@ void SceneSessionManagerTest10::InitTestSceneSessionForListWindowInfo() sceneSession1->SetSessionRect(rect); sceneSession1->SetSessionGlobalRect(rect); sceneSession1->SetSessionState(SessionState::STATE_FOREGROUND); - int32_t zOrder = 100; - sceneSession1->SetZOrder(zOrder); sceneSession1->GetSessionProperty()->SetDisplayId(0); ssm_->sceneSessionMap_.insert({ sceneSession1->GetPersistentId(), sceneSession1 }); @@ -124,8 +122,6 @@ void SceneSessionManagerTest10::InitTestSceneSessionForListWindowInfo() sceneSession2->SetSessionRect(rect); sceneSession2->SetSessionGlobalRect(rect); sceneSession2->SetSessionState(SessionState::STATE_FOREGROUND); - zOrder = 101; - sceneSession2->SetZOrder(zOrder); sceneSession2->GetSessionProperty()->SetDisplayId(0); ssm_->sceneSessionMap_.insert({ sceneSession2->GetPersistentId(), sceneSession2 }); @@ -137,8 +133,6 @@ void SceneSessionManagerTest10::InitTestSceneSessionForListWindowInfo() sceneSession3->SetSessionRect(rect); sceneSession3->SetSessionGlobalRect(rect); sceneSession3->SetSessionState(SessionState::STATE_FOREGROUND); - zOrder = 102; - sceneSession3->SetZOrder(zOrder); sceneSession3->GetSessionProperty()->SetDisplayId(0); ssm_->sceneSessionMap_.insert({ sceneSession3->GetPersistentId(), sceneSession3 }); @@ -150,8 +144,6 @@ void SceneSessionManagerTest10::InitTestSceneSessionForListWindowInfo() sceneSession4->SetSessionRect(rect); sceneSession4->SetSessionGlobalRect(rect); sceneSession4->SetSessionState(SessionState::STATE_FOREGROUND); - zOrder = 103; - sceneSession4->SetZOrder(zOrder); sceneSession4->GetSessionProperty()->SetDisplayId(0); ssm_->sceneSessionMap_.insert({ sceneSession4->GetPersistentId(), sceneSession4 }); @@ -163,8 +155,6 @@ void SceneSessionManagerTest10::InitTestSceneSessionForListWindowInfo() sceneSession5->SetSessionRect(rect); sceneSession5->SetSessionGlobalRect(rect); sceneSession5->SetSessionState(SessionState::STATE_BACKGROUND); - zOrder = 0; - sceneSession5->SetZOrder(zOrder); sceneSession5->GetSessionProperty()->SetDisplayId(0); ssm_->sceneSessionMap_.insert({ sceneSession5->GetPersistentId(), sceneSession5 }); @@ -176,9 +166,8 @@ void SceneSessionManagerTest10::InitTestSceneSessionForListWindowInfo() sceneSession6->SetSessionRect(rect); sceneSession6->SetSessionGlobalRect(rect); sceneSession6->SetSessionState(SessionState::STATE_FOREGROUND); - zOrder = 104; - sceneSession6->SetZOrder(zOrder); - sceneSession6->GetSessionProperty()->SetDisplayId(11); + constexpr DisplayId SECOND_DISPLAY_ID = 11; + sceneSession6->GetSessionProperty()->SetDisplayId(SECOND_DISPLAY_ID); ssm_->sceneSessionMap_.insert({ sceneSession6->GetPersistentId(), sceneSession6 }); } -- Gitee From ce1e33f3c85b3b42e0d3aa642e0bcfd694ef794f Mon Sep 17 00:00:00 2001 From: hfwang0318 Date: Thu, 13 Feb 2025 07:16:18 +0000 Subject: [PATCH 3/3] update window_scene/test/unittest/session_test4.cpp. Signed-off-by: hfwang0318 --- window_scene/test/unittest/session_test4.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/window_scene/test/unittest/session_test4.cpp b/window_scene/test/unittest/session_test4.cpp index 75866b98d7..3038d7f3f7 100644 --- a/window_scene/test/unittest/session_test4.cpp +++ b/window_scene/test/unittest/session_test4.cpp @@ -954,8 +954,6 @@ HWTEST_F(WindowSessionTest4, GetWindowUIInfoForWindowInfo01, Function | SmallTes sceneSession->SetSessionRect(rect); sceneSession->SetSessionGlobalRect(rect); sceneSession->SetSessionState(SessionState::STATE_FOREGROUND); - int32_t zOrder = 100; - sceneSession->SetZOrder(zOrder); sceneSession->GetSessionProperty()->SetDisplayId(0); WindowUIInfo windowUIInfo = sceneSession->GetWindowUIInfoForWindowInfo(); @@ -977,9 +975,8 @@ HWTEST_F(WindowSessionTest4, GetWindowDisplayInfoForWindowInfo01, Function | Sma sceneSession->SetSessionRect(rect); sceneSession->SetSessionGlobalRect(rect); sceneSession->SetSessionState(SessionState::STATE_FOREGROUND); - int32_t zOrder = 100; - sceneSession->SetZOrder(zOrder); - sceneSession->GetSessionProperty()->SetDisplayId(11); + constexpr DisplayId SECOND_DISPLAY_ID = 11; + sceneSession->GetSessionProperty()->SetDisplayId(SECOND_DISPLAY_ID); WindowDisplayInfo windowDisplayInfo = sceneSession->GetWindowDisplayInfoForWindowInfo(); ASSERT_EQ(windowDisplayInfo.displayId, sceneSession->GetSessionProperty()->GetDisplayId()); @@ -1000,8 +997,6 @@ HWTEST_F(WindowSessionTest4, GetWindowLayoutInfoForWindowInfo01, Function | Smal sceneSession->SetSessionRect(rect); sceneSession->SetSessionGlobalRect(rect); sceneSession->SetSessionState(SessionState::STATE_FOREGROUND); - int32_t zOrder = 100; - sceneSession->SetZOrder(zOrder); sceneSession->GetSessionProperty()->SetDisplayId(0); WindowLayoutInfo windowLayoutInfo = sceneSession->GetWindowLayoutInfoForWindowInfo(); @@ -1029,8 +1024,6 @@ HWTEST_F(WindowSessionTest4, GetWindowMetaInfoForWindowInfo01, Function | SmallT sceneSession->SetSessionRect(rect); sceneSession->SetSessionGlobalRect(rect); sceneSession->SetSessionState(SessionState::STATE_FOREGROUND); - int32_t zOrder = 100; - sceneSession->SetZOrder(zOrder); sceneSession->GetSessionProperty()->SetDisplayId(0); SessionInfo sessionInfo1; sessionInfo1.isSystem_ = true; @@ -1041,8 +1034,6 @@ HWTEST_F(WindowSessionTest4, GetWindowMetaInfoForWindowInfo01, Function | SmallT sceneSession1->SetSessionRect(rect); sceneSession1->SetSessionGlobalRect(rect); sceneSession1->SetSessionState(SessionState::STATE_FOREGROUND); - zOrder = 100; - sceneSession1->SetZOrder(zOrder); sceneSession1->GetSessionProperty()->SetDisplayId(0); WindowMetaInfo windowMetaInfo = sceneSession->GetWindowMetaInfoForWindowInfo(); -- Gitee