mirror of
https://gitee.com/openharmony/window_window_manager
synced 2024-11-23 15:00:12 +00:00
parentId replaces parentName
Signed-off-by: liuyangyang <liuyangyang58@huawei.com> Change-Id: I82e67349df20ba238360a954602529590811c8b3
This commit is contained in:
parent
bc3b1801ba
commit
acea90230f
@ -35,7 +35,7 @@ public:
|
||||
void SetFocusable(bool isFocusable);
|
||||
void SetTouchable(bool isTouchable);
|
||||
void SetDisplayId(DisplayId displayId);
|
||||
void SetParentName(const std::string& parentName);
|
||||
void SetParentId(uint32_t parentId);
|
||||
void SetWindowName(const std::string& windowName);
|
||||
void AddWindowFlag(WindowFlag flag);
|
||||
void RemoveWindowFlag(WindowFlag flag);
|
||||
@ -58,7 +58,7 @@ public:
|
||||
bool GetFocusable() const;
|
||||
bool GetTouchable() const;
|
||||
DisplayId GetDisplayId() const;
|
||||
const std::string& GetParentName() const;
|
||||
uint32_t GetParentId() const;
|
||||
const std::string& GetWindowName() const;
|
||||
uint32_t GetWindowFlags() const;
|
||||
const std::unordered_map<WindowType, SystemBarProperty>& GetSystemBarProperty() const;
|
||||
@ -76,7 +76,7 @@ private:
|
||||
bool focusable_ { true };
|
||||
bool touchable_ { true };
|
||||
DisplayId displayId_ { 0 };
|
||||
std::string parentName_ { "" };
|
||||
uint32_t parentId_ = INVALID_WINDOW_ID;
|
||||
std::string windowName_ { "" };
|
||||
uint32_t flags_ { 0 };
|
||||
PointInfo hitOffset_ { 0, 0 };
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "ability_context.h"
|
||||
#include "display_manager.h"
|
||||
#include "dm_common.h"
|
||||
#include "wm_common.h"
|
||||
#include "js_window.h"
|
||||
#include "js_window_utils.h"
|
||||
#include "window_helper.h"
|
||||
@ -113,7 +114,7 @@ static void GetNativeContext(NativeEngine& engine, NativeValue* nativeContext, v
|
||||
}
|
||||
}
|
||||
|
||||
static bool GetWindowTypeAndParentName(NativeEngine& engine, std::string& parentName, WindowType& winType,
|
||||
static bool GetWindowTypeAndParentId(NativeEngine& engine, uint32_t& parentId, WindowType& winType,
|
||||
NativeValue* nativeString, NativeValue* nativeType)
|
||||
{
|
||||
NativeNumber* type = ConvertNativeValueTo<NativeNumber>(nativeType);
|
||||
@ -145,7 +146,7 @@ static bool GetWindowTypeAndParentName(NativeEngine& engine, std::string& parent
|
||||
WLOGE("[NAPI]Get mainWindow failed");
|
||||
return false;
|
||||
}
|
||||
parentName = window->GetWindowName();
|
||||
parentId = window->GetWindowId();
|
||||
} else {
|
||||
if (!WindowHelper::IsSystemWindow(winType)) {
|
||||
WLOGFE("[NAPI]Only SystemWindow support create in stage mode, type is %{public}u", winType);
|
||||
@ -195,10 +196,10 @@ static void CreateSystemWindowTask(void* contextPtr, std::string windowName, Win
|
||||
}
|
||||
}
|
||||
|
||||
static void CreateSubWindowTask(std::string parentWinName, std::string windowName, WindowType winType,
|
||||
static void CreateSubWindowTask(uint32_t parentWinId, std::string windowName, WindowType winType,
|
||||
NativeEngine& engine, AsyncTask& task)
|
||||
{
|
||||
WLOGFI("[NAPI]CreateSubWindowTask, parent name = %{public}s", parentWinName.c_str());
|
||||
WLOGFI("[NAPI]CreateSubWindowTask, parent id = %{public}u", parentWinId);
|
||||
sptr<WindowOption> windowOption = new(std::nothrow) WindowOption();
|
||||
if (windowOption == nullptr) {
|
||||
task.Reject(engine, CreateJsError(engine,
|
||||
@ -208,7 +209,7 @@ static void CreateSubWindowTask(std::string parentWinName, std::string windowNam
|
||||
}
|
||||
windowOption->SetWindowType(winType);
|
||||
windowOption->SetWindowMode(Rosen::WindowMode::WINDOW_MODE_FLOATING);
|
||||
windowOption->SetParentName(parentWinName);
|
||||
windowOption->SetParentId(parentWinId);
|
||||
sptr<Window> window = Window::Create(windowName, windowOption);
|
||||
if (window != nullptr) {
|
||||
task.Resolve(engine, CreateJsWindowObject(engine, window));
|
||||
@ -246,10 +247,10 @@ NativeValue* JsWindowManager::OnCreateWindow(NativeEngine& engine, NativeCallbac
|
||||
WLOGFE("[NAPI]Failed to convert parameter to windowName");
|
||||
errCode = WMError::WM_ERROR_INVALID_PARAM;
|
||||
}
|
||||
std::string parentName;
|
||||
uint32_t parentId = INVALID_WINDOW_ID;
|
||||
WindowType winType = WindowType::SYSTEM_WINDOW_BASE;
|
||||
if (errCode == WMError::WM_OK &&
|
||||
!GetWindowTypeAndParentName(engine, parentName, winType, nativeString, nativeType)) {
|
||||
!GetWindowTypeAndParentId(engine, parentId, winType, nativeString, nativeType)) {
|
||||
errCode = WMError::WM_ERROR_INVALID_PARAM;
|
||||
}
|
||||
void* contextPtr = nullptr;
|
||||
@ -262,10 +263,10 @@ NativeValue* JsWindowManager::OnCreateWindow(NativeEngine& engine, NativeCallbac
|
||||
task.Reject(engine, CreateJsError(engine, static_cast<int32_t>(errCode), "Invalidate params"));
|
||||
return;
|
||||
}
|
||||
if (parentName.empty()) {
|
||||
if (parentId == INVALID_WINDOW_ID) {
|
||||
return CreateSystemWindowTask(contextPtr, windowName, winType, engine, task);
|
||||
} else {
|
||||
return CreateSubWindowTask(parentName, windowName, winType, engine, task);
|
||||
return CreateSubWindowTask(parentId, windowName, winType, engine, task);
|
||||
}
|
||||
};
|
||||
NativeValue* result = nullptr;
|
||||
|
@ -90,7 +90,7 @@ public:
|
||||
virtual WMError UpdateSurfaceNodeAfterCustomAnimation(bool isAdd) override;
|
||||
virtual WMError GetAvoidAreaByType(AvoidAreaType type, AvoidArea& avoidArea) override;
|
||||
|
||||
WMError Create(const std::string& parentName,
|
||||
WMError Create(uint32_t parentId,
|
||||
const std::shared_ptr<AbilityRuntime::Context>& context = nullptr);
|
||||
virtual WMError Destroy() override;
|
||||
virtual WMError Show(uint32_t reason = 0, bool withAnimation = false) override;
|
||||
|
@ -310,7 +310,7 @@ WMError WindowImpl::SetFullScreen(bool status)
|
||||
return WMError::WM_OK;
|
||||
}
|
||||
|
||||
WMError WindowImpl::Create(const std::string& parentName, const std::shared_ptr<AbilityRuntime::Context>& context)
|
||||
WMError WindowImpl::Create(uint32_t parentId, const std::shared_ptr<AbilityRuntime::Context>& context)
|
||||
{
|
||||
WLOGFI("[Client] Window [name:%{public}s] Create", name_.c_str());
|
||||
// check window name, same window names are forbidden
|
||||
@ -318,14 +318,17 @@ WMError WindowImpl::Create(const std::string& parentName, const std::shared_ptr<
|
||||
WLOGFE("WindowName(%{public}s) already exists.", name_.c_str());
|
||||
return WMError::WM_ERROR_INVALID_PARAM;
|
||||
}
|
||||
// check parent name, if create sub window and there is not exist parent Window, then return
|
||||
if (parentName != "") {
|
||||
if (windowMap_.find(parentName) == windowMap_.end()) {
|
||||
WLOGFE("ParentName is empty or valid. ParentName is %{public}s", parentName.c_str());
|
||||
return WMError::WM_ERROR_INVALID_PARAM;
|
||||
} else {
|
||||
uint32_t parentId = windowMap_[parentName].first;
|
||||
property_->SetParentId(parentId);
|
||||
// check parent id, if create sub window and there is not exist parent Window, then return
|
||||
if (parentId != INVALID_WINDOW_ID) {
|
||||
for (auto& winPair : windowMap_) {
|
||||
if (winPair.second.first == parentId) {
|
||||
property_->SetParentId(parentId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (property_->GetParentId() != parentId) {
|
||||
WLOGFE("ParentId is empty or valid. ParentId is %{public}u", parentId);
|
||||
return WMError::WM_ERROR_INVALID_PARAM;;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ sptr<Window> WindowScene::CreateWindow(const std::string& windowName, sptr<Windo
|
||||
WLOGFE("WindowScene Name: %{public}s", windowName.c_str());
|
||||
return nullptr;
|
||||
}
|
||||
option->SetParentName(mainWindow_->GetWindowName());
|
||||
option->SetParentId(mainWindow_->GetWindowId());
|
||||
option->SetWindowTag(WindowTag::SUB_WINDOW);
|
||||
return Window::Create(windowName, option, mainWindow_->GetContext());
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ int main(int argc, char *argv[])
|
||||
subWindowOp->SetWindowType(WindowType::WINDOW_TYPE_SYSTEM_SUB_WINDOW);
|
||||
subWindowOp->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
|
||||
subWindowOp->SetWindowRect(subWindowRect);
|
||||
subWindowOp->SetParentName("Demo_SSW_BaseWindow");
|
||||
subWindowOp->SetParentId(window->GetWindowId());
|
||||
|
||||
sptr<Window> subWindow = Window::Create("Demo_SSW_SubWindow", subWindowOp, nullptr);
|
||||
subWindow->Show();
|
||||
|
@ -83,16 +83,14 @@ size_t InitWindowOption1(WindowOption &windowOption, const uint8_t *data, size_t
|
||||
DisplayId displayId;
|
||||
startPos += GetObject<DisplayId>(displayId, data + startPos, size - startPos);
|
||||
windowOption.SetDisplayId(displayId);
|
||||
uint32_t parentId;
|
||||
startPos += GetObject<uint32_t>(parentId, data + startPos, size - startPos);
|
||||
windowOption.SetParentId(parentId);
|
||||
char name[LEN + 1];
|
||||
name[LEN] = END_CHAR;
|
||||
for (int i = 0; i < LEN; i++) {
|
||||
startPos += GetObject<char>(name[i], data + startPos, size - startPos);
|
||||
}
|
||||
std::string parentName(name);
|
||||
windowOption.SetParentName(parentName);
|
||||
for (int i = 0; i < LEN; i++) {
|
||||
startPos += GetObject<char>(name[i], data + startPos, size - startPos);
|
||||
}
|
||||
std::string windowName(name);
|
||||
windowOption.SetWindowName(windowName);
|
||||
return startPos;
|
||||
|
@ -16,6 +16,7 @@
|
||||
// gtest
|
||||
#include <gtest/gtest.h>
|
||||
#include "window.h"
|
||||
#include "wm_common.h"
|
||||
#include "window_test_utils.h"
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
@ -82,7 +83,7 @@ void WindowAnimationTransitionTest::SetUp()
|
||||
.mode = WindowMode::WINDOW_MODE_FLOATING,
|
||||
.needAvoid = false,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
trans_.pivotX_ = 1.0f;
|
||||
trans_.pivotY_ = 0.6f;
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "window_test_utils.h"
|
||||
#include "window_accessibility_controller.h"
|
||||
#include "window_impl.h"
|
||||
#include "wm_common.h"
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
|
||||
@ -51,7 +52,7 @@ void WindowDisplayZoomTest::SetUp()
|
||||
.needAvoid = false,
|
||||
.parentLimit = false,
|
||||
.showWhenLocked = true,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ void WindowDragTest::SetUp()
|
||||
.mode = WindowMode::WINDOW_MODE_FLOATING,
|
||||
.needAvoid = false,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
|
||||
firstWindowInfo_ = {
|
||||
@ -82,7 +82,7 @@ void WindowDragTest::SetUp()
|
||||
.mode = WindowMode::WINDOW_MODE_FULLSCREEN,
|
||||
.needAvoid = false,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
|
||||
secondWindowInfo_ = {
|
||||
@ -92,7 +92,7 @@ void WindowDragTest::SetUp()
|
||||
.mode = WindowMode::WINDOW_MODE_FLOATING,
|
||||
.needAvoid = false,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
// gtest
|
||||
#include <gtest/gtest.h>
|
||||
#include "window_test_utils.h"
|
||||
#include "wm_common.h"
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
|
||||
@ -48,7 +49,7 @@ void WindowEffectTest::SetUp()
|
||||
.mode = WindowMode::WINDOW_MODE_FLOATING,
|
||||
.needAvoid = false,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ void WindowFocusTest::SetUp()
|
||||
.mode = WindowMode::WINDOW_MODE_FULLSCREEN,
|
||||
.needAvoid = false,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
floatAppInfo_ = {
|
||||
.name = "ParentWindow",
|
||||
@ -97,7 +97,7 @@ void WindowFocusTest::SetUp()
|
||||
.mode = WindowMode::WINDOW_MODE_FLOATING,
|
||||
.needAvoid = false,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
subAppInfo_ = {
|
||||
.name = "SubWindow",
|
||||
@ -106,7 +106,7 @@ void WindowFocusTest::SetUp()
|
||||
.mode = WindowMode::WINDOW_MODE_FLOATING,
|
||||
.needAvoid = false,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
WindowManager::GetInstance().RegisterFocusChangedListener(testFocusChangedListener_);
|
||||
}
|
||||
@ -141,7 +141,7 @@ HWTEST_F(WindowFocusTest, FocusChangedTest01, Function | MediumTest | Level3)
|
||||
|
||||
subAppInfo_.name = "FocusChangedTest01_4";
|
||||
subAppInfo_.rect = { 400, 200, 100, 100 };
|
||||
subAppInfo_.parentName = window3->GetWindowName();
|
||||
subAppInfo_.parentId = window3->GetWindowId();
|
||||
const sptr<Window>& subWindow = Utils::CreateTestWindow(subAppInfo_);
|
||||
|
||||
ASSERT_EQ(WMError::WM_OK, window3->Show());
|
||||
@ -187,7 +187,7 @@ HWTEST_F(WindowFocusTest, FocusChangedTest02, Function | MediumTest | Level3)
|
||||
|
||||
subAppInfo_.name = "FocusChangedTest02_2";
|
||||
subAppInfo_.rect = { 400, 200, 100, 100 };
|
||||
subAppInfo_.parentName = mainWindow->GetWindowName();
|
||||
subAppInfo_.parentId = mainWindow->GetWindowId();
|
||||
const sptr<Window>& subWindow = Utils::CreateTestWindow(subAppInfo_);
|
||||
ASSERT_NE(nullptr, subWindow);
|
||||
ASSERT_EQ(WMError::WM_OK, subWindow->Show());
|
||||
@ -218,7 +218,7 @@ HWTEST_F(WindowFocusTest, FocusChangedTest03, Function | MediumTest | Level3)
|
||||
|
||||
subAppInfo_.name = "FocusChangedTest03_2";
|
||||
subAppInfo_.rect = { 400, 200, 100, 100 };
|
||||
subAppInfo_.parentName = mainWindow1->GetWindowName();
|
||||
subAppInfo_.parentId = mainWindow1->GetWindowId();
|
||||
const sptr<Window>& aboveSubWindow = Utils::CreateTestWindow(subAppInfo_);
|
||||
ASSERT_NE(nullptr, aboveSubWindow);
|
||||
ASSERT_EQ(WMError::WM_OK, aboveSubWindow->Show());
|
||||
@ -257,7 +257,7 @@ HWTEST_F(WindowFocusTest, FocusChangedTest04, Function | MediumTest | Level3)
|
||||
|
||||
subAppInfo_.name = "FocusChangedTest04_2";
|
||||
subAppInfo_.rect = { 400, 200, 100, 100 };
|
||||
subAppInfo_.parentName = mainWindow1->GetWindowName();
|
||||
subAppInfo_.parentId = mainWindow1->GetWindowId();
|
||||
subAppInfo_.type = WindowType::WINDOW_TYPE_MEDIA;
|
||||
const sptr<Window>& belowSubWindow = Utils::CreateTestWindow(subAppInfo_);
|
||||
ASSERT_NE(nullptr, belowSubWindow);
|
||||
@ -303,7 +303,7 @@ HWTEST_F(WindowFocusTest, FocusChangedTest05, Function | MediumTest | Level3)
|
||||
|
||||
subAppInfo_.name = "FocusChangedTest05_3";
|
||||
subAppInfo_.rect = { 400, 200, 100, 100 };
|
||||
subAppInfo_.parentName = mainWindow2->GetWindowName();
|
||||
subAppInfo_.parentId = mainWindow2->GetWindowId();
|
||||
subAppInfo_.type = WindowType::WINDOW_TYPE_MEDIA;
|
||||
const sptr<Window>& belowSubWindow = Utils::CreateTestWindow(subAppInfo_);
|
||||
ASSERT_NE(nullptr, belowSubWindow);
|
||||
@ -346,7 +346,7 @@ HWTEST_F(WindowFocusTest, FocusChangedTest06, Function | MediumTest | Level3)
|
||||
|
||||
subAppInfo_.name = "FocusChangedTest06_2";
|
||||
subAppInfo_.rect = { 100, 200, 100, 100 };
|
||||
subAppInfo_.parentName = mainWindow->GetWindowName();
|
||||
subAppInfo_.parentId = mainWindow->GetWindowId();
|
||||
subAppInfo_.type = WindowType::WINDOW_TYPE_MEDIA;
|
||||
const sptr<Window>& belowSubWindow = Utils::CreateTestWindow(subAppInfo_);
|
||||
ASSERT_NE(nullptr, belowSubWindow);
|
||||
@ -354,7 +354,7 @@ HWTEST_F(WindowFocusTest, FocusChangedTest06, Function | MediumTest | Level3)
|
||||
|
||||
subAppInfo_.name = "FocusChangedTest06_3";
|
||||
subAppInfo_.rect = { 400, 200, 100, 100 };
|
||||
subAppInfo_.parentName = mainWindow->GetWindowName();
|
||||
subAppInfo_.parentId = mainWindow->GetWindowId();
|
||||
subAppInfo_.type = WindowType::WINDOW_TYPE_APP_SUB_WINDOW;
|
||||
const sptr<Window>& aboveSubWindow = Utils::CreateTestWindow(subAppInfo_);
|
||||
ASSERT_NE(nullptr, aboveSubWindow);
|
||||
@ -395,21 +395,21 @@ HWTEST_F(WindowFocusTest, FocusChangedTest07, Function | MediumTest | Level3)
|
||||
|
||||
subAppInfo_.name = "FocusChangedTest07_4";
|
||||
subAppInfo_.rect = { 20, 100, 100, 100 };
|
||||
subAppInfo_.parentName = mainWindow1->GetWindowName();
|
||||
subAppInfo_.parentId = mainWindow1->GetWindowId();
|
||||
subAppInfo_.type = WindowType::WINDOW_TYPE_MEDIA;
|
||||
const sptr<Window>& belowSubWindow1 = Utils::CreateTestWindow(subAppInfo_);
|
||||
ASSERT_NE(nullptr, belowSubWindow1);
|
||||
|
||||
subAppInfo_.name = "FocusChangedTest07_5";
|
||||
subAppInfo_.rect = { 400, 200, 100, 100 };
|
||||
subAppInfo_.parentName = mainWindow2->GetWindowName();
|
||||
subAppInfo_.parentId = mainWindow2->GetWindowId();
|
||||
subAppInfo_.type = WindowType::WINDOW_TYPE_APP_SUB_WINDOW;
|
||||
const sptr<Window>& aboveSubWindow = Utils::CreateTestWindow(subAppInfo_);
|
||||
ASSERT_NE(nullptr, aboveSubWindow);
|
||||
|
||||
subAppInfo_.name = "FocusChangedTest07_6";
|
||||
subAppInfo_.rect = { 310, 410, 100, 100 };
|
||||
subAppInfo_.parentName = mainWindow3->GetWindowName();
|
||||
subAppInfo_.parentId = mainWindow3->GetWindowId();
|
||||
subAppInfo_.type = WindowType::WINDOW_TYPE_MEDIA;
|
||||
const sptr<Window>& belowSubWindow2 = Utils::CreateTestWindow(subAppInfo_);
|
||||
ASSERT_NE(nullptr, belowSubWindow2);
|
||||
@ -460,7 +460,7 @@ HWTEST_F(WindowFocusTest, FocusChangedTest08, Function | MediumTest | Level3)
|
||||
|
||||
subAppInfo_.name = "FocusChangedTest08_3";
|
||||
subAppInfo_.rect = { 20, 100, 100, 100 };
|
||||
subAppInfo_.parentName = mainWindow1->GetWindowName();
|
||||
subAppInfo_.parentId = mainWindow1->GetWindowId();
|
||||
subAppInfo_.type = WindowType::WINDOW_TYPE_MEDIA;
|
||||
const sptr<Window>& belowSubWindow = Utils::CreateTestWindow(subAppInfo_);
|
||||
ASSERT_NE(nullptr, belowSubWindow);
|
||||
|
@ -16,6 +16,7 @@
|
||||
// gtest
|
||||
#include <gtest/gtest.h>
|
||||
#include "window_test_utils.h"
|
||||
#include "wm_common.h"
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
|
||||
@ -51,7 +52,7 @@ void WindowGamutTest::SetUp()
|
||||
.mode = WindowMode::WINDOW_MODE_FULLSCREEN,
|
||||
.needAvoid = false,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "window_manager.h"
|
||||
#include "window_test_utils.h"
|
||||
#include "wm_common.h"
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
|
||||
@ -216,7 +217,7 @@ void WindowImmersiveTest::SetUp()
|
||||
.mode = WindowMode::WINDOW_MODE_FULLSCREEN, // immersive setting
|
||||
.needAvoid = false, // immersive setting
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
avoidBarInfo_ = {
|
||||
.name = "LeftAvoidTest",
|
||||
|
@ -16,6 +16,7 @@
|
||||
// gtest
|
||||
#include <gtest/gtest.h>
|
||||
#include "window_test_utils.h"
|
||||
#include "wm_common.h"
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
|
||||
@ -53,7 +54,7 @@ void WindowInputMethodTest::SetUp()
|
||||
.mode = WindowMode::WINDOW_MODE_FLOATING,
|
||||
.needAvoid = false,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
keyGuardWindowInfo_ = {
|
||||
.name = "",
|
||||
@ -62,7 +63,7 @@ void WindowInputMethodTest::SetUp()
|
||||
.mode = WindowMode::WINDOW_MODE_FULLSCREEN,
|
||||
.needAvoid = false,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
// gtest
|
||||
#include <gtest/gtest.h>
|
||||
#include "window_test_utils.h"
|
||||
#include "wm_common.h"
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
|
||||
@ -55,7 +56,7 @@ void WindowInputTest::SetUp()
|
||||
.mode = WindowMode::WINDOW_MODE_FULLSCREEN,
|
||||
.needAvoid = false,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "window_manager.h"
|
||||
#include "window_test_utils.h"
|
||||
#include "wm_common.h"
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
|
||||
@ -83,7 +84,7 @@ void WindowLayoutTest::InitAvoidArea()
|
||||
.mode = WindowMode::WINDOW_MODE_FLOATING,
|
||||
.needAvoid = true,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
const sptr<Window>& window = Utils::CreateTestWindow(info);
|
||||
window->Show();
|
||||
@ -130,7 +131,7 @@ HWTEST_F(WindowLayoutTest, LayoutWindow01, Function | MediumTest | Level3)
|
||||
.mode = WindowMode::WINDOW_MODE_FLOATING,
|
||||
.needAvoid = true,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
const sptr<Window>& window = Utils::CreateTestWindow(info);
|
||||
ASSERT_EQ(true, window != nullptr);
|
||||
@ -155,7 +156,7 @@ HWTEST_F(WindowLayoutTest, LayoutWindow02, Function | MediumTest | Level3)
|
||||
.mode = WindowMode::WINDOW_MODE_FLOATING,
|
||||
.needAvoid = true,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
const sptr<Window>& window = Utils::CreateTestWindow(info);
|
||||
activeWindows_.push_back(window);
|
||||
@ -185,7 +186,7 @@ HWTEST_F(WindowLayoutTest, LayoutWindow04, Function | MediumTest | Level3)
|
||||
.mode = WindowMode::WINDOW_MODE_FLOATING,
|
||||
.needAvoid = true,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
sptr<Window> appWin = Utils::CreateTestWindow(info);
|
||||
activeWindows_.push_back(appWin);
|
||||
@ -238,7 +239,7 @@ HWTEST_F(WindowLayoutTest, LayoutWindow06, Function | MediumTest | Level3)
|
||||
.mode = WindowMode::WINDOW_MODE_FULLSCREEN,
|
||||
.needAvoid = false,
|
||||
.parentLimit = true,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
sptr<Window> sysWin = Utils::CreateTestWindow(info);
|
||||
activeWindows_.push_back(sysWin);
|
||||
@ -275,7 +276,7 @@ HWTEST_F(WindowLayoutTest, LayoutWindow07, Function | MediumTest | Level3)
|
||||
.mode = WindowMode::WINDOW_MODE_FLOATING,
|
||||
.needAvoid = false,
|
||||
.parentLimit = true,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
sptr<Window> sysWin = Utils::CreateTestWindow(info);
|
||||
activeWindows_.push_back(sysWin);
|
||||
@ -303,7 +304,7 @@ HWTEST_F(WindowLayoutTest, LayoutWindow08, Function | MediumTest | Level3)
|
||||
.mode = WindowMode::WINDOW_MODE_FLOATING,
|
||||
.needAvoid = true,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
const sptr<Window>& window = Utils::CreateTestWindow(info);
|
||||
activeWindows_.push_back(window);
|
||||
@ -327,7 +328,7 @@ HWTEST_F(WindowLayoutTest, LayoutWindow09, Function | MediumTest | Level3)
|
||||
.mode = WindowMode::WINDOW_MODE_FLOATING,
|
||||
.needAvoid = true,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
const sptr<Window>& window = Utils::CreateTestWindow(info);
|
||||
activeWindows_.push_back(window);
|
||||
@ -357,7 +358,7 @@ HWTEST_F(WindowLayoutTest, LayoutWindow10, Function | MediumTest | Level3)
|
||||
.mode = WindowMode::WINDOW_MODE_FLOATING,
|
||||
.needAvoid = true,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
const sptr<Window>& window = Utils::CreateTestWindow(info);
|
||||
activeWindows_.push_back(window);
|
||||
@ -386,7 +387,7 @@ HWTEST_F(WindowLayoutTest, LayoutTile01, Function | MediumTest | Level3)
|
||||
.mode = WindowMode::WINDOW_MODE_FLOATING,
|
||||
.needAvoid = true,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
|
||||
const sptr<Window>& window = Utils::CreateTestWindow(info);
|
||||
@ -447,7 +448,7 @@ HWTEST_F(WindowLayoutTest, LayoutTileNegative01, Function | MediumTest | Level3)
|
||||
.mode = WindowMode::WINDOW_MODE_FLOATING,
|
||||
.needAvoid = true,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
const sptr<Window>& window = Utils::CreateTestWindow(info);
|
||||
activeWindows_.push_back(window);
|
||||
@ -505,7 +506,7 @@ HWTEST_F(WindowLayoutTest, LayoutNegative01, Function | MediumTest | Level3)
|
||||
.mode = WindowMode::WINDOW_MODE_FLOATING,
|
||||
.needAvoid = true,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
const sptr<Window>& window = Utils::CreateTestWindow(info);
|
||||
activeWindows_.push_back(window);
|
||||
@ -531,7 +532,7 @@ HWTEST_F(WindowLayoutTest, LayoutNegative02, Function | MediumTest | Level3)
|
||||
.mode = WindowMode::WINDOW_MODE_FLOATING,
|
||||
.needAvoid = true,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
const sptr<Window>& window = Utils::CreateTestWindow(info);
|
||||
activeWindows_.push_back(window);
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "window_manager.h"
|
||||
#include "window_test_utils.h"
|
||||
#include "wm_common.h"
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
|
||||
@ -56,7 +57,7 @@ void WindowModeSupportInfoTest::SetUp()
|
||||
.mode = WindowMode::WINDOW_MODE_FULLSCREEN,
|
||||
.needAvoid = false,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
fullAppInfo_2_ = {
|
||||
.name = "FullWindow2",
|
||||
@ -65,7 +66,7 @@ void WindowModeSupportInfoTest::SetUp()
|
||||
.mode = WindowMode::WINDOW_MODE_FULLSCREEN,
|
||||
.needAvoid = false,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ void WindowMoveDragTest::SetUp()
|
||||
option->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
|
||||
option->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
|
||||
window_ = new WindowImpl(option);
|
||||
window_->Create("");
|
||||
window_->Create(INVALID_WINDOW_ID);
|
||||
usleep(WAIT_SYANC_MS);
|
||||
ASSERT_TRUE((window_ != nullptr));
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ void WindowOccupiedAreaChangeTest::SetUp()
|
||||
.mode = WindowMode::WINDOW_MODE_FULLSCREEN,
|
||||
.needAvoid = false,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
imeAppInfo_ = {
|
||||
.name = "ImeWindow",
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "window_manager.h"
|
||||
#include "window_accessibility_controller.h"
|
||||
#include "window_impl.h"
|
||||
#include "wm_common.h"
|
||||
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
@ -104,7 +105,7 @@ void WindowRotationTest::SetUp()
|
||||
.mode = WindowMode::WINDOW_MODE_FULLSCREEN,
|
||||
.needAvoid = true,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
|
||||
activeWindows_.clear();
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "avoid_area_controller.h"
|
||||
#include "window_manager.h"
|
||||
#include "window_test_utils.h"
|
||||
#include "wm_common.h"
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
|
||||
@ -59,7 +60,7 @@ void WindowSplitImmersiveTest::SetUp()
|
||||
.mode = WindowMode::WINDOW_MODE_FULLSCREEN,
|
||||
.needAvoid = true,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
|
||||
splitInfo_ = {
|
||||
@ -69,7 +70,7 @@ void WindowSplitImmersiveTest::SetUp()
|
||||
.mode = WindowMode::WINDOW_MODE_FULLSCREEN,
|
||||
.needAvoid = true,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
|
||||
activeWindows_.clear();
|
||||
|
@ -16,6 +16,7 @@
|
||||
// gtest
|
||||
#include <gtest/gtest.h>
|
||||
#include "window_test_utils.h"
|
||||
#include "wm_common.h"
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
|
||||
@ -53,7 +54,7 @@ void WindowSplitTest::SetUp()
|
||||
.mode = WindowMode::WINDOW_MODE_SPLIT_PRIMARY,
|
||||
.needAvoid = true,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
|
||||
splitInfo_ = {
|
||||
@ -63,7 +64,7 @@ void WindowSplitTest::SetUp()
|
||||
.mode = WindowMode::WINDOW_MODE_FULLSCREEN,
|
||||
.needAvoid = true,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
|
||||
activeWindows_.clear();
|
||||
|
@ -72,7 +72,7 @@ static sptr<Window> CreateAppSubWindow(sptr<Window> parentWindow, WindowType typ
|
||||
subOp->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
|
||||
subOp->SetWindowRect(rect);
|
||||
subOp->SetWindowFlags(flags);
|
||||
subOp->SetParentName(parentWindow->GetWindowName());
|
||||
subOp->SetParentId(parentWindow->GetWindowId());
|
||||
|
||||
static int cnt = 0;
|
||||
std::string subWinName = (name == "") ? "AppSubWindow" + std::to_string(cnt++) : name;
|
||||
@ -88,7 +88,7 @@ static sptr<Window> CreateSystemSubWindow(sptr<Window> parentWindow, struct Rect
|
||||
subOp->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
|
||||
subOp->SetWindowRect(rect);
|
||||
subOp->SetWindowFlags(flags);
|
||||
subOp->SetParentName(parentWindow->GetWindowName());
|
||||
subOp->SetParentId(parentWindow->GetWindowId());
|
||||
|
||||
static int cnt = 0;
|
||||
std::string subWinName = (name == "") ? "SystemSubWindow" + std::to_string(cnt++) : name;
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <ability_context.h>
|
||||
#include "window_helper.h"
|
||||
#include "wm_common_inner.h"
|
||||
#include "wm_common.h"
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
namespace {
|
||||
@ -51,8 +52,8 @@ sptr<Window> WindowTestUtils::CreateTestWindow(const TestWindowInfo& info)
|
||||
option->SetWindowMode(info.mode);
|
||||
option->SetFocusable(info.focusable_);
|
||||
option->SetRequestedOrientation(info.orientation_);
|
||||
if (info.parentName != "") {
|
||||
option->SetParentName(info.parentName);
|
||||
if (info.parentId != INVALID_WINDOW_ID) {
|
||||
option->SetParentId(info.parentId);
|
||||
}
|
||||
if (info.needAvoid) {
|
||||
option->AddWindowFlag(WindowFlag::WINDOW_FLAG_NEED_AVOID);
|
||||
@ -87,7 +88,7 @@ sptr<Window> WindowTestUtils::CreateDockWindow()
|
||||
.mode = WindowMode::WINDOW_MODE_FLOATING,
|
||||
.needAvoid = false,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
return CreateTestWindow(info);
|
||||
}
|
||||
@ -101,7 +102,7 @@ sptr<Window> WindowTestUtils::CreateStatusBarWindow()
|
||||
.mode = WindowMode::WINDOW_MODE_FLOATING,
|
||||
.needAvoid = false,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
return CreateTestWindow(info);
|
||||
}
|
||||
@ -115,7 +116,7 @@ sptr<Window> WindowTestUtils::CreateNavigationBarWindow()
|
||||
.mode = WindowMode::WINDOW_MODE_FLOATING,
|
||||
.needAvoid = false,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
return CreateTestWindow(info);
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
bool parentLimit;
|
||||
bool forbidSplitMove {false};
|
||||
bool showWhenLocked;
|
||||
std::string parentName;
|
||||
uint32_t parentId;
|
||||
bool focusable_ { true };
|
||||
Orientation orientation_ { Orientation::UNSPECIFIED };
|
||||
};
|
||||
|
@ -66,7 +66,7 @@ void WindowTouchOutsideTest::SetUp()
|
||||
.mode = WindowMode::WINDOW_MODE_FLOATING,
|
||||
.needAvoid = false,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
|
||||
secondWindowInfo_ = {
|
||||
@ -76,7 +76,7 @@ void WindowTouchOutsideTest::SetUp()
|
||||
.mode = WindowMode::WINDOW_MODE_FLOATING,
|
||||
.needAvoid = false,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
|
||||
thirdWindowInfo_ = {
|
||||
@ -86,7 +86,7 @@ void WindowTouchOutsideTest::SetUp()
|
||||
.mode = WindowMode::WINDOW_MODE_FLOATING,
|
||||
.needAvoid = false,
|
||||
.parentLimit = false,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ void WindowVisibilityInfoTest::SetUp()
|
||||
.needAvoid = false,
|
||||
.parentLimit = false,
|
||||
.showWhenLocked = true,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
floatAppInfo_ = {
|
||||
.name = "ParentWindow",
|
||||
@ -151,7 +151,7 @@ void WindowVisibilityInfoTest::SetUp()
|
||||
.needAvoid = false,
|
||||
.parentLimit = false,
|
||||
.showWhenLocked = true,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
subAppInfo_ = {
|
||||
.name = "SubWindow",
|
||||
@ -161,7 +161,7 @@ void WindowVisibilityInfoTest::SetUp()
|
||||
.needAvoid = false,
|
||||
.parentLimit = false,
|
||||
.showWhenLocked = true,
|
||||
.parentName = "",
|
||||
.parentId = INVALID_WINDOW_ID,
|
||||
};
|
||||
}
|
||||
|
||||
@ -196,7 +196,7 @@ HWTEST_F(WindowVisibilityInfoTest, WindowVisibilityInfoTest01, Function | Medium
|
||||
|
||||
subAppInfo_.name = "subWindow1";
|
||||
subAppInfo_.rect = {0, 600, 300, 100};
|
||||
subAppInfo_.parentName = window1->GetWindowName();
|
||||
subAppInfo_.parentId = window1->GetWindowId();
|
||||
sptr<Window> subWindow1 = Utils::CreateTestWindow(subAppInfo_);
|
||||
|
||||
ASSERT_EQ(WMError::WM_OK, window1->Show());
|
||||
|
@ -140,7 +140,7 @@ public:
|
||||
}
|
||||
virtual WMError GetAvoidAreaByType(AvoidAreaType type, AvoidArea& avoidArea) override;
|
||||
|
||||
WMError Create(const std::string& parentName,
|
||||
WMError Create(uint32_t parentId,
|
||||
const std::shared_ptr<AbilityRuntime::Context>& context = nullptr);
|
||||
virtual WMError Destroy() override;
|
||||
virtual WMError Show(uint32_t reason = 0, bool withAnimation = false) override;
|
||||
@ -383,7 +383,7 @@ private:
|
||||
void SetWindowCornerRadiusAccordingToSystemConfig();
|
||||
bool IsAppMainOrSubOrFloatingWindow();
|
||||
void UpdateWindowShadowAccordingToSystemConfig();
|
||||
bool WindowCreateCheck(const std::string& parentName);
|
||||
bool WindowCreateCheck(uint32_t parentId);
|
||||
|
||||
// colorspace, gamut
|
||||
using ColorSpaceConvertMap = struct {
|
||||
|
@ -49,7 +49,7 @@ sptr<Window> Window::Create(const std::string& windowName, sptr<WindowOption>& o
|
||||
WLOGFE("malloc windowImpl failed");
|
||||
return nullptr;
|
||||
}
|
||||
WMError error = windowImpl->Create(option->GetParentName(), context);
|
||||
WMError error = windowImpl->Create(option->GetParentId(), context);
|
||||
if (error != WMError::WM_OK) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -889,21 +889,24 @@ void WindowImpl::SetSystemConfig()
|
||||
UpdateWindowShadowAccordingToSystemConfig();
|
||||
}
|
||||
|
||||
bool WindowImpl::WindowCreateCheck(const std::string& parentName)
|
||||
bool WindowImpl::WindowCreateCheck(uint32_t parentId)
|
||||
{
|
||||
// check window name, same window names are forbidden
|
||||
if (windowMap_.find(name_) != windowMap_.end()) {
|
||||
WLOGFE("WindowName(%{public}s) already exists.", name_.c_str());
|
||||
return false;
|
||||
}
|
||||
// check parent name, if create sub window and there is not exist parent Window, then return
|
||||
if (parentName != "") {
|
||||
if (windowMap_.find(parentName) == windowMap_.end()) {
|
||||
WLOGFE("ParentName is empty or valid. ParentName is %{public}s", parentName.c_str());
|
||||
// check parent id, if create sub window and there is not exist parent Window, then return
|
||||
if (parentId != INVALID_WINDOW_ID) {
|
||||
for (auto& winPair : windowMap_) {
|
||||
if (winPair.second.first == parentId) {
|
||||
property_->SetParentId(parentId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (property_->GetParentId() != parentId) {
|
||||
WLOGFE("ParentId is empty or valid. ParentId is %{public}s", std::to_string(parentId).c_str());
|
||||
return false;
|
||||
} else {
|
||||
uint32_t parentId = windowMap_[parentName].first;
|
||||
property_->SetParentId(parentId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -914,10 +917,10 @@ bool WindowImpl::WindowCreateCheck(const std::string& parentName)
|
||||
return true;
|
||||
}
|
||||
|
||||
WMError WindowImpl::Create(const std::string& parentName, const std::shared_ptr<AbilityRuntime::Context>& context)
|
||||
WMError WindowImpl::Create(uint32_t parentId, const std::shared_ptr<AbilityRuntime::Context>& context)
|
||||
{
|
||||
WLOGFI("[Client] Window [name:%{public}s] Create", name_.c_str());
|
||||
if (!WindowCreateCheck(parentName)) {
|
||||
if (!WindowCreateCheck(parentId)) {
|
||||
return WMError::WM_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
@ -952,7 +955,7 @@ WMError WindowImpl::Create(const std::string& parentName, const std::shared_ptr<
|
||||
property_->SetWindowId(windowId);
|
||||
sptr<Window> self(this);
|
||||
windowMap_.insert(std::make_pair(name_, std::pair<uint32_t, sptr<Window>>(windowId, self)));
|
||||
if (parentName != "") { // add to subWindowMap_
|
||||
if (parentId != INVALID_WINDOW_ID) {
|
||||
subWindowMap_[property_->GetParentId()].push_back(window);
|
||||
}
|
||||
|
||||
|
@ -57,9 +57,9 @@ void WindowOption::SetDisplayId(DisplayId displayId)
|
||||
displayId_ = displayId;
|
||||
}
|
||||
|
||||
void WindowOption::SetParentName(const std::string& parentName)
|
||||
void WindowOption::SetParentId(uint32_t parentId)
|
||||
{
|
||||
parentName_ = parentName;
|
||||
parentId_ = parentId;
|
||||
}
|
||||
|
||||
void WindowOption::SetWindowName(const std::string& windowName)
|
||||
@ -119,9 +119,9 @@ DisplayId WindowOption::GetDisplayId() const
|
||||
return displayId_;
|
||||
}
|
||||
|
||||
const std::string& WindowOption::GetParentName() const
|
||||
uint32_t WindowOption::GetParentId() const
|
||||
{
|
||||
return parentName_;
|
||||
return parentId_;
|
||||
}
|
||||
|
||||
const std::string& WindowOption::GetWindowName() const
|
||||
|
@ -79,7 +79,7 @@ sptr<Window> WindowScene::CreateWindow(const std::string& windowName, sptr<Windo
|
||||
WLOGFE("WindowScene Name: %{public}s", windowName.c_str());
|
||||
return nullptr;
|
||||
}
|
||||
option->SetParentName(mainWindow_->GetWindowName());
|
||||
option->SetParentId(mainWindow_->GetWindowId());
|
||||
option->SetWindowTag(WindowTag::SUB_WINDOW);
|
||||
return SingletonContainer::Get<StaticCall>().CreateWindow(windowName, option, mainWindow_->GetContext());
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ void InputTransferStationTest::SetUp()
|
||||
sptr<WindowOption> option = new WindowOption();
|
||||
option->SetWindowName("inputwindow");
|
||||
window_ = new WindowImpl(option);
|
||||
window_->Create("");
|
||||
window_->Create(INVALID_WINDOW_ID);
|
||||
}
|
||||
|
||||
void InputTransferStationTest::TearDown()
|
||||
|
@ -61,7 +61,7 @@ HWTEST_F(WindowEffectTest, WindowEffect01, Function | SmallTest | Level2)
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
ASSERT_NE(nullptr, window);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetCornerRadius(0.0));
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetCornerRadius(16.0));
|
||||
@ -85,7 +85,7 @@ HWTEST_F(WindowEffectTest, WindowEffect02, Function | SmallTest | Level2)
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
ASSERT_NE(nullptr, window);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetShadowRadius(0.0));
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetShadowRadius(16.0));
|
||||
@ -109,7 +109,7 @@ HWTEST_F(WindowEffectTest, WindowEffect03, Function | SmallTest | Level2)
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
ASSERT_NE(nullptr, window);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetShadowColor("#FF22EE44"));
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetShadowColor("#22EE44"));
|
||||
@ -140,7 +140,7 @@ HWTEST_F(WindowEffectTest, WindowEffect04, Function | SmallTest | Level2)
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
ASSERT_NE(nullptr, window);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
|
||||
window->SetShadowOffsetX(0.0);
|
||||
window->SetShadowOffsetX(16.0);
|
||||
@ -169,7 +169,7 @@ HWTEST_F(WindowEffectTest, WindowEffect05, Function | SmallTest | Level2)
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
ASSERT_NE(nullptr, window);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetBlur(0.0));
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetBlur(16.0));
|
||||
@ -193,7 +193,7 @@ HWTEST_F(WindowEffectTest, WindowEffect06, Function | SmallTest | Level2)
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
ASSERT_NE(nullptr, window);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetBackdropBlur(0.0));
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetBackdropBlur(16.0));
|
||||
@ -217,7 +217,7 @@ HWTEST_F(WindowEffectTest, WindowEffect07, Function | SmallTest | Level2)
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
ASSERT_NE(nullptr, window);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetBackdropBlurStyle(WindowBlurStyle::WINDOW_BLUR_OFF));
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetBackdropBlurStyle(WindowBlurStyle::WINDOW_BLUR_THIN));
|
||||
|
@ -53,7 +53,7 @@ void WindowImplTest::TearDown()
|
||||
namespace {
|
||||
/**
|
||||
* @tc.name: CreateWindow01
|
||||
* @tc.desc: Create window with no parentName
|
||||
* @tc.desc: Create window with no parentId
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(WindowImplTest, CreateWindow01, Function | SmallTest | Level2)
|
||||
@ -64,7 +64,7 @@ HWTEST_F(WindowImplTest, CreateWindow01, Function | SmallTest | Level2)
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
|
||||
EXPECT_CALL(m->Mock(), DestroyWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Destroy());
|
||||
@ -72,7 +72,7 @@ HWTEST_F(WindowImplTest, CreateWindow01, Function | SmallTest | Level2)
|
||||
|
||||
/**
|
||||
* @tc.name: CreateWindow02
|
||||
* @tc.desc: Create window with no parentName and no abilityContext
|
||||
* @tc.desc: Create window with no parentId and no abilityContext
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(WindowImplTest, CreateWindow02, Function | SmallTest | Level2)
|
||||
@ -83,12 +83,12 @@ HWTEST_F(WindowImplTest, CreateWindow02, Function | SmallTest | Level2)
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_ERROR_SAMGR));
|
||||
ASSERT_EQ(WMError::WM_ERROR_SAMGR, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_ERROR_SAMGR, window->Create(INVALID_WINDOW_ID));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: CreateWindow03
|
||||
* @tc.desc: Create window with illegal parentName
|
||||
* @tc.desc: Create window with illegal parentId
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(WindowImplTest, CreateWindow03, Function | SmallTest | Level2)
|
||||
@ -96,7 +96,7 @@ HWTEST_F(WindowImplTest, CreateWindow03, Function | SmallTest | Level2)
|
||||
sptr<WindowOption> option = new WindowOption();
|
||||
option->SetWindowName("CreateWindow03");
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
ASSERT_EQ(WMError::WM_ERROR_INVALID_PARAM, window->Create("illegal"));
|
||||
ASSERT_EQ(WMError::WM_ERROR_INVALID_PARAM, window->Create(1234));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -111,13 +111,13 @@ HWTEST_F(WindowImplTest, CreateWindow04, Function | SmallTest | Level2)
|
||||
option->SetWindowName("CreateWindow04");
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
window->Create("");
|
||||
window->Create(INVALID_WINDOW_ID);
|
||||
|
||||
sptr<WindowOption> option_other = new WindowOption();
|
||||
option_other->SetWindowName("CreateWindow04");
|
||||
sptr<WindowImpl> window_other = new WindowImpl(option_other);
|
||||
|
||||
ASSERT_EQ(WMError::WM_ERROR_INVALID_PARAM, window_other->Create(""));
|
||||
ASSERT_EQ(WMError::WM_ERROR_INVALID_PARAM, window_other->Create(INVALID_WINDOW_ID));
|
||||
EXPECT_CALL(m->Mock(), DestroyWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Destroy());
|
||||
ASSERT_EQ(WMError::WM_OK, window_other->Destroy());
|
||||
@ -125,7 +125,7 @@ HWTEST_F(WindowImplTest, CreateWindow04, Function | SmallTest | Level2)
|
||||
|
||||
/**
|
||||
* @tc.name: CreateWindow05
|
||||
* @tc.desc: Create window with exist parentName
|
||||
* @tc.desc: Create window with exist parentId
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(WindowImplTest, CreateWindow05, Function | SmallTest | Level2)
|
||||
@ -136,14 +136,14 @@ HWTEST_F(WindowImplTest, CreateWindow05, Function | SmallTest | Level2)
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
|
||||
sptr<WindowOption> option2 = new WindowOption();
|
||||
option2->SetWindowName("CreateWindow05");
|
||||
sptr<WindowImpl> window2 = new WindowImpl(option2);
|
||||
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window2->Create("CreateWindow05_parent"));
|
||||
ASSERT_EQ(WMError::WM_OK, window2->Create(window->GetWindowId()));
|
||||
|
||||
EXPECT_CALL(m->Mock(), DestroyWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Destroy());
|
||||
@ -167,7 +167,7 @@ HWTEST_F(WindowImplTest, CreateWindow06, Function | SmallTest | Level2)
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
|
||||
ASSERT_EQ(1, window->GetRequestRect().posX_);
|
||||
ASSERT_EQ(2, window->GetRequestRect().posY_);
|
||||
@ -193,7 +193,7 @@ HWTEST_F(WindowImplTest, FindWindow01, Function | SmallTest | Level2)
|
||||
option->SetWindowName("FindWindow01");
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
window->Create("");
|
||||
window->Create(INVALID_WINDOW_ID);
|
||||
ASSERT_NE(nullptr, WindowImpl::Find("FindWindow01"));
|
||||
EXPECT_CALL(m->Mock(), DestroyWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Destroy());
|
||||
@ -211,12 +211,12 @@ HWTEST_F(WindowImplTest, FindWindow02, Function | SmallTest | Level2)
|
||||
option->SetWindowName("FindWindow02");
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
|
||||
option->SetWindowName("FindWindow02_other");
|
||||
sptr<WindowImpl> window2 = new WindowImpl(option);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window2->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window2->Create(INVALID_WINDOW_ID));
|
||||
|
||||
ASSERT_NE(nullptr, WindowImpl::Find("FindWindow02_other"));
|
||||
ASSERT_NE(nullptr, WindowImpl::Find("FindWindow02"));
|
||||
@ -259,7 +259,7 @@ HWTEST_F(WindowImplTest, FindWindow05, Function | SmallTest | Level2)
|
||||
option->SetWindowName("FindWindow05");
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
|
||||
EXPECT_CALL(m->Mock(), DestroyWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Destroy());
|
||||
@ -278,7 +278,7 @@ HWTEST_F(WindowImplTest, FindTopWindow01, Function | SmallTest | Level2)
|
||||
option->SetWindowName("FindTopWindow01");
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
|
||||
ASSERT_NE(nullptr, window->FindTopWindow(window->property_->GetWindowId()));
|
||||
|
||||
@ -298,7 +298,7 @@ HWTEST_F(WindowImplTest, SetWindowType01, Function | SmallTest | Level2)
|
||||
option->SetWindowName("SetWindowType01");
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW));
|
||||
EXPECT_CALL(m->Mock(), DestroyWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Destroy());
|
||||
@ -316,7 +316,7 @@ HWTEST_F(WindowImplTest, SetWindowMode01, Function | SmallTest | Level2)
|
||||
option->SetWindowName("SetWindowType01");
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetWindowMode(WindowMode::WINDOW_MODE_FULLSCREEN));
|
||||
EXPECT_CALL(m->Mock(), DestroyWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Destroy());
|
||||
@ -336,7 +336,7 @@ HWTEST_F(WindowImplTest, SetWindowMode02, Function | SmallTest | Level3)
|
||||
option->SetWindowMode(WindowMode::WINDOW_MODE_FULLSCREEN);
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
ASSERT_EQ(WindowMode::WINDOW_MODE_FULLSCREEN, window->GetMode());
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetWindowMode(WindowMode::WINDOW_MODE_SPLIT_PRIMARY));
|
||||
ASSERT_EQ(WindowMode::WINDOW_MODE_SPLIT_PRIMARY, window->GetMode());
|
||||
@ -358,7 +358,7 @@ HWTEST_F(WindowImplTest, SetWindowMode03, Function | SmallTest | Level3)
|
||||
option->SetWindowMode(WindowMode::WINDOW_MODE_FULLSCREEN);
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
ASSERT_EQ(WindowMode::WINDOW_MODE_FULLSCREEN, window->GetMode());
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetWindowMode(WindowMode::WINDOW_MODE_SPLIT_SECONDARY));
|
||||
ASSERT_EQ(WindowMode::WINDOW_MODE_SPLIT_SECONDARY, window->GetMode());
|
||||
@ -380,7 +380,7 @@ HWTEST_F(WindowImplTest, SetWindowMode04, Function | SmallTest | Level3)
|
||||
option->SetWindowMode(WindowMode::WINDOW_MODE_FULLSCREEN);
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
ASSERT_EQ(WindowMode::WINDOW_MODE_FULLSCREEN, window->GetMode());
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING));
|
||||
ASSERT_EQ(WindowMode::WINDOW_MODE_FLOATING, window->GetMode());
|
||||
@ -402,7 +402,7 @@ HWTEST_F(WindowImplTest, SetWindowMode05, Function | SmallTest | Level3)
|
||||
option->SetWindowMode(WindowMode::WINDOW_MODE_FULLSCREEN);
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
ASSERT_EQ(WindowMode::WINDOW_MODE_FULLSCREEN, window->GetMode());
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetWindowMode(WindowMode::WINDOW_MODE_PIP));
|
||||
ASSERT_EQ(WindowMode::WINDOW_MODE_PIP, window->GetMode());
|
||||
@ -422,7 +422,7 @@ HWTEST_F(WindowImplTest, ShowHideWindow01, Function | SmallTest | Level2)
|
||||
option->SetWindowName("ShowHideWindow01");
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
EXPECT_CALL(m->Mock(), RemoveWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
@ -443,7 +443,7 @@ HWTEST_F(WindowImplTest, ShowHideWindow02, Function | SmallTest | Level2)
|
||||
option->SetWindowName("ShowHideWindow02");
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_ERROR_SAMGR));
|
||||
ASSERT_EQ(WMError::WM_ERROR_SAMGR, window->Show());
|
||||
EXPECT_CALL(m->Mock(), DestroyWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
@ -462,7 +462,7 @@ HWTEST_F(WindowImplTest, ShowHideWindow03, Function | SmallTest | Level3)
|
||||
option->SetWindowName("ShowHideWindow03");
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_ERROR_IPC_FAILED));
|
||||
ASSERT_EQ(WMError::WM_ERROR_IPC_FAILED, window->Show());
|
||||
EXPECT_CALL(m->Mock(), DestroyWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
@ -481,7 +481,7 @@ HWTEST_F(WindowImplTest, ShowHideWindow04, Function | SmallTest | Level3)
|
||||
option->SetWindowName("ShowHideWindow04");
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
EXPECT_CALL(m->Mock(), RemoveWindow(_)).Times(1).WillOnce(Return(WMError::WM_ERROR_SAMGR));
|
||||
@ -502,7 +502,7 @@ HWTEST_F(WindowImplTest, ShowHideWindow05, Function | SmallTest | Level3)
|
||||
option->SetWindowName("ShowHideWindow05");
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
EXPECT_CALL(m->Mock(), RemoveWindow(_)).Times(1).WillOnce(Return(WMError::WM_ERROR_IPC_FAILED));
|
||||
@ -523,7 +523,7 @@ HWTEST_F(WindowImplTest, ShowHideWindow06, Function | SmallTest | Level3)
|
||||
option->SetWindowName("ShowHideWindow06");
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
EXPECT_CALL(m->Mock(), RemoveWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
@ -544,7 +544,7 @@ HWTEST_F(WindowImplTest, SetSystemBarProperty01, Function | SmallTest | Level3)
|
||||
option->SetWindowName("SetSystemBarProperty01");
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
|
||||
WindowType type = WindowType::WINDOW_TYPE_STATUS_BAR;
|
||||
SystemBarProperty prop;
|
||||
@ -565,7 +565,7 @@ HWTEST_F(WindowImplTest, SetSystemBarProperty02, Function | SmallTest | Level3)
|
||||
option->SetWindowName("SetSystemBarProperty02");
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
window->Show();
|
||||
@ -606,7 +606,7 @@ HWTEST_F(WindowImplTest, GetSystemBarPropertyByType01, Function | SmallTest | Le
|
||||
option->SetWindowName("GetSystemBarPropertyByType01");
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
@ -633,7 +633,7 @@ HWTEST_F(WindowImplTest, GetSystemBarPropertyByType02, Function | SmallTest | Le
|
||||
option->SetWindowName("GetSystemBarPropertyByType02");
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
window->Show();
|
||||
@ -660,7 +660,7 @@ HWTEST_F(WindowImplTest, GetSystemBarPropertyByType03, Function | SmallTest | Le
|
||||
option->SetWindowName("GetSystemBarPropertyByType03");
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
window->Show();
|
||||
@ -687,7 +687,7 @@ HWTEST_F(WindowImplTest, Maximize02, Function | SmallTest | Level3)
|
||||
option->SetWindowName("Maximize02");
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
window->SetWindowType(WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
|
||||
window->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
@ -713,7 +713,7 @@ HWTEST_F(WindowImplTest, Recover01, Function | SmallTest | Level3)
|
||||
option->SetWindowName("Recover01");
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
window->Create("");
|
||||
window->Create(INVALID_WINDOW_ID);
|
||||
window->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
|
||||
window->SetWindowMode(WindowMode::WINDOW_MODE_FULLSCREEN);
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
@ -739,7 +739,7 @@ HWTEST_F(WindowImplTest, Recover02, Function | SmallTest | Level3)
|
||||
option->SetWindowName("Recover02");
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
window->Create("");
|
||||
window->Create(INVALID_WINDOW_ID);
|
||||
window->SetWindowType(WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
|
||||
window->SetWindowMode(WindowMode::WINDOW_MODE_FULLSCREEN);
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
@ -764,7 +764,7 @@ HWTEST_F(WindowImplTest, Minimize01, Function | SmallTest | Level3)
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
window->Create("");
|
||||
window->Create(INVALID_WINDOW_ID);
|
||||
window->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
|
||||
window->SetWindowMode(WindowMode::WINDOW_MODE_FULLSCREEN);
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
@ -789,7 +789,7 @@ HWTEST_F(WindowImplTest, Minimize02, Function | SmallTest | Level3)
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
window->Create("");
|
||||
window->Create(INVALID_WINDOW_ID);
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
window->SetWindowType(WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
|
||||
window->SetWindowMode(WindowMode::WINDOW_MODE_FULLSCREEN);
|
||||
@ -813,7 +813,7 @@ HWTEST_F(WindowImplTest, IsSupportWideGamut01, Function | SmallTest | Level3)
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
window->Create("");
|
||||
window->Create(INVALID_WINDOW_ID);
|
||||
window->SetWindowType(WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
|
||||
window->SetWindowMode(WindowMode::WINDOW_MODE_FULLSCREEN);
|
||||
ASSERT_TRUE(window->IsSupportWideGamut());
|
||||
@ -833,7 +833,7 @@ HWTEST_F(WindowImplTest, SetColorSpace01, Function | SmallTest | Level3)
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
window->Create("");
|
||||
window->Create(INVALID_WINDOW_ID);
|
||||
window->SetWindowType(WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
|
||||
window->SetWindowMode(WindowMode::WINDOW_MODE_FULLSCREEN);
|
||||
window->SetColorSpace(ColorSpace::COLOR_SPACE_WIDE_GAMUT);
|
||||
@ -853,7 +853,7 @@ HWTEST_F(WindowImplTest, GetColorSpace01, Function | SmallTest | Level3)
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
window->Create("");
|
||||
window->Create(INVALID_WINDOW_ID);
|
||||
window->SetWindowType(WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
|
||||
window->SetWindowMode(WindowMode::WINDOW_MODE_FULLSCREEN);
|
||||
window->SetColorSpace(ColorSpace::COLOR_SPACE_DEFAULT);
|
||||
@ -879,7 +879,7 @@ HWTEST_F(WindowImplTest, StartMove01, Function | SmallTest | Level3)
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
window->Show();
|
||||
window->StartMove();
|
||||
@ -904,7 +904,7 @@ HWTEST_F(WindowImplTest, StartMove02, Function | SmallTest | Level3)
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
window->Show();
|
||||
|
||||
@ -930,7 +930,7 @@ HWTEST_F(WindowImplTest, StartMove03, Function | SmallTest | Level3)
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
window->Show();
|
||||
window->StartMove();
|
||||
@ -954,7 +954,7 @@ HWTEST_F(WindowImplTest, SetBackgroundColor01, Function | SmallTest | Level3)
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
window->Show();
|
||||
ASSERT_FALSE(window->IsTransparent());
|
||||
@ -981,7 +981,7 @@ HWTEST_F(WindowImplTest, SetTurnScreenOn01, Function | SmallTest | Level3)
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
ASSERT_FALSE(window->IsTurnScreenOn());
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetTurnScreenOn(true));
|
||||
ASSERT_TRUE(window->IsTurnScreenOn());
|
||||
@ -1007,7 +1007,7 @@ HWTEST_F(WindowImplTest, SetTurnScreenOn02, Function | SmallTest | Level3)
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
ASSERT_FALSE(window->IsTurnScreenOn());
|
||||
@ -1036,7 +1036,7 @@ HWTEST_F(WindowImplTest, SetKeepScreenOn01, Function | SmallTest | Level3)
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
ASSERT_FALSE(window->IsKeepScreenOn());
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetKeepScreenOn(true));
|
||||
ASSERT_TRUE(window->IsKeepScreenOn());
|
||||
@ -1061,7 +1061,7 @@ HWTEST_F(WindowImplTest, SetKeepScreenOn02, Function | SmallTest | Level3)
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
ASSERT_FALSE(window->IsKeepScreenOn());
|
||||
@ -1091,7 +1091,7 @@ HWTEST_F(WindowImplTest, SetBrightness01, Function | SmallTest | Level3)
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
ASSERT_EQ(UNDEFINED_BRIGHTNESS, window->GetBrightness());
|
||||
@ -1117,7 +1117,7 @@ HWTEST_F(WindowImplTest, SetBrightness02, Function | SmallTest | Level3)
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
ASSERT_EQ(UNDEFINED_BRIGHTNESS, window->GetBrightness());
|
||||
@ -1147,7 +1147,7 @@ HWTEST_F(WindowImplTest, SetBrightness03, Function | SmallTest | Level3)
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
ASSERT_EQ(UNDEFINED_BRIGHTNESS, window->GetBrightness());
|
||||
@ -1173,7 +1173,7 @@ HWTEST_F(WindowImplTest, SetFocusable01, Function | SmallTest | Level3)
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
ASSERT_TRUE(window->GetFocusable());
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetFocusable(false));
|
||||
ASSERT_FALSE(window->GetFocusable());
|
||||
@ -1199,7 +1199,7 @@ HWTEST_F(WindowImplTest, SetFocusable02, Function | SmallTest | Level3)
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
ASSERT_TRUE(window->GetFocusable());
|
||||
@ -1229,7 +1229,7 @@ HWTEST_F(WindowImplTest, SetTouchable01, Function | SmallTest | Level3)
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
ASSERT_TRUE(window->GetTouchable());
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetTouchable(false));
|
||||
ASSERT_FALSE(window->GetTouchable());
|
||||
@ -1255,7 +1255,7 @@ HWTEST_F(WindowImplTest, SetTouchable02, Function | SmallTest | Level3)
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
ASSERT_TRUE(window->GetTouchable());
|
||||
@ -1282,7 +1282,7 @@ HWTEST_F(WindowImplTest, DisableAppWindowDecor01, Function | SmallTest | Level3)
|
||||
option->SetWindowName("DisableAppWindowDecor01");
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
window->DisableAppWindowDecor();
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
@ -1306,7 +1306,7 @@ HWTEST_F(WindowImplTest, SetTouchHotAreas01, Function | SmallTest | Level3)
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
|
||||
@ -1348,7 +1348,7 @@ HWTEST_F(WindowImplTest, SetTransform01, Function | SmallTest | Level3)
|
||||
option->SetWindowName("SetTransform01");
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
window->DisableAppWindowDecor();
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
@ -1373,7 +1373,7 @@ HWTEST_F(WindowImplTest, SetTransform02, Function | SmallTest | Level3)
|
||||
option->SetWindowName("SetTransform01");
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
window->DisableAppWindowDecor();
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
@ -1400,7 +1400,7 @@ HWTEST_F(WindowImplTest, SetTransform03, Function | SmallTest | Level3)
|
||||
option->SetWindowName("SetTransform01");
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
window->DisableAppWindowDecor();
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
@ -1427,7 +1427,7 @@ HWTEST_F(WindowImplTest, SetTransform04, Function | SmallTest | Level3)
|
||||
option->SetWindowName("SetTransform01");
|
||||
sptr<WindowImpl> window = new WindowImpl(option);
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(""));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
window->DisableAppWindowDecor();
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
|
@ -46,7 +46,7 @@ void WindowInputChannelTest::SetUp()
|
||||
sptr<WindowOption> option = new WindowOption();
|
||||
option->SetWindowName("window");
|
||||
window_ = new WindowImpl(option);
|
||||
window_->Create("");
|
||||
window_->Create(INVALID_WINDOW_ID);
|
||||
}
|
||||
|
||||
void WindowInputChannelTest::TearDown()
|
||||
|
@ -196,15 +196,15 @@ HWTEST_F(WindowOptionTest, DisplayId01, Function | SmallTest | Level2)
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: ParentName01
|
||||
* @tc.desc: SetParentName/GetParentName
|
||||
* @tc.name: ParentId01
|
||||
* @tc.desc: SetParentId/GetParentId
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(WindowOptionTest, ParentName01, Function | SmallTest | Level2)
|
||||
HWTEST_F(WindowOptionTest, ParentId01, Function | SmallTest | Level2)
|
||||
{
|
||||
sptr<WindowOption> option = new WindowOption();
|
||||
option->SetParentName("Main Window");
|
||||
ASSERT_EQ("Main Window", option->GetParentName());
|
||||
option->SetParentId(1);
|
||||
ASSERT_EQ(1, option->GetParentId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user