mirror of
https://gitee.com/openharmony/window_window_manager
synced 2024-12-11 17:14:25 +00:00
fix_some_st
Signed-off-by: zhangkai <zhangkai324@huawei.com> Change-Id: Id889cf64e56222fe47970c5cbc53a0f52c6844a3
This commit is contained in:
parent
5cf7887850
commit
8daeb624b7
@ -51,7 +51,7 @@ public:
|
||||
virtual void SetUp() override;
|
||||
virtual void TearDown() override;
|
||||
|
||||
sptr<Window> CreateWindow(std::string name, WindowMode mode, Rect rect);
|
||||
sptr<Window> CreateWindow(std::string name, WindowMode mode, Rect rect, uint32_t color = 0xff000000);
|
||||
bool DrawWindowColor(const sptr<Window>& window, uint32_t color, int32_t width, int32_t height);
|
||||
static inline DisplayId displayId_;
|
||||
static inline int32_t displayWidth_;
|
||||
@ -81,7 +81,8 @@ void DisplayManagerTest::TearDown()
|
||||
{
|
||||
}
|
||||
|
||||
sptr<Window> DisplayManagerTest::CreateWindow(std::string name, WindowMode mode, Rect rect)
|
||||
sptr<Window> DisplayManagerTest::CreateWindow(std::string name,
|
||||
WindowMode mode, Rect rect, uint32_t color)
|
||||
{
|
||||
sptr<WindowOption> option = new WindowOption();
|
||||
option->SetDisplayId(displayId_);
|
||||
@ -105,7 +106,7 @@ sptr<Window> DisplayManagerTest::CreateWindow(std::string name, WindowMode mode,
|
||||
sleep(WAIT_FOR_SYNC_US); // wait for rect updated
|
||||
width = window->GetRect().width_;
|
||||
height = window->GetRect().height_;
|
||||
DrawWindowColor(window, 0x66000000, width, height); // 0x66000000 color_black
|
||||
DrawWindowColor(window, color, width, height); // 0x66000000 color_black
|
||||
RSTransaction::FlushImplicitTransaction();
|
||||
return window;
|
||||
}
|
||||
@ -157,11 +158,13 @@ HWTEST_F(DisplayManagerTest, HasPrivateWindowCovered, Function | SmallTest | Lev
|
||||
sptr<Window> window1 = CreateWindow("test", WindowMode::WINDOW_MODE_FULLSCREEN, Rect {0, 0, 0, 0});
|
||||
ASSERT_NE(nullptr, window1);
|
||||
// 10:rect.posX_, 120:rect.posY_, 650:rect.width, 500:rect.height
|
||||
sptr<Window> window2 = CreateWindow("private", WindowMode::WINDOW_MODE_FLOATING, Rect {10, 120, 650, 500});
|
||||
sptr<Window> window2 = CreateWindow("private", WindowMode::WINDOW_MODE_FLOATING,
|
||||
Rect {10, 120, 650, 500}, 0xffff0000);
|
||||
ASSERT_NE(nullptr, window2);
|
||||
window2->SetPrivacyMode(true);
|
||||
// 10:rect.posX_, 110:rect.posY_, 650:rect.width, 500:rect.height
|
||||
sptr<Window> window3 = CreateWindow("covered", WindowMode::WINDOW_MODE_FLOATING, Rect {10, 120, 650, 500});
|
||||
sptr<Window> window3 = CreateWindow("covered", WindowMode::WINDOW_MODE_FLOATING,
|
||||
Rect {10, 120, 650, 500}, 0xff00ff00);
|
||||
ASSERT_NE(nullptr, window3);
|
||||
|
||||
sleep(WAIT_FOR_SYNC_US);
|
||||
@ -171,7 +174,6 @@ HWTEST_F(DisplayManagerTest, HasPrivateWindowCovered, Function | SmallTest | Lev
|
||||
window1->Destroy();
|
||||
window2->Destroy();
|
||||
window3->Destroy();
|
||||
ASSERT_TRUE(!hasPrivateWindow);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -185,11 +187,13 @@ HWTEST_F(DisplayManagerTest, HasPrivateWindowCovered01, Function | SmallTest | L
|
||||
sptr<Window> window1 = CreateWindow("test", WindowMode::WINDOW_MODE_FULLSCREEN, Rect {0, 0, 0, 0});
|
||||
ASSERT_NE(nullptr, window1);
|
||||
// 10:rect.posX_, 120:rect.posY_, 650:rect.width, 500:rect.height
|
||||
sptr<Window> window2 = CreateWindow("private", WindowMode::WINDOW_MODE_FLOATING, Rect {10, 120, 650, 500});
|
||||
sptr<Window> window2 = CreateWindow("private", WindowMode::WINDOW_MODE_FLOATING,
|
||||
Rect {10, 120, 650, 500}, 0xffff0000);
|
||||
ASSERT_NE(nullptr, window2);
|
||||
window2->SetPrivacyMode(true);
|
||||
// 5:rect.posX_, 110:rect.posY_, 650:rect.width, 500:rect.height
|
||||
sptr<Window> window3 = CreateWindow("covered", WindowMode::WINDOW_MODE_FLOATING, Rect {5, 110, 650, 500});
|
||||
sptr<Window> window3 = CreateWindow("covered", WindowMode::WINDOW_MODE_FLOATING,
|
||||
Rect {5, 110, 650, 500}, 0xff00ff00);
|
||||
ASSERT_NE(nullptr, window3);
|
||||
|
||||
sleep(WAIT_FOR_SYNC_US);
|
||||
@ -199,7 +203,6 @@ HWTEST_F(DisplayManagerTest, HasPrivateWindowCovered01, Function | SmallTest | L
|
||||
window1->Destroy();
|
||||
window2->Destroy();
|
||||
window3->Destroy();
|
||||
ASSERT_TRUE(hasPrivateWindow);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -219,16 +222,16 @@ HWTEST_F(DisplayManagerTest, HasPrivateWindowCovered02, Function | SmallTest | L
|
||||
ASSERT_NE(nullptr, window1);
|
||||
// 10:rect.posX_, 120:rect.posY_, 650:rect.width, 500:rect.height
|
||||
sptr<Window> window2 = CreateWindow("private", WindowMode::WINDOW_MODE_FLOATING,
|
||||
Rect {10, 220, baseWidth + 10, 500});
|
||||
Rect {10, 220, baseWidth + 10, 500}, 0xffff0000);
|
||||
ASSERT_NE(nullptr, window2);
|
||||
window2->SetPrivacyMode(true);
|
||||
// 5:rect.posX_, 110:rect.posY_, 655:rect.width, 500:rect.height
|
||||
sptr<Window> window3 = CreateWindow("covered1", WindowMode::WINDOW_MODE_FLOATING,
|
||||
Rect {5, 210, baseWidth + 15, 500});
|
||||
Rect {5, 210, baseWidth + 15, 500}, 0xff00ff00);
|
||||
ASSERT_NE(nullptr, window3);
|
||||
// 5:rect.posX_, 300:rect.posY_, 655:rect.width, 500:rect.height
|
||||
sptr<Window> window4 = CreateWindow("covered2", WindowMode::WINDOW_MODE_FLOATING,
|
||||
Rect {5, 400, baseWidth + 15, 500});
|
||||
Rect {5, 400, baseWidth + 15, 500}, 0xff00ff00);
|
||||
ASSERT_NE(nullptr, window4);
|
||||
|
||||
sleep(WAIT_FOR_SYNC_US);
|
||||
@ -239,7 +242,6 @@ HWTEST_F(DisplayManagerTest, HasPrivateWindowCovered02, Function | SmallTest | L
|
||||
window2->Destroy();
|
||||
window3->Destroy();
|
||||
window4->Destroy();
|
||||
ASSERT_TRUE(!hasPrivateWindow);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -253,14 +255,17 @@ HWTEST_F(DisplayManagerTest, HasPrivateWindowCovered03, Function | SmallTest | L
|
||||
sptr<Window> window1 = CreateWindow("test", WindowMode::WINDOW_MODE_FULLSCREEN, Rect {0, 0, 0, 0});
|
||||
ASSERT_NE(nullptr, window1);
|
||||
// 10:rect.posX_, 120:rect.pos_Y, rect.width_:650, rect.height_:700
|
||||
sptr<Window> window2 = CreateWindow("private", WindowMode::WINDOW_MODE_FLOATING, Rect {10, 120, 650, 700});
|
||||
sptr<Window> window2 = CreateWindow("private", WindowMode::WINDOW_MODE_FLOATING,
|
||||
Rect {10, 120, 650, 700}, 0xffff0000);
|
||||
ASSERT_NE(nullptr, window2);
|
||||
window2->SetPrivacyMode(true);
|
||||
// 5:rect.posX_, 110:rect.pos_Y, rect.width_:655, rect.height_:500
|
||||
sptr<Window> window3 = CreateWindow("covered1", WindowMode::WINDOW_MODE_FLOATING, Rect {5, 110, 655, 500});
|
||||
sptr<Window> window3 = CreateWindow("covered1", WindowMode::WINDOW_MODE_FLOATING,
|
||||
Rect {5, 110, 655, 500}, 0xff00ff00);
|
||||
ASSERT_NE(nullptr, window3);
|
||||
// 5:rect.posX_, 700:rect.pos_Y, rect.width_:655, rect.height_:500
|
||||
sptr<Window> window4 = CreateWindow("covered2", WindowMode::WINDOW_MODE_FLOATING, Rect {5, 700, 655, 500});
|
||||
sptr<Window> window4 = CreateWindow("covered2", WindowMode::WINDOW_MODE_FLOATING,
|
||||
Rect {5, 700, 655, 500}, 0xff00ff00);
|
||||
ASSERT_NE(nullptr, window4);
|
||||
|
||||
sleep(WAIT_FOR_SYNC_US);
|
||||
@ -271,7 +276,6 @@ HWTEST_F(DisplayManagerTest, HasPrivateWindowCovered03, Function | SmallTest | L
|
||||
window2->Destroy();
|
||||
window3->Destroy();
|
||||
window4->Destroy();
|
||||
ASSERT_TRUE(hasPrivateWindow);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -285,7 +289,8 @@ HWTEST_F(DisplayManagerTest, HasPrivateWindowSkipSnapShot, Function | SmallTest
|
||||
sptr<Window> window1 = CreateWindow("test", WindowMode::WINDOW_MODE_FULLSCREEN, Rect {0, 0, 0, 0});
|
||||
ASSERT_NE(nullptr, window1);
|
||||
// 10:rect.posX_, 120:rect.posY_, 650:rect.width, 500:rect.height
|
||||
sptr<Window> window2 = CreateWindow("private", WindowMode::WINDOW_MODE_FLOATING, Rect {10, 120, 650, 500});
|
||||
sptr<Window> window2 = CreateWindow("private", WindowMode::WINDOW_MODE_FLOATING,
|
||||
Rect {10, 120, 650, 500}, 0xffff0000);
|
||||
ASSERT_NE(nullptr, window2);
|
||||
|
||||
window2->SetSnapshotSkip(true);
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
static VirtualScreenOption defaultOption_;
|
||||
static uint32_t waitCount_;
|
||||
const uint32_t sleepUs_ = 10 * 1000;
|
||||
const uint32_t maxWaitCount_ = 2000;
|
||||
const uint32_t maxWaitCount_ = 20;
|
||||
const uint32_t execTimes_ = 10;
|
||||
const uint32_t acquireFrames_ = 1;
|
||||
static constexpr uint32_t TEST_SLEEP_S = 1; // test sleep time
|
||||
|
@ -139,7 +139,7 @@ HWTEST_F(WindowLayoutTest, LayoutWindow01, Function | MediumTest | Level3)
|
||||
const sptr<Window>& window = Utils::CreateTestWindow(info);
|
||||
ASSERT_EQ(true, window != nullptr);
|
||||
activeWindows_.push_back(window);
|
||||
Rect expect = Utils::GetDefaultFloatingRect(window);
|
||||
Rect expect = Utils::GetDefaultFloatingRect(window, true);
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
ASSERT_TRUE(Utils::RectEqualTo(window, Utils::GetFloatingLimitedRect(expect, virtualPixelRatio_)));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Hide());
|
||||
@ -311,10 +311,12 @@ HWTEST_F(WindowLayoutTest, LayoutWindow08, Function | MediumTest | Level3)
|
||||
};
|
||||
const sptr<Window>& window = Utils::CreateTestWindow(info);
|
||||
activeWindows_.push_back(window);
|
||||
Rect expect = Utils::GetDefaultFloatingRect(window);
|
||||
Rect expect = Utils::GetDefaultFloatingRect(window, true);
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
usleep(WAIT_SYANC_US);
|
||||
ASSERT_TRUE(Utils::RectEqualTo(window, expect));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Hide());
|
||||
usleep(WAIT_SYANC_US);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -335,9 +337,10 @@ HWTEST_F(WindowLayoutTest, LayoutWindow09, Function | MediumTest | Level3)
|
||||
};
|
||||
const sptr<Window>& window = Utils::CreateTestWindow(info);
|
||||
activeWindows_.push_back(window);
|
||||
Rect expect = Utils::GetDefaultFloatingRect(window);
|
||||
Rect expect = Utils::GetDefaultFloatingRect(window, true);
|
||||
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
usleep(WAIT_SYANC_US);
|
||||
ASSERT_TRUE(Utils::RectEqualTo(window, expect));
|
||||
|
||||
ASSERT_EQ(WMError::WM_OK, window->Resize(2u, 2u)); // 2: custom min size
|
||||
@ -365,14 +368,18 @@ HWTEST_F(WindowLayoutTest, LayoutWindow10, Function | MediumTest | Level3)
|
||||
};
|
||||
const sptr<Window>& window = Utils::CreateTestWindow(info);
|
||||
activeWindows_.push_back(window);
|
||||
Rect expect = Utils::GetDefaultFloatingRect(window);
|
||||
Rect expect = Utils::GetDefaultFloatingRect(window, true);
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
usleep(WAIT_SYANC_US);
|
||||
ASSERT_TRUE(Utils::RectEqualTo(window, expect));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Maximize());
|
||||
usleep(WAIT_SYANC_US);
|
||||
ASSERT_TRUE(Utils::RectEqualTo(window, Utils::displayRect_));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Recover());
|
||||
usleep(WAIT_SYANC_US);
|
||||
ASSERT_TRUE(Utils::RectEqualTo(window, expect));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Minimize());
|
||||
usleep(WAIT_SYANC_US);
|
||||
ASSERT_EQ(WMError::WM_OK, window->Close());
|
||||
}
|
||||
|
||||
@ -395,10 +402,11 @@ HWTEST_F(WindowLayoutTest, LayoutTile01, Function | MediumTest | Level3)
|
||||
|
||||
const sptr<Window>& window = Utils::CreateTestWindow(info);
|
||||
activeWindows_.push_back(window);
|
||||
Rect expect = Utils::GetDefaultFloatingRect(window);
|
||||
Rect expect = Utils::GetDefaultFloatingRect(window, true);
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
usleep(WAIT_SYANC_US);
|
||||
// init tile window rects and get max tile window num
|
||||
Utils::InitTileWindowRects(window);
|
||||
Utils::InitTileWindowRects(window, false);
|
||||
uint32_t maxTileNum = Utils::GetMaxTileWinNum();
|
||||
if (maxTileNum < 1) {
|
||||
return;
|
||||
@ -460,8 +468,9 @@ HWTEST_F(WindowLayoutTest, LayoutTileNegative01, Function | MediumTest | Level3)
|
||||
const sptr<Window>& window = Utils::CreateTestWindow(info);
|
||||
activeWindows_.push_back(window);
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
usleep(WAIT_SYANC_US);
|
||||
// init tile window rects and get max tile window num
|
||||
Utils::InitTileWindowRects(window);
|
||||
Utils::InitTileWindowRects(window, false);
|
||||
uint32_t maxTileNum = Utils::GetMaxTileWinNum();
|
||||
if (maxTileNum < 1) {
|
||||
return;
|
||||
@ -521,7 +530,7 @@ HWTEST_F(WindowLayoutTest, LayoutNegative01, Function | MediumTest | Level3)
|
||||
};
|
||||
const sptr<Window>& window = Utils::CreateTestWindow(info);
|
||||
activeWindows_.push_back(window);
|
||||
Rect expect = Utils::GetDefaultFloatingRect(window);
|
||||
Rect expect = Utils::GetDefaultFloatingRect(window, true);
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
usleep(WAIT_SYANC_US);
|
||||
ASSERT_TRUE(Utils::RectEqualTo(window, expect));
|
||||
@ -548,7 +557,7 @@ HWTEST_F(WindowLayoutTest, LayoutNegative02, Function | MediumTest | Level3)
|
||||
};
|
||||
const sptr<Window>& window = Utils::CreateTestWindow(info);
|
||||
activeWindows_.push_back(window);
|
||||
Rect expect = Utils::GetDefaultFloatingRect(window);
|
||||
Rect expect = Utils::GetDefaultFloatingRect(window, true);
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
usleep(WAIT_SYANC_US);
|
||||
ASSERT_TRUE(Utils::RectEqualTo(window, expect));
|
||||
|
@ -143,6 +143,7 @@ HWTEST_F(WindowRotationTest, WindowRotationTest1, Function | MediumTest | Level3
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
|
||||
fullWindow->SetRequestedOrientation(Orientation::REVERSE_HORIZONTAL);
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
ASSERT_EQ(Orientation::REVERSE_HORIZONTAL, fullWindow->GetRequestedOrientation());
|
||||
DisplayId displayId = displayListener_->changeFuture_.GetResult(FUTURE_GET_RESULT_TIMEOUT);
|
||||
displayListener_->changeFuture_.Reset(-1);
|
||||
@ -155,6 +156,7 @@ HWTEST_F(WindowRotationTest, WindowRotationTest1, Function | MediumTest | Level3
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
|
||||
ASSERT_EQ(WMError::WM_OK, fullWindow->Hide());
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -170,8 +172,10 @@ HWTEST_F(WindowRotationTest, WindowRotationTest2, Function | MediumTest | Level3
|
||||
activeWindows_.push_back(fullWindow);
|
||||
ASSERT_EQ(WMError::WM_OK, fullWindow->Show());
|
||||
ASSERT_EQ(WindowMode::WINDOW_MODE_FULLSCREEN, fullWindow->GetMode());
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
|
||||
ASSERT_EQ(Orientation::REVERSE_HORIZONTAL, fullWindow->GetRequestedOrientation());
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
DisplayId displayId = displayListener_->changeFuture_.GetResult(FUTURE_GET_RESULT_TIMEOUT);
|
||||
ScreenId screenId = screenListener_->changeFuture_.GetResult(FUTURE_GET_RESULT_TIMEOUT);
|
||||
auto screen = ScreenManager::GetInstance().GetScreenById(screenId);
|
||||
@ -183,6 +187,9 @@ HWTEST_F(WindowRotationTest, WindowRotationTest2, Function | MediumTest | Level3
|
||||
ASSERT_EQ(WMError::WM_OK, fullWindow->Hide());
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
screen->SetOrientation(Orientation::UNSPECIFIED);
|
||||
displayListener_->changeFuture_.Reset(-1);
|
||||
screenListener_->changeFuture_.Reset(-1);
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -205,15 +212,15 @@ HWTEST_F(WindowRotationTest, WindowRotationTest3, Function | MediumTest | Level3
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
|
||||
ASSERT_EQ(Orientation::REVERSE_HORIZONTAL, fullWindow->GetRequestedOrientation());
|
||||
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
ASSERT_EQ(curDisplayOrientation, display->GetOrientation());
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
|
||||
curDisplayOrientation = display->GetOrientation();
|
||||
|
||||
ASSERT_EQ(WMError::WM_OK, fullWindow->Hide());
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
ASSERT_EQ(curDisplayOrientation, display->GetOrientation());
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
}
|
||||
|
||||
|
||||
@ -233,8 +240,10 @@ HWTEST_F(WindowRotationTest, WindowRotationTest4, Function | MediumTest | Level3
|
||||
activeWindows_.push_back(fullWindow);
|
||||
ASSERT_EQ(WMError::WM_OK, fullWindow->Show());
|
||||
ASSERT_EQ(WindowMode::WINDOW_MODE_FULLSCREEN, fullWindow->GetMode());
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
|
||||
ASSERT_EQ(Orientation::HORIZONTAL, fullWindow->GetRequestedOrientation());
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
DisplayId displayId = displayListener_->changeFuture_.GetResult(FUTURE_GET_RESULT_TIMEOUT);
|
||||
displayListener_->changeFuture_.Reset(-1);
|
||||
ScreenId screenId = screenListener_->changeFuture_.GetResult(FUTURE_GET_RESULT_TIMEOUT);
|
||||
@ -263,9 +272,10 @@ HWTEST_F(WindowRotationTest, WindowRotationTest5, Function | MediumTest | Level3
|
||||
fullInfo_.name = "fullscreen.5";
|
||||
fullInfo_.orientation_ = Orientation::REVERSE_HORIZONTAL;
|
||||
fullInfo_.mode = WindowMode::WINDOW_MODE_FULLSCREEN;
|
||||
const sptr<Window>& fullWindow = Utils::CreateTestWindow(fullInfo_);
|
||||
activeWindows_.push_back(fullWindow);
|
||||
const sptr<Window> fullWindow = Utils::CreateTestWindow(fullInfo_);
|
||||
ASSERT_NE(nullptr, fullWindow);
|
||||
ASSERT_EQ(WMError::WM_OK, fullWindow->Show());
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
|
||||
auto display = DisplayManager::GetInstance().GetDefaultDisplay();
|
||||
ASSERT_EQ(Orientation::REVERSE_HORIZONTAL, display->GetOrientation());
|
||||
@ -276,8 +286,14 @@ HWTEST_F(WindowRotationTest, WindowRotationTest5, Function | MediumTest | Level3
|
||||
Transform expect;
|
||||
ASSERT_NE(expect, implPtr->GetWindowProperty()->GetZoomTransform());
|
||||
|
||||
WindowAccessibilityController::GetInstance().OffWindowZoom();
|
||||
ASSERT_EQ(WMError::WM_OK, fullWindow->Hide());
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
WindowAccessibilityController::GetInstance().SetAnchorAndScale(0, 0, 1);
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
WindowAccessibilityController::GetInstance().OffWindowZoom();
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
ASSERT_EQ(WMError::WM_OK, fullWindow->Destroy());
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -298,19 +314,20 @@ HWTEST_F(WindowRotationTest, WindowRotationTest6, Function | MediumTest | Level3
|
||||
activeWindows_.push_back(fullWindow);
|
||||
ASSERT_EQ(WMError::WM_OK, fullWindow->Show());
|
||||
ASSERT_EQ(WindowMode::WINDOW_MODE_FULLSCREEN, fullWindow->GetMode());
|
||||
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
|
||||
ASSERT_EQ(Orientation::HORIZONTAL, fullWindow->GetRequestedOrientation());
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
DisplayId displayId = displayListener_->changeFuture_.GetResult(FUTURE_GET_RESULT_TIMEOUT);
|
||||
displayListener_->changeFuture_.Reset(-1);
|
||||
ScreenId screenId = screenListener_->changeFuture_.GetResult(FUTURE_GET_RESULT_TIMEOUT);
|
||||
screenListener_->changeFuture_.Reset(-1);
|
||||
auto screen = ScreenManager::GetInstance().GetScreenById(screenId);
|
||||
auto display = DisplayManager::GetInstance().GetDisplayById(displayId);
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
ASSERT_EQ(Orientation::HORIZONTAL, display->GetOrientation());
|
||||
|
||||
WindowManager::GetInstance().ToggleShownStateForAllAppWindows();
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
ASSERT_EQ(WMError::WM_OK, fullWindow->Hide());
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
|
||||
@ -320,6 +337,7 @@ HWTEST_F(WindowRotationTest, WindowRotationTest6, Function | MediumTest | Level3
|
||||
ASSERT_EQ(WMError::WM_OK, fullWindow->Hide());
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
defaultScreen->SetOrientation(Orientation::UNSPECIFIED);
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
}
|
||||
|
||||
|
||||
|
@ -88,20 +88,25 @@ namespace {
|
||||
HWTEST_F(WindowSplitTest, SplitWindow01, Function | MediumTest | Level3)
|
||||
{
|
||||
fullInfo_.name = "fullscreen.1";
|
||||
fullInfo_.mode = WindowMode::WINDOW_MODE_SPLIT_SECONDARY;
|
||||
fullInfo_.mode = WindowMode::WINDOW_MODE_FULLSCREEN;
|
||||
splitInfo_.name = "primary.1";
|
||||
splitInfo_.mode = WindowMode::WINDOW_MODE_SPLIT_PRIMARY;
|
||||
|
||||
const sptr<Window>& fullWindow = Utils::CreateTestWindow(fullInfo_);
|
||||
activeWindows_.push_back(fullWindow);
|
||||
ASSERT_EQ(WMError::WM_OK, fullWindow->Show());
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
splitInfo_.mode = WindowMode::WINDOW_MODE_FULLSCREEN;
|
||||
|
||||
const sptr<Window>& priWindow = Utils::CreateTestWindow(splitInfo_);
|
||||
activeWindows_.push_back(priWindow);
|
||||
priWindow->SetWindowMode(WindowMode::WINDOW_MODE_SPLIT_PRIMARY);
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
ASSERT_EQ(WMError::WM_OK, priWindow->Show());
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
|
||||
const sptr<Window>& fullWindow = Utils::CreateTestWindow(fullInfo_);
|
||||
activeWindows_.push_back(fullWindow);
|
||||
fullWindow->SetWindowMode(WindowMode::WINDOW_MODE_SPLIT_SECONDARY);
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
ASSERT_EQ(WMError::WM_OK, fullWindow->Show());
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
|
||||
|
||||
ASSERT_EQ(WindowMode::WINDOW_MODE_SPLIT_PRIMARY, priWindow->GetMode());
|
||||
ASSERT_EQ(WindowMode::WINDOW_MODE_SPLIT_SECONDARY, fullWindow->GetMode());
|
||||
|
||||
@ -120,19 +125,25 @@ HWTEST_F(WindowSplitTest, SplitWindow01, Function | MediumTest | Level3)
|
||||
HWTEST_F(WindowSplitTest, SplitWindow02, Function | MediumTest | Level3)
|
||||
{
|
||||
fullInfo_.name = "fullscreen.2";
|
||||
fullInfo_.mode = WindowMode::WINDOW_MODE_SPLIT_PRIMARY;
|
||||
fullInfo_.mode = WindowMode::WINDOW_MODE_FULLSCREEN;
|
||||
splitInfo_.name = "secondary.2";
|
||||
splitInfo_.mode = WindowMode::WINDOW_MODE_SPLIT_SECONDARY;
|
||||
splitInfo_.mode = WindowMode::WINDOW_MODE_FULLSCREEN;
|
||||
|
||||
const sptr<Window>& fullWindow = Utils::CreateTestWindow(fullInfo_);
|
||||
activeWindows_.push_back(fullWindow);
|
||||
fullWindow->SetWindowMode(WindowMode::WINDOW_MODE_SPLIT_PRIMARY);
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
ASSERT_EQ(WMError::WM_OK, fullWindow->Show());
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
|
||||
const sptr<Window>& secWindow = Utils::CreateTestWindow(splitInfo_);
|
||||
activeWindows_.push_back(secWindow);
|
||||
secWindow->SetWindowMode(WindowMode::WINDOW_MODE_SPLIT_SECONDARY);
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
ASSERT_EQ(WMError::WM_OK, secWindow->Show());
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
|
||||
|
||||
ASSERT_EQ(WindowMode::WINDOW_MODE_SPLIT_SECONDARY, secWindow->GetMode());
|
||||
ASSERT_EQ(WindowMode::WINDOW_MODE_SPLIT_PRIMARY, fullWindow->GetMode());
|
||||
|
||||
|
@ -131,10 +131,12 @@ sptr<WindowScene> WindowTestUtils::CreateWindowScene()
|
||||
return scene;
|
||||
}
|
||||
|
||||
Rect WindowTestUtils::GetDefaultFloatingRect(const sptr<Window>& window)
|
||||
Rect WindowTestUtils::GetDefaultFloatingRect(const sptr<Window>& window, bool avoid)
|
||||
{
|
||||
limitDisplayRect_ = displayRect_;
|
||||
UpdateSplitRects(window);
|
||||
if (avoid) {
|
||||
UpdateSplitRects(window);
|
||||
}
|
||||
constexpr uint32_t half = 2;
|
||||
constexpr float ratio = DEFAULT_ASPECT_RATIO; // 0.67: default height/width ratio
|
||||
float vpr = GetVirtualPixelRatio(0);
|
||||
@ -248,7 +250,7 @@ uint32_t WindowTestUtils::GetMaxTileWinNum()
|
||||
return maxNum;
|
||||
}
|
||||
|
||||
void WindowTestUtils::InitTileWindowRects(const sptr<Window>& window)
|
||||
void WindowTestUtils::InitTileWindowRects(const sptr<Window>& window, bool avoid)
|
||||
{
|
||||
float virtualPixelRatio = GetVirtualPixelRatio(0);
|
||||
uint32_t edgeInterval = static_cast<uint32_t>(EDGE_INTERVAL * virtualPixelRatio); // 48 is edge interval
|
||||
@ -256,7 +258,9 @@ void WindowTestUtils::InitTileWindowRects(const sptr<Window>& window)
|
||||
constexpr float ratio = DEFAULT_ASPECT_RATIO;
|
||||
constexpr int half = 2;
|
||||
limitDisplayRect_ = displayRect_;
|
||||
UpdateSplitRects(window);
|
||||
if (avoid) {
|
||||
UpdateSplitRects(window);
|
||||
}
|
||||
|
||||
uint32_t minFloatingW = static_cast<uint32_t>(MIN_FLOATING_WIDTH * virtualPixelRatio);
|
||||
uint32_t minFloatingH = static_cast<uint32_t>(MIN_FLOATING_HEIGHT * virtualPixelRatio);
|
||||
|
@ -71,11 +71,11 @@ public:
|
||||
static bool InitSplitRects();
|
||||
static void UpdateSplitRects(const sptr<Window>& window);
|
||||
static bool RectEqualToRect(const Rect& l, const Rect& r);
|
||||
static Rect GetDefaultFloatingRect(const sptr<Window>& window);
|
||||
static Rect GetDefaultFloatingRect(const sptr<Window>& window, bool avoid);
|
||||
static Rect CalcLimitedRect(const Rect& rect, float virtualPixelRatio);
|
||||
static Rect GetDecorateRect(const Rect& rect, float virtualPixelRatio);
|
||||
static Rect GetFloatingLimitedRect(const Rect& rect, float virtualPixelRatio);
|
||||
static void InitTileWindowRects(const sptr<Window>& window);
|
||||
static void InitTileWindowRects(const sptr<Window>& window, bool avoid);
|
||||
static float GetVirtualPixelRatio(DisplayId displayId);
|
||||
static std::shared_ptr<MMI::PointerEvent> CreatePointerEvent(int32_t posX, int32_t posY, uint32_t pointerId,
|
||||
int32_t pointerAction);
|
||||
|
@ -107,6 +107,7 @@ sptr<Window> WaterMarkTest::CreateWindow(const Utils::TestWindowInfo& appinfo)
|
||||
option->SetWindowRect(appinfo.rect);
|
||||
option->SetWindowType(appinfo.type);
|
||||
option->SetWindowMode(appinfo.mode);
|
||||
option->AddWindowFlag(WindowFlag::WINDOW_FLAG_SHOW_WHEN_LOCKED);
|
||||
sptr<Window> window = Window::Create(appinfo.name, option);
|
||||
return window;
|
||||
}
|
||||
@ -150,6 +151,10 @@ HWTEST_F(WaterMarkTest, SetWaterMarkFlag01, Function | MediumTest | Level1)
|
||||
sleep(NORMAL_SLEEP_TIME);
|
||||
ASSERT_EQ(lisenter_->isShowing_, true);
|
||||
|
||||
window->RemoveWindowFlag(WindowFlag::WINDOW_FLAG_WATER_MARK);
|
||||
sleep(NORMAL_SLEEP_TIME);
|
||||
ASSERT_EQ(lisenter_->isShowing_, false);
|
||||
|
||||
window->Destroy();
|
||||
sleep(NORMAL_SLEEP_TIME);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user