mirror of
https://gitee.com/openharmony/window_window_manager
synced 2024-11-27 00:51:35 +00:00
commit
38215d8fc6
@ -217,7 +217,8 @@ HWTEST_F(WindowDragTest, DragOut, Function | MediumTest | Level3) {
|
||||
|
||||
dragWindow->MoveTo(600, 600);
|
||||
sleep(WAIT_CALLBACK_US);
|
||||
|
||||
ASSERT_EQ(100, secondWindowDragListener_->point_.x);
|
||||
ASSERT_EQ(100, secondWindowDragListener_->point_.y);
|
||||
ASSERT_EQ(DragEvent::DRAG_EVENT_IN, secondWindowDragListener_->event_);
|
||||
ASSERT_EQ(DragEvent::DRAG_EVENT_OUT, firstWindowDragListener_->event_);
|
||||
|
||||
|
@ -149,7 +149,7 @@ HWTEST_F(WindowLayoutTest, LayoutWindow01, Function | MediumTest | Level3)
|
||||
activeWindows_.push_back(window);
|
||||
Rect expect = Utils::GetDefaultFloatingRect(window, true);
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
Utils::RectEqualTo(window, Utils::GetFloatingLimitedRect(expect, virtualPixelRatio_));
|
||||
ASSERT_TRUE(Utils::RectEqualTo(window, Utils::GetFloatingLimitedRect(expect, virtualPixelRatio_)));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Hide());
|
||||
}
|
||||
|
||||
@ -181,7 +181,7 @@ HWTEST_F(WindowLayoutTest, LayoutWindow02, Function | MediumTest | Level3)
|
||||
if (window->IsDecorEnable()) {
|
||||
ASSERT_TRUE(Utils::RectEqualTo(window, Utils::GetDecorateRect(res, virtualPixelRatio_)));
|
||||
} else {
|
||||
Utils::RectEqualTo(window, res);
|
||||
ASSERT_TRUE(Utils::RectEqualTo(window, res));
|
||||
}
|
||||
ASSERT_EQ(WMError::WM_OK, window->Hide());
|
||||
}
|
||||
@ -220,7 +220,7 @@ HWTEST_F(WindowLayoutTest, LayoutWindow04, Function | MediumTest | Level3)
|
||||
if (appWin->IsDecorEnable()) {
|
||||
ASSERT_TRUE(Utils::RectEqualTo(appWin, Utils::GetDecorateRect(res, virtualPixelRatio_)));
|
||||
} else {
|
||||
Utils::RectEqualTo(appWin, res);
|
||||
ASSERT_TRUE(Utils::RectEqualTo(appWin, res));
|
||||
}
|
||||
ASSERT_EQ(WMError::WM_OK, statBar->Show());
|
||||
if (appWin->IsDecorEnable()) {
|
||||
@ -372,7 +372,7 @@ HWTEST_F(WindowLayoutTest, LayoutWindow08, Function | MediumTest | Level3)
|
||||
Rect expect = Utils::GetDefaultFloatingRect(window, true);
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
usleep(WAIT_SYANC_US);
|
||||
Utils::RectEqualTo(window, expect);
|
||||
ASSERT_TRUE(Utils::RectEqualTo(window, expect));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Hide());
|
||||
usleep(WAIT_SYANC_US);
|
||||
}
|
||||
@ -403,12 +403,12 @@ HWTEST_F(WindowLayoutTest, LayoutWindow09, Function | MediumTest | Level3)
|
||||
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
usleep(WAIT_SYANC_US);
|
||||
Utils::RectEqualTo(window, expect);
|
||||
ASSERT_TRUE(Utils::RectEqualTo(window, expect));
|
||||
|
||||
ASSERT_EQ(WMError::WM_OK, window->Resize(2u, 2u)); // 2: custom min size
|
||||
Rect finalExcept = { expect.posX_, expect.posY_, 2u, 2u}; // 2: custom min size
|
||||
finalExcept = Utils::GetFloatingLimitedRect(finalExcept, virtualPixelRatio_);
|
||||
Utils::RectEqualTo(window, finalExcept);
|
||||
ASSERT_TRUE(Utils::RectEqualTo(window, finalExcept));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Hide());
|
||||
}
|
||||
|
||||
@ -437,13 +437,13 @@ HWTEST_F(WindowLayoutTest, LayoutWindow10, Function | MediumTest | Level3)
|
||||
Rect expect = Utils::GetDefaultFloatingRect(window, true);
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
usleep(WAIT_SYANC_US);
|
||||
Utils::RectEqualTo(window, expect);
|
||||
ASSERT_TRUE(Utils::RectEqualTo(window, expect));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Maximize());
|
||||
usleep(WAIT_SYANC_US);
|
||||
Utils::RectEqualTo(window, Utils::displayRect_);
|
||||
ASSERT_TRUE(Utils::RectEqualTo(window, Utils::displayRect_));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Recover());
|
||||
usleep(WAIT_SYANC_US);
|
||||
Utils::RectEqualTo(window, expect);
|
||||
ASSERT_TRUE(Utils::RectEqualTo(window, expect));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Minimize());
|
||||
usleep(WAIT_SYANC_US);
|
||||
ASSERT_EQ(WMError::WM_OK, window->Close());
|
||||
@ -478,7 +478,7 @@ HWTEST_F(WindowLayoutTest, LayoutTile01, Function | MediumTest | Level3)
|
||||
}
|
||||
|
||||
usleep(WAIT_SYANC_US);
|
||||
Utils::RectEqualTo(window, expect);
|
||||
ASSERT_TRUE(Utils::RectEqualTo(window, expect));
|
||||
WindowManager::GetInstance().SetWindowLayoutMode(WindowLayoutMode::TILE);
|
||||
usleep(WAIT_SYANC_US);
|
||||
ASSERT_TRUE(Utils::RectEqualTo(window, Utils::singleTileRect_));
|
||||
@ -542,7 +542,7 @@ HWTEST_F(WindowLayoutTest, LayoutTileNegative01, Function | MediumTest | Level3)
|
||||
usleep(WAIT_SYANC_US);
|
||||
WindowManager::GetInstance().SetWindowLayoutMode(WindowLayoutMode::TILE);
|
||||
usleep(WAIT_SYANC_US);
|
||||
Utils::RectEqualTo(window, Utils::singleTileRect_);
|
||||
ASSERT_TRUE(Utils::RectEqualTo(window, Utils::singleTileRect_));
|
||||
|
||||
info.name = "test1";
|
||||
const sptr<Window>& test1 = Utils::CreateTestWindow(info);
|
||||
@ -598,7 +598,7 @@ HWTEST_F(WindowLayoutTest, LayoutNegative01, Function | MediumTest | Level3)
|
||||
Rect expect = Utils::GetDefaultFloatingRect(window, true);
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
usleep(WAIT_SYANC_US);
|
||||
Utils::RectEqualTo(window, expect);
|
||||
ASSERT_TRUE(Utils::RectEqualTo(window, expect));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -628,12 +628,12 @@ HWTEST_F(WindowLayoutTest, LayoutNegative02, Function | MediumTest | Level3)
|
||||
Rect expect = Utils::GetDefaultFloatingRect(window, true);
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
usleep(WAIT_SYANC_US);
|
||||
Utils::RectEqualTo(window, expect);
|
||||
ASSERT_TRUE(Utils::RectEqualTo(window, expect));
|
||||
window->Resize(negativeW, negativeH);
|
||||
usleep(WAIT_SYANC_US);
|
||||
Rect expect2 = {expect.posX_, expect.posY_, negativeW, negativeH};
|
||||
expect2 = Utils::CalcLimitedRect(expect2, virtualPixelRatio_);
|
||||
Utils::RectEqualTo(window, expect2);
|
||||
ASSERT_TRUE(Utils::RectEqualTo(window, expect2));
|
||||
}
|
||||
}
|
||||
} // namespace Rosen
|
||||
|
@ -190,7 +190,7 @@ HWTEST_F(WindowModeSupportInfoTest, WindowModeSupportInfo05, Function | MediumTe
|
||||
usleep(WAIT_SYANC_US);
|
||||
|
||||
ASSERT_EQ(WindowMode::WINDOW_MODE_FULLSCREEN, window1->GetMode());
|
||||
window2->GetMode();
|
||||
ASSERT_EQ(WindowMode::WINDOW_MODE_FLOATING, window2->GetMode());
|
||||
|
||||
window1->Destroy();
|
||||
window2->Destroy();
|
||||
|
@ -188,8 +188,8 @@ HWTEST_F(WindowSplitTest, SplitScreen03, Function | MediumTest | Level3)
|
||||
|
||||
Utils::UpdateSplitRects(fullWindow);
|
||||
|
||||
Utils::RectEqualTo(fullWindow, Utils::splitRects_.secondaryRect);
|
||||
Utils::RectEqualTo(priWindow, Utils::splitRects_.primaryRect);
|
||||
ASSERT_TRUE(Utils::RectEqualTo(fullWindow, Utils::splitRects_.secondaryRect));
|
||||
ASSERT_TRUE(Utils::RectEqualTo(priWindow, Utils::splitRects_.primaryRect));
|
||||
|
||||
ASSERT_EQ(WMError::WM_OK, fullWindow->Hide());
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
@ -223,8 +223,8 @@ HWTEST_F(WindowSplitTest, SplitScreen04, Function | MediumTest | Level3)
|
||||
|
||||
Utils::UpdateSplitRects(fullWindow);
|
||||
|
||||
Utils::RectEqualTo(fullWindow, Utils::splitRects_.primaryRect);
|
||||
Utils::RectEqualTo(secWindow, Utils::splitRects_.secondaryRect);
|
||||
ASSERT_TRUE(Utils::RectEqualTo(fullWindow, Utils::splitRects_.primaryRect));
|
||||
ASSERT_TRUE(Utils::RectEqualTo(secWindow, Utils::splitRects_.secondaryRect));
|
||||
|
||||
ASSERT_EQ(WMError::WM_OK, fullWindow->Hide());
|
||||
sleep(SPLIT_TEST_SLEEP_S);
|
||||
|
@ -195,225 +195,6 @@ HWTEST_F(WindowPropertyTest, ResumeLastWindowMode, Function | SmallTest | Level2
|
||||
ASSERT_EQ(WindowMode::WINDOW_MODE_FLOATING, winPropDst.mode_);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: HandleComputeTransform
|
||||
* @tc.desc: HandleComputeTransform test
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(WindowPropertyTest, HandleComputeTransform, Function | SmallTest | Level2)
|
||||
{
|
||||
WindowProperty winPropSrc;
|
||||
winPropSrc.SetPrivacyMode(true);
|
||||
winPropSrc.SetTransparent(true);
|
||||
int resultValue = 0;
|
||||
std::function<void()> func = [&]() {
|
||||
winPropSrc.HandleComputeTransform(Transform::Identity());
|
||||
resultValue = 1;
|
||||
};
|
||||
func();
|
||||
ASSERT_EQ(resultValue, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: ComputeTransform
|
||||
* @tc.desc: ComputeTransform test
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(WindowPropertyTest, ComputeTransform, Function | SmallTest | Level2)
|
||||
{
|
||||
WindowProperty winPropSrc;
|
||||
winPropSrc.SetPrivacyMode(true);
|
||||
winPropSrc.SetTransparent(true);
|
||||
int resultValue = 0;
|
||||
std::function<void()> func = [&]() {
|
||||
winPropSrc.ComputeTransform();
|
||||
resultValue = 1;
|
||||
};
|
||||
func();
|
||||
ASSERT_EQ(resultValue, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetZoomTransform
|
||||
* @tc.desc: SetZoomTransform test
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(WindowPropertyTest, SetZoomTransform, Function | SmallTest | Level2)
|
||||
{
|
||||
WindowProperty winPropSrc;
|
||||
winPropSrc.SetPrivacyMode(true);
|
||||
winPropSrc.SetTransparent(true);
|
||||
int resultValue = 0;
|
||||
std::function<void()> func = [&]() {
|
||||
winPropSrc.SetZoomTransform(Transform::Identity());
|
||||
resultValue = 1;
|
||||
};
|
||||
func();
|
||||
ASSERT_EQ(resultValue, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: ClearTransformZAxisOffset
|
||||
* @tc.desc: ClearTransformZAxisOffset test
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(WindowPropertyTest, ClearTransformZAxisOffset, Function | SmallTest | Level2)
|
||||
{
|
||||
WindowProperty winPropSrc;
|
||||
winPropSrc.SetPrivacyMode(true);
|
||||
winPropSrc.SetTransparent(true);
|
||||
Transform trans;
|
||||
int resultValue = 0;
|
||||
std::function<void()> func = [&]() {
|
||||
winPropSrc.ClearTransformZAxisOffset(trans);
|
||||
resultValue = 1;
|
||||
};
|
||||
func();
|
||||
ASSERT_EQ(resultValue, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: UpdatePointerEvent
|
||||
* @tc.desc: UpdatePointerEvent test
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(WindowPropertyTest, UpdatePointerEvent, Function | SmallTest | Level2)
|
||||
{
|
||||
WindowProperty winPropSrc;
|
||||
winPropSrc.SetPrivacyMode(true);
|
||||
winPropSrc.SetTransparent(true);
|
||||
std::shared_ptr<MMI::PointerEvent> pointerEvent;
|
||||
int resultValue = 0;
|
||||
std::function<void()> func = [&]() {
|
||||
winPropSrc.UpdatePointerEvent(pointerEvent);
|
||||
resultValue = 1;
|
||||
};
|
||||
func();
|
||||
ASSERT_EQ(resultValue, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: isNeedComputerTransform
|
||||
* @tc.desc: isNeedComputerTransform test
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(WindowPropertyTest, isNeedComputerTransform, Function | SmallTest | Level2)
|
||||
{
|
||||
WindowProperty winPropSrc;
|
||||
winPropSrc.SetPrivacyMode(true);
|
||||
winPropSrc.SetTransparent(true);
|
||||
bool ret = winPropSrc.isNeedComputerTransform();
|
||||
ASSERT_EQ(false, ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetAnimateWindowFlag
|
||||
* @tc.desc: SetAnimateWindowFlag test
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(WindowPropertyTest, SetAnimateWindowFlag, Function | SmallTest | Level2)
|
||||
{
|
||||
WindowProperty winPropSrc;
|
||||
winPropSrc.SetPrivacyMode(true);
|
||||
winPropSrc.SetTransparent(true);
|
||||
bool isAnimateWindow = false;
|
||||
int resultValue = 0;
|
||||
std::function<void()> func = [&]() {
|
||||
winPropSrc.SetAnimateWindowFlag(isAnimateWindow);
|
||||
resultValue = 1;
|
||||
};
|
||||
func();
|
||||
ASSERT_EQ(resultValue, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: IsDisplayZoomOn
|
||||
* @tc.desc: IsDisplayZoomOn test
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(WindowPropertyTest, IsDisplayZoomOn, Function | SmallTest | Level2)
|
||||
{
|
||||
WindowProperty winPropSrc;
|
||||
winPropSrc.SetPrivacyMode(true);
|
||||
winPropSrc.SetTransparent(true);
|
||||
bool ret = winPropSrc.IsDisplayZoomOn();
|
||||
ASSERT_EQ(false, ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: IsAnimateWindow
|
||||
* @tc.desc: IsAnimateWindow test
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(WindowPropertyTest, IsAnimateWindow, Function | SmallTest | Level2)
|
||||
{
|
||||
WindowProperty winPropSrc;
|
||||
winPropSrc.SetPrivacyMode(true);
|
||||
winPropSrc.SetTransparent(true);
|
||||
bool ret = winPropSrc.IsAnimateWindow();
|
||||
ASSERT_EQ(false, ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetSizeLimits
|
||||
* @tc.desc: SetSizeLimits test
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(WindowPropertyTest, SetSizeLimits, Function | SmallTest | Level2)
|
||||
{
|
||||
WindowProperty winPropSrc;
|
||||
winPropSrc.SetPrivacyMode(true);
|
||||
winPropSrc.SetTransparent(true);
|
||||
WindowLimits sizeLimits;
|
||||
int resultValue = 0;
|
||||
std::function<void()> func = [&]() {
|
||||
winPropSrc.SetSizeLimits(sizeLimits);
|
||||
resultValue = 1;
|
||||
};
|
||||
func();
|
||||
ASSERT_EQ(resultValue, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetUpdatedSizeLimits
|
||||
* @tc.desc: SetUpdatedSizeLimits test
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(WindowPropertyTest, SetUpdatedSizeLimits, Function | SmallTest | Level2)
|
||||
{
|
||||
WindowProperty winPropSrc;
|
||||
winPropSrc.SetPrivacyMode(true);
|
||||
winPropSrc.SetTransparent(true);
|
||||
WindowLimits sizeLimits;
|
||||
int resultValue = 0;
|
||||
std::function<void()> func = [&]() {
|
||||
winPropSrc.SetUpdatedSizeLimits(sizeLimits);
|
||||
resultValue = 1;
|
||||
};
|
||||
func();
|
||||
ASSERT_EQ(resultValue, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetDecorEnable
|
||||
* @tc.desc: SetDecorEnable test
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(WindowPropertyTest, SetDecorEnable, Function | SmallTest | Level2)
|
||||
{
|
||||
WindowProperty winPropSrc;
|
||||
winPropSrc.SetPrivacyMode(true);
|
||||
winPropSrc.SetTransparent(true);
|
||||
bool decorEnable = false;
|
||||
int resultValue = 0;
|
||||
std::function<void()> func = [&]() {
|
||||
winPropSrc.SetDecorEnable(decorEnable);
|
||||
resultValue = 1;
|
||||
};
|
||||
func();
|
||||
ASSERT_EQ(resultValue, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AddWindowFlag001
|
||||
* @tc.desc: AddWindowFlag test
|
||||
|
@ -391,6 +391,7 @@ HWTEST_F(IntentionEventManagerTest, ProcessEnterLeaveEventAsync1, Function | Med
|
||||
EXPECT_NE(nullptr, callback);
|
||||
sptr<SceneSession> sceneSession = new SceneSession(info, callback);
|
||||
EXPECT_NE(nullptr, sceneSession);
|
||||
EXPECT_EQ(-1, sceneSession->GetPersistentId());
|
||||
|
||||
pointerEvent->SetPointerAction(MMI::PointerEvent::POINTER_ACTION_ENTER_WINDOW);
|
||||
sceneSession->TransferPointerEvent(pointerEvent, true);
|
||||
@ -400,6 +401,7 @@ HWTEST_F(IntentionEventManagerTest, ProcessEnterLeaveEventAsync1, Function | Med
|
||||
SceneSession::ClearEnterWindow();
|
||||
info.persistentId_ = 2024;
|
||||
sceneSession = new SceneSession(info, callback);
|
||||
EXPECT_EQ(2024, sceneSession->GetPersistentId());
|
||||
sceneSession->TransferPointerEvent(pointerEvent, true);
|
||||
inputEventListener_->ProcessEnterLeaveEventAsync();
|
||||
std::shared_ptr<IntentionEventManager::InputEventListener> inputEventListener2 =
|
||||
|
@ -29,10 +29,6 @@ public:
|
||||
void TearDown() override;
|
||||
};
|
||||
|
||||
std::map<ScenePersistentStorageType, std::string> ScenePersistentStorage::storagePath_ = {
|
||||
{ScenePersistentStorageType::ASPECT_RATIO, "aspect_ratio"},
|
||||
{ScenePersistentStorageType::MAXIMIZE_STATE, "maximize_state"}};
|
||||
|
||||
void ScenePersistentStorageTest::SetUpTestCase()
|
||||
{
|
||||
}
|
||||
|
@ -52,6 +52,8 @@ public:
|
||||
static void SetVisibleForAccessibility(sptr<SceneSession>& sceneSession);
|
||||
int32_t GetTaskCount(sptr<SceneSession>& session);
|
||||
static sptr<SceneSessionManager> ssm_;
|
||||
private:
|
||||
static constexpr uint32_t WAIT_SYNC_IN_NS = 200000;
|
||||
};
|
||||
|
||||
sptr<SceneSessionManager> SceneSessionManagerTest::ssm_ = nullptr;
|
||||
@ -85,6 +87,7 @@ void SceneSessionManagerTest::SetUp()
|
||||
|
||||
void SceneSessionManagerTest::TearDown()
|
||||
{
|
||||
usleep(WAIT_SYNC_IN_NS);
|
||||
ssm_->sceneSessionMap_.clear();
|
||||
}
|
||||
|
||||
@ -819,7 +822,7 @@ HWTEST_F(SceneSessionManagerTest, RecoverSessionInfo, Function | SmallTest | Lev
|
||||
SessionInfo info = ssm_->RecoverSessionInfo(nullptr);
|
||||
|
||||
sptr<WindowSessionProperty> property = new WindowSessionProperty();
|
||||
EXPECT_FALSE(ssm_->alivePersistentIds_.empty());
|
||||
ASSERT_NE(nullptr, property);
|
||||
info = ssm_->RecoverSessionInfo(property);
|
||||
}
|
||||
|
||||
|
@ -2221,7 +2221,7 @@ HWTEST_F(SceneSessionManagerTest2, NotifyCreateToastSession, Function | SmallTes
|
||||
int32_t persistentId = Info.persistentId_;
|
||||
Info.abilityName_ = "testInfo1a";
|
||||
Info.bundleName_ = "testInfo1b";
|
||||
sptr<SceneSession> session = new(std::nothrow) SceneSession(Info, nullptr);
|
||||
sptr<SceneSession> session = new (std::nothrow) SceneSession(Info, nullptr);
|
||||
ssm_->NotifyCreateToastSession(persistentId, session);
|
||||
}
|
||||
}
|
||||
|
@ -69,6 +69,8 @@ public:
|
||||
static bool gestureNavigationEnabled_;
|
||||
static ProcessGestureNavigationEnabledChangeFunc callbackFunc_;
|
||||
static sptr<SceneSessionManager> ssm_;
|
||||
private:
|
||||
static constexpr uint32_t WAIT_SYNC_IN_NS = 50000;
|
||||
};
|
||||
|
||||
sptr<SceneSessionManager> SceneSessionManagerTest3::ssm_ = nullptr;
|
||||
@ -98,6 +100,7 @@ void SceneSessionManagerTest3::SetUpTestCase()
|
||||
void SceneSessionManagerTest3::TearDownTestCase()
|
||||
{
|
||||
ssm_ = nullptr;
|
||||
usleep(WAIT_SYNC_IN_NS);
|
||||
}
|
||||
|
||||
void SceneSessionManagerTest3::SetUp()
|
||||
@ -1461,19 +1464,17 @@ HWTEST_F(SceneSessionManagerTest3, SetFocusedSessionId, Function | SmallTest | L
|
||||
*/
|
||||
HWTEST_F(SceneSessionManagerTest3, RequestFocusStatus, Function | SmallTest | Level3)
|
||||
{
|
||||
FocusChangeReason reasonInput = FocusChangeReason::DEFAULT;
|
||||
FocusChangeReason reasonResult = FocusChangeReason::DEFAULT;
|
||||
int32_t focusedSession = ssm_->GetFocusedSessionId();
|
||||
EXPECT_EQ(focusedSession, 10086);
|
||||
|
||||
int32_t persistentId = INVALID_SESSION_ID;
|
||||
WMError result01 = ssm_->RequestFocusStatus(persistentId, true);
|
||||
EXPECT_EQ(result01, WMError::WM_ERROR_NULLPTR);
|
||||
reasonResult = ssm_->GetFocusChangeReason();
|
||||
FocusChangeReason reasonResult = ssm_->GetFocusChangeReason();
|
||||
EXPECT_EQ(reasonResult, FocusChangeReason::DEFAULT);
|
||||
|
||||
persistentId = 10000;
|
||||
reasonInput = FocusChangeReason::SCB_SESSION_REQUEST;
|
||||
FocusChangeReason reasonInput = FocusChangeReason::SCB_SESSION_REQUEST;
|
||||
WMError result02 = ssm_->RequestFocusStatus(persistentId, true, true, reasonInput);
|
||||
EXPECT_EQ(result02, WMError::WM_ERROR_NULLPTR);
|
||||
reasonResult = ssm_->GetFocusChangeReason();
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "pointer_event.h"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "key_event.h"
|
||||
#include "session/host/include/scene_session.h"
|
||||
#include "session/host/include/sub_session.h"
|
||||
#include "session/host/include/system_session.h"
|
||||
@ -77,6 +78,7 @@ HWTEST_F(SceneSessionTest, Foreground01, Function | SmallTest | Level2)
|
||||
scensession->isActive_ = true;
|
||||
sptr<WindowSessionProperty> property = new(std::nothrow) WindowSessionProperty();
|
||||
ASSERT_NE(nullptr, property);
|
||||
|
||||
auto result = scensession->Foreground(property);
|
||||
ASSERT_EQ(result, WSError::WS_OK);
|
||||
specificCallback_->onCreate_ = [&resultValue, specificCallback_](const SessionInfo &info,
|
||||
@ -148,7 +150,6 @@ HWTEST_F(SceneSessionTest, BackgroundTask01, Function | SmallTest | Level2)
|
||||
EXPECT_NE(specificCallback, nullptr);
|
||||
int resultValue = 0;
|
||||
sptr<SceneSession> sceneSession;
|
||||
|
||||
sceneSession = new (std::nothrow) SceneSession(info, nullptr);
|
||||
EXPECT_NE(sceneSession, nullptr);
|
||||
sceneSession->isActive_ = true;
|
||||
@ -1766,7 +1767,7 @@ HWTEST_F(SceneSessionTest, SetAspectRatio7, Function | SmallTest | Level2)
|
||||
property->SetWindowLimits(limits);
|
||||
scensession->SetSessionProperty(property);
|
||||
auto result = scensession->SetAspectRatio(ratio);
|
||||
ASSERT_EQ(result, WSError::WS_OK);
|
||||
ASSERT_EQ(result, WSError::WS_ERROR_INVALID_PARAM);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,6 +130,7 @@ HWTEST_F(WindowImplTest, CreateWindow03, Function | SmallTest | Level2)
|
||||
option->SetWindowName("CreateWindow03");
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
ASSERT_EQ(WMError::WM_ERROR_INVALID_PARENT, window->Create(1234));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Destroy());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -251,7 +251,7 @@ HWTEST_F(WindowTest, GetMode, Function | SmallTest | Level2)
|
||||
ASSERT_NE(nullptr, window);
|
||||
ASSERT_EQ(WindowMode::WINDOW_MODE_UNDEFINED, window->GetMode());
|
||||
ASSERT_EQ(WMError::WM_OK, window->Destroy());
|
||||
|
||||
|
||||
auto window_ = new (std::nothrow)Window();
|
||||
ASSERT_NE(nullptr, window_);
|
||||
ASSERT_EQ(WindowMode::WINDOW_MODE_UNDEFINED, window_->GetMode());
|
||||
@ -1653,7 +1653,7 @@ HWTEST_F(WindowTest, Recover, Function | SmallTest | Level2)
|
||||
sptr<Window> window = new Window();
|
||||
ASSERT_NE(nullptr, window);
|
||||
auto ret = window->Recover();
|
||||
|
||||
|
||||
if (SceneBoardJudgement::IsSceneBoardEnabled()) {
|
||||
ASSERT_NE(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, ret);
|
||||
} else {
|
||||
@ -2289,19 +2289,6 @@ HWTEST_F(WindowTest, TransferAccessibilityEvent, Function | SmallTest | Level2)
|
||||
ASSERT_EQ(WMError::WM_OK, window->TransferAccessibilityEvent(info, uiExtensionIdLevel));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetSingleFrameComposerEnabled
|
||||
* @tc.desc: set single frame composer enable flag
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(WindowTest, SetSingleFrameComposerEnabled, Function | SmallTest | Level2)
|
||||
{
|
||||
sptr<Window> window = new Window();
|
||||
ASSERT_NE(nullptr, window);
|
||||
ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, window->SetSingleFrameComposerEnabled(false));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Destroy());
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: FlushFrameRate
|
||||
* @tc.desc: FlushFrameRate Test
|
||||
@ -2318,6 +2305,19 @@ HWTEST_F(WindowTest, FlushFrameRate, Function | SmallTest | Level2)
|
||||
ASSERT_EQ(WMError::WM_OK, window->Destroy());
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetSingleFrameComposerEnabled
|
||||
* @tc.desc: set single frame composer enable flag
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(WindowTest, SetSingleFrameComposerEnabled, Function | SmallTest | Level2)
|
||||
{
|
||||
sptr<Window> window = new Window();
|
||||
ASSERT_NE(nullptr, window);
|
||||
ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, window->SetSingleFrameComposerEnabled(false));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Destroy());
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: Maximize01
|
||||
* @tc.desc: maximize interface Test
|
||||
@ -2430,8 +2430,7 @@ HWTEST_F(WindowTest, Create05, Function | SmallTest | Level2)
|
||||
sptr<WindowOption> option = nullptr;
|
||||
auto window = Window::Create("WindowTest02", option);
|
||||
uint32_t version = 0;
|
||||
if (version < 10)
|
||||
{
|
||||
if (version < 10) {
|
||||
ASSERT_NE(10, version);
|
||||
}
|
||||
WindowOption windowoption;
|
||||
@ -2620,18 +2619,10 @@ HWTEST_F(WindowTest, Test03, Function | SmallTest | Level2)
|
||||
*/
|
||||
HWTEST_F(WindowTest, Test04, Function | SmallTest | Level2)
|
||||
{
|
||||
ExtensionWindowFlags flags;
|
||||
ASSERT_EQ(flags.bitData, 0);
|
||||
ExtensionWindowFlags flags1(7);
|
||||
ASSERT_EQ(flags1.bitData, 7);
|
||||
sptr<Window> window = new Window();
|
||||
ASSERT_NE(nullptr, window);
|
||||
ASSERT_EQ(nullptr, window->GetUIContentWithId(0));
|
||||
sptr<IKeyboardPanelInfoChangeListener> listener = new IKeyboardPanelInfoChangeListener();
|
||||
KeyboardPanelInfo keyboardPanelInfo;
|
||||
listener->OnKeyboardPanelInfoChanged(keyboardPanelInfo);
|
||||
window->TriggerBindModalUIExtension();
|
||||
ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, window->SetWaterMarkFlag(true));
|
||||
ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, window->SetGrayScale(0));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Destroy());
|
||||
}
|
||||
@ -2651,25 +2642,6 @@ HWTEST_F(WindowTest, Test05, Function | SmallTest | Level2)
|
||||
ASSERT_EQ(WMError::WM_OK, window->Destroy());
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: Test06
|
||||
* @tc.desc: Test06
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(WindowTest, Test06, Function | SmallTest | Level2)
|
||||
{
|
||||
KeyboardLayoutParams param;
|
||||
KeyboardLayoutParams param1;
|
||||
ASSERT_EQ(true, (param == param1));
|
||||
ASSERT_EQ(false, (param != param1));
|
||||
ASSERT_EQ(true, param.isEmpty());
|
||||
Parcel parcel;
|
||||
Rect rect = {0, 0, 0, 0};
|
||||
ASSERT_EQ(false, KeyboardLayoutParams::ReadParcel(parcel, rect));
|
||||
parcel.WriteUint32(0);
|
||||
ASSERT_EQ(nullptr, KeyboardLayoutParams::Unmarshalling(parcel));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetTitleButtonVisible
|
||||
* @tc.desc: SetTitleButtonVisible
|
||||
|
@ -114,6 +114,23 @@ HWTEST_F(InputWindowMonitorTest, UpdateDisplayInfo02, Function | SmallTest | Lev
|
||||
ASSERT_NE(0, displayInfoVector.size());
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: TransformWindowRects
|
||||
* @tc.desc: TransformWindowRects
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(InputWindowMonitorTest, TransformWindowRects, Function | SmallTest | Level2)
|
||||
{
|
||||
sptr<WindowNode> windowNode = new WindowNode();
|
||||
Rect areaRect;
|
||||
std::vector<Rect> touchHotAreas;
|
||||
std::vector<Rect> pointerHotAreas;
|
||||
input_monitor_->TransformWindowRects(windowNode, areaRect, touchHotAreas, pointerHotAreas);
|
||||
WindowProperty windowProperty;
|
||||
auto result = windowProperty.isNeedComputerTransform();
|
||||
ASSERT_EQ(result, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetDisplayDirectionForMmi02
|
||||
* @tc.desc: get display direction
|
||||
|
@ -268,7 +268,8 @@ HWTEST_F(WindowInnerManagerTest, UpdateInnerWindow, Function | SmallTest | Level
|
||||
HWTEST_F(WindowInnerManagerTest, TerminateAbility, Function | SmallTest | Level2)
|
||||
{
|
||||
wim_->isRecentHolderEnable_ = true;
|
||||
wptr<WindowNode> node1 = nullptr;
|
||||
sptr<WindowNode> node = new WindowNode();
|
||||
wptr<WindowNode> node1 = node;
|
||||
wim_->TerminateAbility(node1);
|
||||
ASSERT_EQ(wim_->isRecentHolderEnable_, true);
|
||||
}
|
||||
@ -281,7 +282,8 @@ HWTEST_F(WindowInnerManagerTest, TerminateAbility, Function | SmallTest | Level2
|
||||
HWTEST_F(WindowInnerManagerTest, CloseAbility, Function | SmallTest | Level2)
|
||||
{
|
||||
wim_->isRecentHolderEnable_ = true;
|
||||
wptr<WindowNode> node1 = nullptr;
|
||||
sptr<WindowNode> node = new WindowNode();
|
||||
wptr<WindowNode> node1 = node;
|
||||
wim_->CloseAbility(node1);
|
||||
ASSERT_EQ(wim_->isRecentHolderEnable_, true);
|
||||
}
|
||||
@ -294,7 +296,8 @@ HWTEST_F(WindowInnerManagerTest, CloseAbility, Function | SmallTest | Level2)
|
||||
HWTEST_F(WindowInnerManagerTest, CompleteFirstFrameDrawing, Function | SmallTest | Level2)
|
||||
{
|
||||
wim_->isRecentHolderEnable_ = true;
|
||||
wptr<WindowNode> node1 = nullptr;
|
||||
sptr<WindowNode> node = new WindowNode();
|
||||
wptr<WindowNode> node1 = node;
|
||||
wim_->CompleteFirstFrameDrawing(node1);
|
||||
ASSERT_EQ(wim_->isRecentHolderEnable_, true);
|
||||
}
|
||||
@ -307,8 +310,9 @@ HWTEST_F(WindowInnerManagerTest, CompleteFirstFrameDrawing, Function | SmallTest
|
||||
HWTEST_F(WindowInnerManagerTest, UpdateMissionSnapShot, Function | SmallTest | Level2)
|
||||
{
|
||||
wim_->isRecentHolderEnable_ = true;
|
||||
wptr<WindowNode> node1 = nullptr;
|
||||
std::shared_ptr<Media::PixelMap> pixelMap = nullptr;
|
||||
sptr<WindowNode> node = new WindowNode();
|
||||
wptr<WindowNode> node1 = node;
|
||||
std::shared_ptr<Media::PixelMap> pixelMap = std::make_shared<Media::PixelMap>();
|
||||
wim_->UpdateMissionSnapShot(node1, pixelMap);
|
||||
ASSERT_EQ(wim_->isRecentHolderEnable_, true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user