mirror of
https://gitee.com/openharmony/window_window_manager
synced 2024-11-23 15:00:12 +00:00
commit
7f78a6eb46
@ -17,6 +17,7 @@
|
||||
#include "display_manager.h"
|
||||
#include "display_manager_proxy.h"
|
||||
#include "window.h"
|
||||
#include "dm_common.h"
|
||||
|
||||
#include "mock_display_manager_adapter.h"
|
||||
#include "singleton_mocker.h"
|
||||
@ -792,6 +793,18 @@ HWTEST_F(DisplayManagerTest, IsCaptured01, Function | SmallTest | Level1)
|
||||
auto ret = DisplayManager::GetInstance().IsCaptured();
|
||||
ASSERT_FALSE(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: isinsideof
|
||||
* @tc.desc: isinside0f fun
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DisplayManagerTest, isinsideof, Function | SmallTest | Level1)
|
||||
{
|
||||
DMRect rect = {2, 2, 2, 2};
|
||||
DMRect rect1 = {2, 2, 2, 2};
|
||||
ASSERT_EQ(rect.IsInsideOf(rect1), true);
|
||||
}
|
||||
}
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
@ -187,6 +187,70 @@ HWTEST_F(DisplayTest, HasImmersiveWindow, Function | SmallTest | Level1)
|
||||
DMError ret = defaultDisplay_->HasImmersiveWindow(immersive);
|
||||
ASSERT_EQ(ret, DMError::DM_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetPhysicalWidth
|
||||
* @tc.desc: test GetPhysicalWidth
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DisplayTest, GetPhysicalWidth, Function | SmallTest | Level1)
|
||||
{
|
||||
auto physicalwidth = defaultDisplay_->GetPhysicalWidth();
|
||||
ASSERT_EQ(physicalwidth, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetPhysicalHeight
|
||||
* @tc.desc: test GetPhysicalHeight
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DisplayTest, GetPhysicalHeight, Function | SmallTest | Level1)
|
||||
{
|
||||
auto physicalheight = defaultDisplay_->GetPhysicalHeight();
|
||||
ASSERT_EQ(physicalheight, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetAvailableArea
|
||||
* @tc.desc: test GetAvailableArea
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DisplayTest, GetAvailableArea, Function | SmallTest | Level1)
|
||||
{
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
EXPECT_CALL(m->Mock(), GetAvailableArea(_, _)).Times(1).WillOnce(Return(DMError::DM_OK));
|
||||
DMRect area;
|
||||
auto res = defaultDisplay_ ->GetAvailableArea(area);
|
||||
ASSERT_EQ(DMError::DM_OK, res);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetSupportedHDRFormats
|
||||
* @tc.desc: test GetSupportedHDRFormats
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DisplayTest, GetSupportedHDRFormats, Function | SmallTest | Level1)
|
||||
{
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
EXPECT_CALL(m->Mock(), GetSupportedHDRFormats(_, _)).Times(1).WillOnce(Return(DMError::DM_OK));
|
||||
std::vector<uint32_t> hdrFormats;
|
||||
auto res = defaultDisplay_ ->GetSupportedHDRFormats(hdrFormats);
|
||||
ASSERT_EQ(DMError::DM_OK, res);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetSupportedColorSpaces
|
||||
* @tc.desc: test GetSupportedColorSpaces
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DisplayTest, GetSupportedColorSpaces, Function | SmallTest | Level1)
|
||||
{
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
EXPECT_CALL(m->Mock(), GetSupportedColorSpaces(_, _)).Times(1).WillOnce(Return(DMError::DM_OK));
|
||||
std::vector<uint32_t> colorSpaces;
|
||||
auto res = defaultDisplay_ -> GetSupportedColorSpaces(colorSpaces);
|
||||
ASSERT_EQ(DMError::DM_OK, res);
|
||||
}
|
||||
}
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
@ -408,6 +408,20 @@ HWTEST_F(ScreenTest, SetDensityDpiSystem, Function | SmallTest | Level2)
|
||||
res = screen_->SetDensityDpiSystem(100);
|
||||
ASSERT_EQ(DMError::DM_OK, res);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetDensityInCurResolution
|
||||
* @tc.desc: GetDensityInCurResolution
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ScreenTest, GetDensityInCurResolution, Function | SmallTest | Level2)
|
||||
{
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
EXPECT_CALL(m->Mock(), GetDensityInCurResolution(_, _)).Times(1).WillOnce(Return(DMError::DM_OK));
|
||||
float virtualPixelRatio;
|
||||
auto res = screen_->GetDensityInCurResolution(virtualPixelRatio);
|
||||
ASSERT_EQ(DMError::DM_OK, res);
|
||||
}
|
||||
}
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
@ -244,6 +244,22 @@ HWTEST_F(DisplayTestLite, GetCutoutInfo, Function | SmallTest | Level1)
|
||||
ASSERT_EQ(info, nullptr);
|
||||
GTEST_LOG_(INFO) << "DisplayLite::GetCutoutInfo end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetRotation
|
||||
* @tc.desc: UpdateDisplayInfo with nullptr
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: issueI5K0JP
|
||||
*/
|
||||
HWTEST_F(DisplayTestLite, GetRotation, Function | SmallTest | Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "DisplayLite::GetRotation start";
|
||||
sptr<DisplayInfo> displayInfo = nullptr;
|
||||
sptr<DisplayLite> display = new DisplayLite("", displayInfo);
|
||||
Rotation res = display->GetRotation();
|
||||
ASSERT_EQ(res, Rotation::ROTATION_0);
|
||||
GTEST_LOG_(INFO) << "DisplayLite::GetRotation end";
|
||||
}
|
||||
}
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
@ -41,6 +41,9 @@ public:
|
||||
MOCK_METHOD1(NotifyDisplayEvent, void(DisplayEvent event));
|
||||
MOCK_METHOD1(GetDisplayInfo, sptr<DisplayInfo>(DisplayId displayId));
|
||||
MOCK_METHOD1(GetCutoutInfo, sptr<CutoutInfo>(DisplayId displayId));
|
||||
MOCK_METHOD2(GetAvailableArea, DMError(ScreenId screenId, DMRect& area));
|
||||
MOCK_METHOD2(GetSupportedHDRFormats, DMError(ScreenId screenId, std::vector<uint32_t>& hdrFormats));
|
||||
MOCK_METHOD2(GetSupportedColorSpaces, DMError(ScreenId screenId, std::vector<uint32_t>& colorSpaces));
|
||||
};
|
||||
|
||||
class MockScreenManagerAdapter : public ScreenManagerAdapter {
|
||||
@ -73,6 +76,7 @@ public:
|
||||
MOCK_METHOD2(SetScreenGamutMap, DMError(ScreenId screenId, ScreenGamutMap gamutMap));
|
||||
MOCK_METHOD1(SetScreenColorTransform, DMError(ScreenId screenId));
|
||||
MOCK_METHOD2(SetOrientation, DMError(ScreenId screenId, Orientation orientation));
|
||||
MOCK_METHOD2(GetDensityInCurResolution, DMError(ScreenId screenId, float& virtualPixelRatio));
|
||||
MOCK_METHOD2(GetPixelFormat, DMError(ScreenId screenId, GraphicPixelFormat& pixelFormat));
|
||||
MOCK_METHOD2(SetPixelFormat, DMError(ScreenId screenId, GraphicPixelFormat pixelFormat));
|
||||
MOCK_METHOD2(GetSupportedHDRFormats, DMError(ScreenId screenId, std::vector<ScreenHDRFormat>& hdrFormats));
|
||||
|
Loading…
Reference in New Issue
Block a user