diff --git a/window_scene/session/host/src/system_session.cpp b/window_scene/session/host/src/system_session.cpp index 689682af96d97c808ffb908a5691b664d5ae123e..9bbafe2b2e57542edd8030c50c1a18f834bf6c49 100644 --- a/window_scene/session/host/src/system_session.cpp +++ b/window_scene/session/host/src/system_session.cpp @@ -284,7 +284,7 @@ bool SystemSession::CheckKeyEventDispatch(const std::shared_ptr& parentSessionState != SessionState::STATE_ACTIVE) || (state_ != SessionState::STATE_FOREGROUND && state_ != SessionState::STATE_ACTIVE)) { - TLOGE(WmsLogTag::WMS_DIALOG, "Dialog's parent info : [persistentId: %{publicd}d, state:%{public}d];" + TLOGE(WmsLogTag::WMS_DIALOG, "Dialog's parent info : [persistentId: %{public}d, state:%{public}d];" "Dialog info:[persistentId: %{public}d, state:%{public}d]", parentSession->GetPersistentId(), parentSessionState, GetPersistentId(), GetSessionState()); return false; diff --git a/window_scene/test/unittest/move_drag_controller_test.cpp b/window_scene/test/unittest/move_drag_controller_test.cpp index c0018cc2f161050db4902cb880f3c73e4c22ab22..2b42064bf77ba627ccd937738158d4b543ef4f7f 100644 --- a/window_scene/test/unittest/move_drag_controller_test.cpp +++ b/window_scene/test/unittest/move_drag_controller_test.cpp @@ -191,18 +191,6 @@ HWTEST_F(MoveDragControllerTest, GetTargetRect, TestSize.Level1) ASSERT_EQ(pos, res.posY_); } -/** - * @tc.name: InitMoveDragProperty - * @tc.desc: test function : InitMoveDragProperty - * @tc.type: FUNC - */ -HWTEST_F(MoveDragControllerTest, InitMoveDragProperty, TestSize.Level1) -{ - int32_t res = 0; - moveDragController->InitMoveDragProperty(); - ASSERT_EQ(0, res); -} - /** * @tc.name: InitCrossDisplayProperty * @tc.desc: test function : InitCrossDisplayProperty @@ -330,13 +318,11 @@ HWTEST_F(MoveDragControllerTest, UpdateGravityWhenDrag, TestSize.Level0) */ HWTEST_F(MoveDragControllerTest, CalcMoveTargetRect, TestSize.Level1) { - int32_t res = 0; moveDragController->InitMoveDragProperty(); std::shared_ptr pointerEvent = MMI::PointerEvent::Create(); WSRect originalRect = { 100, 100, 1000, 1000 }; - moveDragController->CalcMoveTargetRect(pointerEvent, originalRect); - ASSERT_EQ(0, res); + EXPECT_FALSE(moveDragController->CalcMoveTargetRect(pointerEvent, originalRect)); pointerEvent = MMI::PointerEvent::Create(); int32_t pointerId = pointerEvent->GetPointerId(); @@ -347,8 +333,7 @@ HWTEST_F(MoveDragControllerTest, CalcMoveTargetRect, TestSize.Level1) int32_t pointerWindowY = 10; moveDragController->SetOriginalMoveDragPos( pointerId, pointerType, pointerPosX, pointerPosY, pointerWindowX, pointerWindowY, originalRect); - moveDragController->CalcMoveTargetRect(pointerEvent, originalRect); - ASSERT_EQ(0, res); + EXPECT_TRUE(moveDragController->CalcMoveTargetRect(pointerEvent, originalRect)); } /** @@ -924,15 +909,14 @@ HWTEST_F(MoveDragControllerTest, TestConsumeMoveEventWithStartMove, TestSize.Lev HWTEST_F(MoveDragControllerTest, ProcessWindowDragHotAreaFunc, TestSize.Level1) { bool isSendHotAreaMessage = true; + bool isDragHotAreaFuncCalled = false; SizeChangeReason reason = SizeChangeReason::UNDEFINED; - moveDragController->ProcessWindowDragHotAreaFunc(isSendHotAreaMessage, reason); - ASSERT_EQ(true, isSendHotAreaMessage); - auto dragHotAreaFunc = [](DisplayId displayId, int32_t type, SizeChangeReason reason) { type = 0; }; - auto preFunc = moveDragController->windowDragHotAreaFunc_; + auto dragHotAreaFunc = [&isDragHotAreaFuncCalled](DisplayId displayId, int32_t type, SizeChangeReason reason) { + isDragHotAreaFuncCalled = true; + }; moveDragController->windowDragHotAreaFunc_ = dragHotAreaFunc; moveDragController->ProcessWindowDragHotAreaFunc(isSendHotAreaMessage, reason); - ASSERT_EQ(true, isSendHotAreaMessage); - moveDragController->windowDragHotAreaFunc_ = preFunc; + EXPECT_TRUE(isDragHotAreaFuncCalled); } /** @@ -1424,16 +1408,14 @@ HWTEST_F(MoveDragControllerTest, HasPointDown, TestSize.Level1) */ HWTEST_F(MoveDragControllerTest, ProcessSessionRectChange, TestSize.Level1) { - int32_t res = 0; - auto preCallback = moveDragController->moveDragCallback_; + bool isCallbackCalled = false; SizeChangeReason reason = SizeChangeReason::UNDEFINED; - MoveDragCallback callBack = [](SizeChangeReason reason) { return; }; + MoveDragCallback callBack = [&isCallbackCalled](SizeChangeReason reason) { + isCallbackCalled = true; + }; moveDragController->moveDragCallback_ = callBack; moveDragController->ProcessSessionRectChange(reason); - moveDragController->moveDragCallback_ = nullptr; - moveDragController->ProcessSessionRectChange(reason); - moveDragController->moveDragCallback_ = preCallback; - ASSERT_EQ(0, res); + EXPECT_TRUE(isCallbackCalled); } /** diff --git a/wmserver/test/unittest/window_layout_policy_test.cpp b/wmserver/test/unittest/window_layout_policy_test.cpp index 4cfd2fc17db302d888b7dc58bcc0a7931b2ec72c..1f2f983bb34876d7948be3d13cd0e991d20c76dc 100644 --- a/wmserver/test/unittest/window_layout_policy_test.cpp +++ b/wmserver/test/unittest/window_layout_policy_test.cpp @@ -200,10 +200,10 @@ HWTEST_F(WindowLayoutPolicyTest, UpdateFloatingWindowSizeForStretchableWindow01, windowInfo_.dragType_ = DragType::DRAG_LEFT_OR_RIGHT; windowInfo_.reason_ = WindowSizeChangeReason::DRAG; sptr node = CreateWindowNode(windowInfo_); + node->property_->SetStretchable(true); Rect newWinRect = { 50, 50, 200, 200 }; // rect: 50, 50, 200, 200 layoutPolicy_->UpdateFloatingWindowSizeForStretchableWindow(node, { 0, 0, 0, 0 }, newWinRect); - Rect expRect = { 50, 50, 200, 300 }; // rect: 50, 50, 200, 300 - ASSERT_EQ(expRect, expRect); + ASSERT_EQ(node->GetDragType(), DragType::DRAG_LEFT_OR_RIGHT); } /** @@ -217,10 +217,10 @@ HWTEST_F(WindowLayoutPolicyTest, UpdateFloatingWindowSizeForStretchableWindow02, windowInfo_.dragType_ = DragType::DRAG_LEFT_TOP_CORNER; windowInfo_.reason_ = WindowSizeChangeReason::DRAG; sptr node = CreateWindowNode(windowInfo_); + node->property_->SetStretchable(true); Rect newWinRect = { 50, 50, 200, 200 }; // rect: 50, 50, 200, 200 layoutPolicy_->UpdateFloatingWindowSizeForStretchableWindow(node, { 0, 0, 0, 0 }, newWinRect); - Rect expRect = { 50, 50, 200, 300 }; // rect: 50, 50, 200, 300 - ASSERT_EQ(expRect, expRect); + ASSERT_EQ(node->GetDragType(), DragType::DRAG_LEFT_OR_RIGHT); } /** @@ -234,10 +234,10 @@ HWTEST_F(WindowLayoutPolicyTest, UpdateFloatingWindowSizeForStretchableWindow03, windowInfo_.dragType_ = DragType::DRAG_BOTTOM_OR_TOP; windowInfo_.reason_ = WindowSizeChangeReason::DRAG; sptr node = CreateWindowNode(windowInfo_); + node->property_->SetStretchable(true); Rect newWinRect = { 50, 50, 150, 300 }; // rect: 50, 50, 150, 300 layoutPolicy_->UpdateFloatingWindowSizeForStretchableWindow(node, { 0, 0, 0, 0 }, newWinRect); - Rect expRect = { 50, 50, 200, 300 }; // rect: 50, 50, 200, 300 - ASSERT_EQ(expRect, expRect); + ASSERT_EQ(node->GetDragType(), DragType::DRAG_LEFT_OR_RIGHT); } /**