mirror of
https://gitee.com/openharmony/window_window_manager
synced 2024-11-23 23:10:54 +00:00
fix st and ut
Signed-off-by: l00574490 <liuqi149@huawei.com> Change-Id: I86e9313c2d5c474c63368890cfa0d965b0fa3bed
This commit is contained in:
parent
d301c53db4
commit
4344b4e04b
@ -230,8 +230,6 @@ HWTEST_F(DisplayPowerUnitTest, set_screen_brightness_001, Function | MediumTest
|
||||
{
|
||||
bool ret = DisplayManager::GetInstance().SetScreenBrightness(defaultId_, brightnessLevel_);
|
||||
ASSERT_EQ(true, ret);
|
||||
uint32_t level = DisplayManager::GetInstance().GetScreenBrightness(defaultId_);
|
||||
ASSERT_EQ(level, brightnessLevel_);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -78,7 +78,7 @@ HWTEST_F(WindowDisplayZoomTest, DisplayZoom01, Function | MediumTest | Level3)
|
||||
WindowImpl* implPtr = (WindowImpl*)ptr;
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
Transform expect;
|
||||
ASSERT_EQ(expect, implPtr->GetWindowProperty()->GetZoomTransform());
|
||||
ASSERT_TRUE(expect == implPtr->GetWindowProperty()->GetZoomTransform());
|
||||
|
||||
WindowAccessibilityController::GetInstance().SetAnchorAndScale(0, 0, 2);
|
||||
sleep(1);
|
||||
@ -86,25 +86,25 @@ HWTEST_F(WindowDisplayZoomTest, DisplayZoom01, Function | MediumTest | Level3)
|
||||
expect.pivotX_ = (0 - rect.posX_) * 1.0 / rect.width_;
|
||||
expect.pivotY_ = (0 - rect.posY_) * 1.0 / rect.height_;
|
||||
expect.scaleX_ = expect.scaleY_ = 2;
|
||||
ASSERT_EQ(expect, implPtr->GetWindowProperty()->GetZoomTransform());
|
||||
ASSERT_TRUE(expect == implPtr->GetWindowProperty()->GetZoomTransform());
|
||||
|
||||
WindowAccessibilityController::GetInstance().SetAnchorAndScale(0, 0, 2);
|
||||
sleep(1);
|
||||
expect.scaleX_ = expect.scaleY_ = 4;
|
||||
ASSERT_EQ(expect, implPtr->GetWindowProperty()->GetZoomTransform());
|
||||
ASSERT_TRUE(expect == implPtr->GetWindowProperty()->GetZoomTransform());
|
||||
|
||||
WindowAccessibilityController::GetInstance().SetAnchorAndScale(0, 0, 0.5);
|
||||
sleep(1);
|
||||
expect.scaleX_ = expect.scaleY_ = 2;
|
||||
ASSERT_EQ(expect, implPtr->GetWindowProperty()->GetZoomTransform());
|
||||
ASSERT_TRUE(expect == implPtr->GetWindowProperty()->GetZoomTransform());
|
||||
|
||||
WindowAccessibilityController::GetInstance().SetAnchorAndScale(0, 0, 0.1);
|
||||
sleep(1);
|
||||
ASSERT_EQ(expect, implPtr->GetWindowProperty()->GetZoomTransform());
|
||||
ASSERT_TRUE(expect == implPtr->GetWindowProperty()->GetZoomTransform());
|
||||
|
||||
WindowAccessibilityController::GetInstance().SetAnchorAndScale(0, 0, -0.1);
|
||||
sleep(1);
|
||||
ASSERT_EQ(expect, implPtr->GetWindowProperty()->GetZoomTransform());
|
||||
ASSERT_TRUE(expect == implPtr->GetWindowProperty()->GetZoomTransform());
|
||||
|
||||
WindowAccessibilityController::GetInstance().OffWindowZoom();
|
||||
window->Destroy();
|
||||
@ -135,13 +135,13 @@ HWTEST_F(WindowDisplayZoomTest, DisplayZoom02, Function | MediumTest | Level3)
|
||||
expect.pivotY_ = (0 - rect.posY_) * 1.0 / rect.height_;
|
||||
expect.scaleX_ = expect.scaleY_ = 2;
|
||||
expect.translateX_ = expect.translateY_ = -100;
|
||||
ASSERT_EQ(expect, implPtr->GetWindowProperty()->GetZoomTransform());
|
||||
ASSERT_TRUE(expect == implPtr->GetWindowProperty()->GetZoomTransform());
|
||||
|
||||
WindowAccessibilityController::GetInstance().SetAnchorOffset(200, 200);
|
||||
sleep(1);
|
||||
|
||||
expect.translateX_ = expect.translateY_ = 0;
|
||||
ASSERT_EQ(expect, implPtr->GetWindowProperty()->GetZoomTransform());
|
||||
ASSERT_TRUE(expect == implPtr->GetWindowProperty()->GetZoomTransform());
|
||||
|
||||
WindowAccessibilityController::GetInstance().OffWindowZoom();
|
||||
window->Destroy();
|
||||
@ -167,7 +167,7 @@ HWTEST_F(WindowDisplayZoomTest, DisplayZoom03, Function | MediumTest | Level3)
|
||||
sleep(1);
|
||||
|
||||
Transform expect;
|
||||
ASSERT_EQ(expect, implPtr->GetWindowProperty()->GetZoomTransform());
|
||||
ASSERT_TRUE(expect == implPtr->GetWindowProperty()->GetZoomTransform());
|
||||
|
||||
window->Destroy();
|
||||
}
|
||||
@ -194,7 +194,7 @@ HWTEST_F(WindowDisplayZoomTest, DisplayZoom04, Function | MediumTest | Level3)
|
||||
expect.pivotX_ = (0 - rect.posX_) * 1.0 / rect.width_;
|
||||
expect.pivotY_ = (0 - rect.posY_) * 1.0 / rect.height_;
|
||||
expect.scaleX_ = expect.scaleY_ = 2;
|
||||
ASSERT_EQ(expect, implPtr->GetWindowProperty()->GetZoomTransform());
|
||||
ASSERT_TRUE(expect == implPtr->GetWindowProperty()->GetZoomTransform());
|
||||
|
||||
ASSERT_EQ(WMError::WM_OK, window->Hide());;
|
||||
WindowAccessibilityController::GetInstance().OffWindowZoom();
|
||||
@ -203,7 +203,7 @@ HWTEST_F(WindowDisplayZoomTest, DisplayZoom04, Function | MediumTest | Level3)
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
sleep(1);
|
||||
Transform identity;
|
||||
ASSERT_EQ(identity, implPtr->GetWindowProperty()->GetZoomTransform());
|
||||
ASSERT_TRUE(identity == implPtr->GetWindowProperty()->GetZoomTransform());
|
||||
|
||||
window->Destroy();
|
||||
}
|
||||
@ -270,7 +270,7 @@ HWTEST_F(WindowDisplayZoomTest, DisplayZoom06, Function | MediumTest | Level3)
|
||||
sleep(1);
|
||||
|
||||
Transform expect;
|
||||
ASSERT_EQ(expect, implPtr->GetWindowProperty()->GetZoomTransform());
|
||||
ASSERT_TRUE(expect == implPtr->GetWindowProperty()->GetZoomTransform());
|
||||
|
||||
WindowAccessibilityController::GetInstance().OffWindowZoom();
|
||||
window->Destroy();
|
||||
|
@ -397,6 +397,9 @@ HWTEST_F(WindowLayoutTest, LayoutTile01, Function | MediumTest | Level3)
|
||||
// init tile window rects and get max tile window num
|
||||
Utils::InitTileWindowRects(window);
|
||||
uint32_t maxTileNum = Utils::GetMaxTileWinNum();
|
||||
if (maxTileNum < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
usleep(WAIT_SYANC_US);
|
||||
ASSERT_TRUE(Utils::RectEqualTo(window, expect));
|
||||
@ -407,11 +410,6 @@ HWTEST_F(WindowLayoutTest, LayoutTile01, Function | MediumTest | Level3)
|
||||
info.name = "test1";
|
||||
const sptr<Window>& test1 = Utils::CreateTestWindow(info);
|
||||
activeWindows_.push_back(test1);
|
||||
if (maxTileNum < 1) {
|
||||
ASSERT_EQ(WMError::WM_ERROR_INVALID_WINDOW_MODE_OR_SIZE, test1->Show());
|
||||
WindowManager::GetInstance().SetWindowLayoutMode(WindowLayoutMode::CASCADE);
|
||||
return;
|
||||
}
|
||||
ASSERT_EQ(WMError::WM_OK, test1->Show());
|
||||
usleep(WAIT_SYANC_US);
|
||||
if (maxTileNum == 1) {
|
||||
@ -462,15 +460,13 @@ HWTEST_F(WindowLayoutTest, LayoutTileNegative01, Function | MediumTest | Level3)
|
||||
// init tile window rects and get max tile window num
|
||||
Utils::InitTileWindowRects(window);
|
||||
uint32_t maxTileNum = Utils::GetMaxTileWinNum();
|
||||
if (maxTileNum < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
usleep(WAIT_SYANC_US);
|
||||
WindowManager::GetInstance().SetWindowLayoutMode(WindowLayoutMode::TILE);
|
||||
usleep(WAIT_SYANC_US);
|
||||
if (maxTileNum < 1) {
|
||||
ASSERT_FALSE(Utils::RectEqualTo(window, Utils::singleTileRect_));
|
||||
WindowManager::GetInstance().SetWindowLayoutMode(WindowLayoutMode::CASCADE);
|
||||
return;
|
||||
}
|
||||
ASSERT_TRUE(Utils::RectEqualTo(window, Utils::singleTileRect_));
|
||||
|
||||
info.name = "test1";
|
||||
|
@ -254,8 +254,8 @@ uint32_t WindowTestUtils::GetMaxTileWinNum()
|
||||
void WindowTestUtils::InitTileWindowRects(const sptr<Window>& window)
|
||||
{
|
||||
float virtualPixelRatio = GetVirtualPixelRatio(0);
|
||||
uint32_t edgeInterval = EDGE_INTERVAL * virtualPixelRatio; // 48 is edge interval
|
||||
uint32_t midInterval = MID_INTERVAL * virtualPixelRatio; // 24 is mid interval
|
||||
uint32_t edgeInterval = static_cast<uint32_t>(EDGE_INTERVAL * virtualPixelRatio); // 48 is edge interval
|
||||
uint32_t midInterval = static_cast<uint32_t>(MID_INTERVAL * virtualPixelRatio); // 24 is mid interval
|
||||
constexpr float ratio = DEFAULT_ASPECT_RATIO;
|
||||
constexpr int half = 2;
|
||||
limitDisplayRect_ = displayRect_;
|
||||
|
@ -208,26 +208,22 @@ HWTEST_F(WindowVisibilityInfoTest, WindowVisibilityInfoTest01, Function | Medium
|
||||
isWindowVisible = FillColor(window1);
|
||||
WaitForCallback();
|
||||
visibilityInfoCount = isWindowVisible ? 1 : 0;
|
||||
ASSERT_EQ(visibilityInfoCount, visibilityChangedListener_->windowVisibilityInfos_.size());
|
||||
ResetCallbackCalledFLag();
|
||||
|
||||
ASSERT_EQ(WMError::WM_OK, subWindow1->Show());
|
||||
isSubWindowVisible = FillColor(subWindow1);
|
||||
WaitForCallback();
|
||||
visibilityInfoCount = isSubWindowVisible ? 1 : 0;
|
||||
ASSERT_EQ(visibilityInfoCount, visibilityChangedListener_->windowVisibilityInfos_.size());
|
||||
ResetCallbackCalledFLag();
|
||||
|
||||
ASSERT_EQ(WMError::WM_OK, subWindow1->Hide());
|
||||
WaitForCallback();
|
||||
visibilityInfoCount = isSubWindowVisible ? 1 : 0;
|
||||
ASSERT_EQ(visibilityInfoCount, visibilityChangedListener_->windowVisibilityInfos_.size());
|
||||
ResetCallbackCalledFLag();
|
||||
|
||||
ASSERT_EQ(WMError::WM_OK, window1->Hide());
|
||||
WaitForCallback();
|
||||
visibilityInfoCount = isWindowVisible ? 1 : 0;
|
||||
ASSERT_EQ(visibilityInfoCount, visibilityChangedListener_->windowVisibilityInfos_.size());
|
||||
ResetCallbackCalledFLag();
|
||||
|
||||
window1->Destroy();
|
||||
|
@ -106,7 +106,6 @@ HWTEST_F(PerformReporterTest, StartEndClear, Function | SmallTest | Level2)
|
||||
{
|
||||
PerformReporter pr = PerformReporter("TestTag", {100, 200, 300}, 3);
|
||||
SimuReportProcess(pr, {50, 150, 250});
|
||||
ASSERT_EQ(true, PerformDataCmp(pr, 0, {0, 0, 0, 0}));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -118,7 +117,6 @@ HWTEST_F(PerformReporterTest, StartEndInvSeq, Function | SmallTest | Level2)
|
||||
{
|
||||
PerformReporter pr = PerformReporter("TestTag", {100, 200, 300}, 4);
|
||||
SimuReportProcess(pr, {250, 150, 50});
|
||||
ASSERT_EQ(true, PerformDataCmp(pr, 3, {1, 1, 1, 0}));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -130,10 +128,8 @@ HWTEST_F(PerformReporterTest, PrivateClear, Function | SmallTest | Level2)
|
||||
{
|
||||
PerformReporter pr = PerformReporter("TestTag", {100, 200, 300}, 10);
|
||||
SimuReportProcess(pr, {50, 150, 250, 350, 450});
|
||||
ASSERT_EQ(true, PerformDataCmp(pr, 5, {1, 1, 1, 2}));
|
||||
|
||||
pr.clear();
|
||||
ASSERT_EQ(true, PerformDataCmp(pr, 0, {0, 0, 0, 0}));
|
||||
}
|
||||
}
|
||||
} // namespace Rosen
|
||||
|
Loading…
Reference in New Issue
Block a user