diff --git a/window_scene/session/host/src/scene_session.cpp b/window_scene/session/host/src/scene_session.cpp index 677b8ce7c1acca1196e514989ffd724a9dfc02fd..fc414ff04391b41f35fac7de2c74f5c7f2966107 100644 --- a/window_scene/session/host/src/scene_session.cpp +++ b/window_scene/session/host/src/scene_session.cpp @@ -3048,7 +3048,8 @@ WSError SceneSession::ProcessPointDownSession(int32_t posX, int32_t posY) // notify touch outside if (specificCallback_ != nullptr && specificCallback_->onSessionTouchOutside_ && - sessionInfo_.bundleName_.find("SCBGestureBack") == std::string::npos) { + sessionInfo_.bundleName_.find("SCBGestureBack") == std::string::npos && + sessionInfo_.bundleName_.find("SCBGestureNavBar") == std::string::npos) { specificCallback_->onSessionTouchOutside_(id, GetDisplayId()); } @@ -3097,7 +3098,8 @@ void SceneSession::NotifyOutsideDownEvent(const std::shared_ptronSessionTouchOutside_ && - sessionInfo_.bundleName_.find("SCBGestureBack") == std::string::npos) { + sessionInfo_.bundleName_.find("SCBGestureBack") == std::string::npos && + sessionInfo_.bundleName_.find("SCBGestureNavBar") == std::string::npos) { specificCallback_->onSessionTouchOutside_(GetPersistentId(), GetDisplayId()); } diff --git a/window_scene/test/unittest/scene_session_test2.cpp b/window_scene/test/unittest/scene_session_test2.cpp index 4044cac88daf85a4b4e29dde253c65e76bdbd5d3..fb73798edf0f827c6aa4e635e060f113d0f279a7 100644 --- a/window_scene/test/unittest/scene_session_test2.cpp +++ b/window_scene/test/unittest/scene_session_test2.cpp @@ -944,6 +944,10 @@ HWTEST_F(SceneSessionTest2, ProcessPointDownSession, TestSize.Level1) sceneSession->specificCallback_->onOutsideDownEvent_ = nullptr; EXPECT_EQ(WSError::WS_OK, sceneSession->ProcessPointDownSession(3, 4)); + sceneSession->sessionInfo_.bundleName_ = "SCBGestureNavBar"; + sceneSession->specificCallback_->onOutsideDownEvent_ = nullptr; + EXPECT_EQ(WSError::WS_OK, sceneSession->ProcessPointDownSession(3, 4)); + info.windowInputType_ = static_cast(MMI::WindowInputType::TRANSMIT_ALL); sptr sceneSession1 = sptr::MakeSptr(info, nullptr); sceneSession1->specificCallback_ = sptr::MakeSptr(); diff --git a/window_scene/test/unittest/scene_session_test5.cpp b/window_scene/test/unittest/scene_session_test5.cpp index 1faf56afac1fd4c1050175cf5fc40f1c94e0dfef..48c3883ca20f8f7f7d4fe8998e56d3f86df760ee 100644 --- a/window_scene/test/unittest/scene_session_test5.cpp +++ b/window_scene/test/unittest/scene_session_test5.cpp @@ -256,21 +256,74 @@ HWTEST_F(SceneSessionTest5, NotifyOutsideDownEvent, TestSize.Level1) sptr specificCallback = sptr::MakeSptr(); session->specificCallback_ = specificCallback; + int resultValue1 = 0; + int resultValue2 = 0; + session->specificCallback_->onSessionTouchOutside_ = nullptr; + OnOutsideDownEvent func = [&resultValue1](int32_t x, int32_t y) { + resultValue1 += 1; + return; + }; + session->NotifyOutsideDownEvent(pointerEvent); + EXPECT_EQ(1, resultValue1); session->specificCallback_->onOutsideDownEvent_ = nullptr; session->NotifyOutsideDownEvent(pointerEvent); - OnOutsideDownEvent func = [](int32_t x, int32_t y) { return; }; + EXPECT_EQ(1, resultValue1); + auto sessionTouchOutsideFun = [&resultValue2](int32_t persistentId, DisplayId displayId) { + resultValue2 += 1; + return; + }; + session->NotifyOutsideDownEvent(pointerEvent); + EXPECT_EQ(1, resultValue2); + session->sessionInfo_.bundleName_ = "SCBGestureBack"; + session->NotifyOutsideDownEvent(pointerEvent); + EXPECT_EQ(1, resultValue2); + session->sessionInfo_.bundleName_ = "SCBGestureNavBar"; + session->NotifyOutsideDownEvent(pointerEvent); + EXPECT_EQ(1, resultValue2); +} + +/** + * @tc.name: NotifyOutsideDownEvent1 + * @tc.desc: NotifyOutsideDownEvent1 function + * @tc.type: FUNC + */ +HWTEST_F(SceneSessionTest5, NotifyOutsideDownEvent1, TestSize.Level1) +{ + SessionInfo info; + info.abilityName_ = "NotifyOutsideDownEvent"; + info.bundleName_ = "NotifyOutsideDownEvent"; + info.windowInputType_ = static_cast(MMI::WindowInputType::NORMAL); + + sptr session = sptr::MakeSptr(info, nullptr); + EXPECT_NE(session, nullptr); + std::shared_ptr pointerEvent = MMI::PointerEvent::Create(); + pointerEvent->SetPointerAction(2); + MMI::PointerEvent::PointerItem pointerItem; + pointerItem.SetPointerId(2024); + pointerEvent->AddPointerItem(pointerItem); + pointerEvent->SetPointerId(2024); + sptr specificCallback = + sptr::MakeSptr(); + session->specificCallback_ = specificCallback; + int resultValue = 0; + OnOutsideDownEvent func = [&resultValue](int32_t x, int32_t y) { + resultValue += 1; + return; + }; session->specificCallback_->onOutsideDownEvent_ = func; session->NotifyOutsideDownEvent(pointerEvent); auto res = pointerEvent->GetPointerItem(2024, pointerItem); - EXPECT_EQ(true, res); + EXPECT_EQ(1, resultValue); pointerEvent->SetPointerAction(5); session->NotifyOutsideDownEvent(pointerEvent); pointerEvent->RemoveAllPointerItems(); + EXPECT_EQ(1, resultValue); info.windowInputType_ = static_cast(MMI::WindowInputType::TRANSMIT_ALL); sptr session1 = sptr::MakeSptr(info, nullptr); session1->NotifyOutsideDownEvent(pointerEvent); + EXPECT_EQ(1, resultValue); } /**