!8024 补充UT测试用例

Merge pull request !8024 from yanzhimo1/master
This commit is contained in:
openharmony_ci 2024-08-10 06:22:56 +00:00 committed by Gitee
commit 91b24e0816
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 87 additions and 1 deletions

View File

@ -1525,6 +1525,77 @@ HWTEST_F(WindowSessionTest, SetTouchHotAreas, Function | SmallTest | Level2)
session_->property_->SetTouchHotAreas(touchHotAreas);
ASSERT_EQ(touchHotAreas, session_->property_->touchHotAreas_);
}
/**
* @tc.name: NotifyOccupiedAreaChangeInfo
* @tc.desc: NotifyOccupiedAreaChangeInfo test
* @tc.type: FUNC
*/
HWTEST_F(WindowSessionTest, NotifyOccupiedAreaChangeInfo, Function | SmallTest | Level2)
{
sptr<SessionStageMocker> mockSessionStage = new (std::nothrow) SessionStageMocker();
EXPECT_NE(mockSessionStage, nullptr);
session_->sessionStage_ = mockSessionStage;
session_->NotifyOccupiedAreaChangeInfo(nullptr, nullptr);
EXPECT_NE(session_->sessionStage_, nullptr);
}
/**
* @tc.name: ProcessBackEvent
* @tc.desc: ProcessBackEvent test
* @tc.type: FUNC
*/
HWTEST_F(WindowSessionTest, ProcessBackEvent, Function | SmallTest | Level2)
{
sptr<SessionStageMocker> mockSessionStage = new (std::nothrow) SessionStageMocker();
EXPECT_NE(mockSessionStage, nullptr);
session_->sessionStage_ = mockSessionStage;
session_->sessionInfo_.isSystem_ = false;
session_->state_ = SessionState::STATE_FOREGROUND;
auto ret = session_->ProcessBackEvent();
ASSERT_NE(ret, WSError::WS_ERROR_INVALID_SESSION);
}
/**
* @tc.name: ProcessBackGetAndSetSessionRequestRectEvent
* @tc.desc: GetSessionRequestRectEvent, SetSessionRequestRectEvent test
* @tc.type: FUNC
*/
HWTEST_F(WindowSessionTest, GetAndSetSessionRequestRect, Function | SmallTest | Level2)
{
session_->SetSessionProperty(nullptr);
session_->GetSessionRequestRect();
ASSERT_EQ(session_->property_, nullptr);
WSRect rect = {0, 0, 0, 0};
session_->SetSessionRequestRect(rect);
ASSERT_EQ(session_->property_, nullptr);
}
/**
* @tc.name: SetSessionLastRect01
* @tc.desc: SetSessionLastRect test
* @tc.type: FUNC
*/
HWTEST_F(WindowSessionTest, SetSessionLastRect01, Function | SmallTest | Level2)
{
WSRect rect = session_->GetSessionLastRect();
session_->SetSessionLastRect(rect);
ASSERT_EQ(rect, session_->lastWinRect_);
}
/**
* @tc.name: SetSessionRect01
* @tc.desc: SetSessionRect test
* @tc.type: FUNC
*/
HWTEST_F(WindowSessionTest, SetSessionRect01, Function | SmallTest | Level2)
{
WSRect rect = session_->GetSessionRect();
session_->SetSessionRect(rect);
ASSERT_EQ(rect, session_->winRect_);
}
}
} // namespace Rosen
} // namespace OHOS

View File

@ -1941,7 +1941,6 @@ HWTEST_F(WindowSessionTest2, ShouldCreateDetectTaskInRecent, Function | SmallTes
*/
HWTEST_F(WindowSessionTest2, CreateWindowStateDetectTask, Function | SmallTest | Level2)
{
ssm_ = sptr<SceneSessionManager>::MakeSptr();
auto isScreenLockedCallback = [this]() { return ssm_->IsScreenLocked(); };
session_->RegisterIsScreenLockedCallback(isScreenLockedCallback);
session_->SetSessionState(SessionState::STATE_CONNECT);

View File

@ -942,6 +942,10 @@ HWTEST_F(WindowSessionTest3, UpdateWindowMode, Function | SmallTest | Level2)
session_->state_ = SessionState::STATE_CONNECT;
result = session_->UpdateWindowMode(WindowMode::WINDOW_MODE_SPLIT_PRIMARY);
EXPECT_EQ(result, WSError::WS_OK);
session_->state_ = SessionState::STATE_CONNECT;
result = session_->UpdateWindowMode(WindowMode::WINDOW_MODE_UNDEFINED);
EXPECT_EQ(result, WSError::WS_OK);
}
/**
@ -1025,6 +1029,18 @@ HWTEST_F(WindowSessionTest3, NotifySessionInfoChange, Function | SmallTest | Lev
session_->NotifySessionInfoChange();
ASSERT_EQ(resultValue, 1);
}
/**
* @tc.name: RectSizeCheckProcess01
* @tc.desc: RectSizeCheckProcess Test
* @tc.type: FUNC
*/
HWTEST_F(WindowSessionTest3, RectSizeCheckProcess01, Function | SmallTest | Level2)
{
session_->SetSessionProperty(nullptr);
session_->RectSizeCheckProcess(1, 1, 2, 2, 0);
ASSERT_EQ(session_->property_, nullptr);
}
}
} // namespace Rosen
} // namespace OHOS