mirror of
https://gitee.com/openharmony/window_window_manager
synced 2024-11-23 23:10:54 +00:00
Decription: 新增测试用例
IssueNo: https://gitee.com/openharmony/drivers_hdf_core/issues/IAGOZE Signed-off-by: yellow sky <huangtian10@huawei.com>
This commit is contained in:
parent
dd7e0f0584
commit
52e7ed7f8a
@ -388,6 +388,254 @@ HWTEST_F(DisplayManagerTest, GetDisplayById02, Function | SmallTest | Level1)
|
||||
auto ret = DisplayManagerLite::GetInstance().GetDisplayById(displayId);
|
||||
ASSERT_EQ(ret, nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OnDisplayCreate02
|
||||
* @tc.desc: OnDisplayCreate
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DisplayManagerTest, OnDisplayCreate02, Function | SmallTest | Level1)
|
||||
{
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
EXPECT_CALL(m->Mock(), RegisterDisplayManagerAgent(_, _)).Times(1).WillOnce(Return(DMError::DM_OK));
|
||||
sptr<DisplayManagerLite::IDisplayListener> listener = new DmMockDisplayListener();
|
||||
DisplayManagerLite::GetInstance().RegisterDisplayListener(listener);
|
||||
auto displayManagerListener = DisplayManagerLite::GetInstance().pImpl_->displayManagerListener_;
|
||||
ASSERT_NE(displayManagerListener, nullptr);
|
||||
displayManagerListener->OnDisplayCreate(nullptr);
|
||||
sptr<DisplayInfo> displayInfo = new DisplayInfo();
|
||||
displayInfo->SetDisplayId(DISPLAY_ID_INVALID);
|
||||
displayManagerListener->OnDisplayCreate(displayInfo);
|
||||
displayInfo->SetDisplayId(1000);
|
||||
displayManagerListener->OnDisplayCreate(displayInfo);
|
||||
ASSERT_NE(displayManagerListener->pImpl_, nullptr);
|
||||
displayManagerListener->pImpl_ = nullptr;
|
||||
displayManagerListener->OnDisplayCreate(displayInfo);
|
||||
DisplayManagerLite::GetInstance().pImpl_->displayManagerListener_ = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OnDisplayDestroy02
|
||||
* @tc.desc: OnDisplayDestroy02
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DisplayManagerTest, OnDisplayDestroy02, Function | SmallTest | Level1)
|
||||
{
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
EXPECT_CALL(m->Mock(), RegisterDisplayManagerAgent(_, _)).Times(1).WillOnce(Return(DMError::DM_OK));
|
||||
sptr<DisplayManagerLite::IDisplayListener> listener = new DmMockDisplayListener();
|
||||
DisplayManagerLite::GetInstance().RegisterDisplayListener(listener);
|
||||
auto displayManagerListener = DisplayManagerLite::GetInstance().pImpl_->displayManagerListener_;
|
||||
ASSERT_NE(displayManagerListener, nullptr);
|
||||
displayManagerListener->OnDisplayDestroy(DISPLAY_ID_INVALID);
|
||||
displayManagerListener->OnDisplayDestroy(10);
|
||||
displayManagerListener->pImpl_ = nullptr;
|
||||
displayManagerListener->OnDisplayDestroy(1000);
|
||||
DisplayManagerLite::GetInstance().pImpl_->displayManagerListener_ = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: ImplUpdateDisplayInfoLocked
|
||||
* @tc.desc: ImplUpdateDisplayInfoLocked fun
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DisplayManagerTest, ImplUpdateDisplayInfoLocked03, Function | SmallTest | Level1)
|
||||
{
|
||||
sptr<DisplayInfo> displayInfo = new DisplayInfo();
|
||||
displayInfo->SetDisplayId(10);
|
||||
auto ret = DisplayManagerLite::GetInstance().pImpl_->UpdateDisplayInfoLocked(displayInfo);
|
||||
ASSERT_EQ(ret, false);
|
||||
displayInfo.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: ImplUpdateDisplayInfoLocked
|
||||
* @tc.desc: ImplUpdateDisplayInfoLocked fun
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DisplayManagerTest, ImplUpdateDisplayInfoLocked04, Function | SmallTest | Level1)
|
||||
{
|
||||
sptr<DisplayInfo> displayInfo = new DisplayInfo();
|
||||
displayInfo->SetDisplayId(1000);
|
||||
auto ret = DisplayManagerLite::GetInstance().pImpl_->UpdateDisplayInfoLocked(displayInfo);
|
||||
ASSERT_EQ(ret, false);
|
||||
displayInfo.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetDisplayById
|
||||
* @tc.desc: destroyed_ == false
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DisplayManagerTest, GetDisplayById03, Function | SmallTest | Level1)
|
||||
{
|
||||
DisplayId displayId = DISPLAY_ID_INVALID;
|
||||
auto ret = DisplayManagerLite::GetInstance().GetDisplayById(displayId);
|
||||
ASSERT_EQ(ret, nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetDisplayById
|
||||
* @tc.desc: destroyed_ == false
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DisplayManagerTest, GetDisplayById04, Function | SmallTest | Level1)
|
||||
{
|
||||
DisplayId displayId = 10;
|
||||
auto ret = DisplayManagerLite::GetInstance().GetDisplayById(displayId);
|
||||
ASSERT_EQ(ret, nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: IsFoldable
|
||||
* @tc.desc: IsFoldable
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DisplayManagerTest, IsFoldable, Function | SmallTest | Level1)
|
||||
{
|
||||
sptr<DisplayInfo> displayInfo = nullptr;
|
||||
auto ret = DisplayManagerLite::GetInstance().pImpl_->IsFoldable();
|
||||
ASSERT_EQ(ret, false);
|
||||
displayInfo.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: IsFoldable01
|
||||
* @tc.desc: IsFoldable01
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DisplayManagerTest, IsFoldable01, Function | SmallTest | Level1)
|
||||
{
|
||||
sptr<DisplayInfo> displayInfo = new DisplayInfo();
|
||||
displayInfo->SetDisplayId(DISPLAY_ID_INVALID);
|
||||
auto ret = DisplayManagerLite::GetInstance().pImpl_->IsFoldable();
|
||||
ASSERT_EQ(ret, false);
|
||||
displayInfo.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: IsFoldable02
|
||||
* @tc.desc: IsFoldable02
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DisplayManagerTest, IsFoldable02, Function | SmallTest | Level1)
|
||||
{
|
||||
sptr<DisplayInfo> displayInfo = new DisplayInfo();
|
||||
displayInfo->SetDisplayId(10);
|
||||
auto ret = DisplayManagerLite::GetInstance().pImpl_->IsFoldable();
|
||||
ASSERT_EQ(ret, false);
|
||||
displayInfo.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetFoldStatus
|
||||
* @tc.desc: GetFoldStatus
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DisplayManagerTest, GetFoldStatus, Function | SmallTest | Level1)
|
||||
{
|
||||
sptr<DisplayInfo> displayInfo = nullptr;
|
||||
auto ret = DisplayManagerLite::GetInstance().pImpl_->GetFoldStatus();
|
||||
ASSERT_EQ(ret, FoldStatus::UNKNOWN);
|
||||
displayInfo.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetFoldStatus01
|
||||
* @tc.desc: GetFoldStatus01
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DisplayManagerTest, GetFoldStatus01, Function | SmallTest | Level1)
|
||||
{
|
||||
sptr<DisplayInfo> displayInfo = new DisplayInfo();
|
||||
displayInfo->SetDisplayId(DISPLAY_ID_INVALID);
|
||||
auto ret = DisplayManagerLite::GetInstance().pImpl_->GetFoldStatus();
|
||||
ASSERT_EQ(ret, FoldStatus::UNKNOWN);
|
||||
displayInfo.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetFoldStatus02
|
||||
* @tc.desc: GetFoldStatus02
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DisplayManagerTest, GetFoldStatus02, Function | SmallTest | Level1)
|
||||
{
|
||||
sptr<DisplayInfo> displayInfo = new DisplayInfo();
|
||||
displayInfo->SetDisplayId(10);
|
||||
auto ret = DisplayManagerLite::GetInstance().pImpl_->GetFoldStatus();
|
||||
ASSERT_EQ(ret, FoldStatus::UNKNOWN);
|
||||
displayInfo.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetFoldStatus03
|
||||
* @tc.desc: GetFoldStatus03
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DisplayManagerTest, GetFoldStatus03, Function | SmallTest | Level1)
|
||||
{
|
||||
sptr<DisplayInfo> displayInfo = new DisplayInfo();
|
||||
displayInfo->SetDisplayId(1000);
|
||||
auto ret = DisplayManagerLite::GetInstance().pImpl_->GetFoldStatus();
|
||||
ASSERT_EQ(ret, FoldStatus::UNKNOWN);
|
||||
displayInfo.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetFoldDisplayMode
|
||||
* @tc.desc: GetFoldDisplayMode
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DisplayManagerTest, GetFoldDisplayMode, Function | SmallTest | Level1)
|
||||
{
|
||||
sptr<DisplayInfo> displayInfo = nullptr;
|
||||
auto ret = DisplayManagerLite::GetInstance().pImpl_->GetFoldDisplayMode();
|
||||
ASSERT_EQ(ret, FoldDisplayMode::UNKNOWN);
|
||||
displayInfo.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetFoldDisplayMode01
|
||||
* @tc.desc: GetFoldDisplayMode01
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DisplayManagerTest, GetFoldDisplayMode01, Function | SmallTest | Level1)
|
||||
{
|
||||
sptr<DisplayInfo> displayInfo = new DisplayInfo();
|
||||
displayInfo->SetDisplayId(DISPLAY_ID_INVALID);
|
||||
auto ret = DisplayManagerLite::GetInstance().pImpl_->GetFoldDisplayMode();
|
||||
ASSERT_EQ(ret, FoldDisplayMode::UNKNOWN);
|
||||
displayInfo.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetFoldDisplayMode02
|
||||
* @tc.desc: GetFoldDisplayMode02
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DisplayManagerTest, GetFoldDisplayMode02, Function | SmallTest | Level1)
|
||||
{
|
||||
sptr<DisplayInfo> displayInfo = new DisplayInfo();
|
||||
displayInfo->SetDisplayId(10);
|
||||
auto ret = DisplayManagerLite::GetInstance().pImpl_->GetFoldDisplayMode();
|
||||
ASSERT_EQ(ret, FoldDisplayMode::UNKNOWN);
|
||||
displayInfo.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetFoldDisplayMode03
|
||||
* @tc.desc: GetFoldDisplayMode03
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DisplayManagerTest, GetFoldDisplayMode03, Function | SmallTest | Level1)
|
||||
{
|
||||
sptr<DisplayInfo> displayInfo = new DisplayInfo();
|
||||
displayInfo->SetDisplayId(1000);
|
||||
auto ret = DisplayManagerLite::GetInstance().pImpl_->GetFoldDisplayMode();
|
||||
ASSERT_EQ(ret, FoldDisplayMode::UNKNOWN);
|
||||
displayInfo.clear();
|
||||
}
|
||||
}
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
Loading…
Reference in New Issue
Block a user