!10878 window-错误码描述优化

Merge pull request !10878 from 周凯/master
This commit is contained in:
openharmony_ci 2024-11-20 08:43:09 +00:00 committed by Gitee
commit 4cbe433ffe
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
6 changed files with 87 additions and 86 deletions

View File

@ -203,7 +203,7 @@ enum class WMError : int32_t {
WM_ERROR_NO_REMOTE_ANIMATION,
WM_ERROR_INVALID_DISPLAY,
WM_ERROR_INVALID_PARENT,
WM_ERROR_OPER_FULLSCREEN_FAILED,
WM_ERROR_INVALID_OP_IN_CUR_STATUS,
WM_ERROR_REPEAT_OPERATION,
WM_ERROR_INVALID_SESSION,
WM_ERROR_INVALID_CALLING,
@ -244,7 +244,7 @@ enum class WmErrorCode : int32_t {
WM_ERROR_START_ABILITY_FAILED = 1300007,
WM_ERROR_INVALID_DISPLAY = 1300008,
WM_ERROR_INVALID_PARENT = 1300009,
WM_ERROR_OPER_FULLSCREEN_FAILED = 1300010,
WM_ERROR_INVALID_OP_IN_CUR_STATUS = 1300010,
WM_ERROR_PIP_DESTROY_FAILED = 1300011,
WM_ERROR_PIP_STATE_ABNORMALLY = 1300012,
WM_ERROR_PIP_CREATE_FAILED = 1300013,

View File

@ -30,7 +30,7 @@ constexpr const char* WM_ERROR_MSG_NOT_SYSTEM_APP = "not system app";
constexpr const char* WM_ERROR_MSG_NO_REMOTE_ANIMATION = "no remote animation";
constexpr const char* WM_ERROR_MSG_INVALID_DISPLAY = "invalid display";
constexpr const char* WM_ERROR_MSG_INVALID_PARENT = "invalid parent";
constexpr const char* WM_ERROR_MSG_OPER_FULLSCREEN_FAILED = "oper fullscreen failed";
constexpr const char* WM_ERROR_MSG_INVALID_OP_IN_CUR_STATUS = "invalid operation in the current window status";
constexpr const char* WM_ERROR_MSG_REPEAT_OPERATION = "repeat operation";
constexpr const char* WM_ERROR_MSG_INVALID_SESSION = "invalid session";
constexpr const char* WM_ERROR_MSG_INVALID_CALLING = "invalid calling";
@ -62,7 +62,7 @@ static std::map<WMError, const char*> WM_ERROR_TO_ERROR_MSG_MAP {
{WMError::WM_ERROR_NO_REMOTE_ANIMATION, WM_ERROR_MSG_NO_REMOTE_ANIMATION },
{WMError::WM_ERROR_INVALID_DISPLAY, WM_ERROR_MSG_INVALID_DISPLAY },
{WMError::WM_ERROR_INVALID_PARENT, WM_ERROR_MSG_INVALID_PARENT },
{WMError::WM_ERROR_OPER_FULLSCREEN_FAILED, WM_ERROR_MSG_OPER_FULLSCREEN_FAILED },
{WMError::WM_ERROR_INVALID_OP_IN_CUR_STATUS, WM_ERROR_MSG_INVALID_OP_IN_CUR_STATUS },
{WMError::WM_ERROR_REPEAT_OPERATION, WM_ERROR_MSG_REPEAT_OPERATION },
{WMError::WM_ERROR_INVALID_SESSION, WM_ERROR_MSG_INVALID_SESSION },
{WMError::WM_ERROR_INVALID_CALLING, WM_ERROR_MSG_INVALID_CALLING },
@ -102,7 +102,8 @@ constexpr const char* WM_ERROR_CODE_MSG_CONTEXT_ABNORMALLY = "This window contex
constexpr const char* WM_ERROR_CODE_MSG_START_ABILITY_FAILED = "Failed to start the ability.";
constexpr const char* WM_ERROR_CODE_MSG_INVALID_DISPLAY = "The display device is abnormal.";
constexpr const char* WM_ERROR_CODE_MSG_INVALID_PARENT = "The parent window is invalid.";
constexpr const char* WM_ERROR_CODE_MSG_OPER_FULLSCREEN_FAILED = "The operation is not supported in full-screen mode.";
constexpr const char* WM_ERROR_CODE_MSG_INVALID_OP_IN_CUR_STATUS =
"The operation in the current window status is invalid.";
constexpr const char* WM_ERROR_CODE_MSG_PIP_DESTROY_FAILED = "Failed to destroy the PiP window.";
constexpr const char* WM_ERROR_CODE_MSG_PIP_STATE_ABNORMALLY = "The PiP window state is abnormal.";
constexpr const char* WM_ERROR_CODE_MSG_PIP_CREATE_FAILED = "Failed to create the PiP window.";
@ -124,7 +125,7 @@ static std::map<WmErrorCode, const char*> WM_ERROR_CODE_TO_ERROR_MSG_MAP {
{WmErrorCode::WM_ERROR_START_ABILITY_FAILED, WM_ERROR_CODE_MSG_START_ABILITY_FAILED },
{WmErrorCode::WM_ERROR_INVALID_DISPLAY, WM_ERROR_CODE_MSG_INVALID_DISPLAY },
{WmErrorCode::WM_ERROR_INVALID_PARENT, WM_ERROR_CODE_MSG_INVALID_PARENT },
{WmErrorCode::WM_ERROR_OPER_FULLSCREEN_FAILED, WM_ERROR_CODE_MSG_OPER_FULLSCREEN_FAILED },
{WmErrorCode::WM_ERROR_INVALID_OP_IN_CUR_STATUS, WM_ERROR_CODE_MSG_INVALID_OP_IN_CUR_STATUS },
{WmErrorCode::WM_ERROR_PIP_DESTROY_FAILED, WM_ERROR_CODE_MSG_PIP_DESTROY_FAILED },
{WmErrorCode::WM_ERROR_PIP_STATE_ABNORMALLY, WM_ERROR_CODE_MSG_PIP_STATE_ABNORMALLY },
{WmErrorCode::WM_ERROR_PIP_CREATE_FAILED, WM_ERROR_CODE_MSG_PIP_CREATE_FAILED },

View File

@ -172,7 +172,7 @@ enum class WMError : int32_t {
WM_ERROR_NO_REMOTE_ANIMATION,
WM_ERROR_INVALID_DISPLAY,
WM_ERROR_INVALID_PARENT,
WM_ERROR_OPER_FULLSCREEN_FAILED,
WM_ERROR_INVALID_OP_IN_CUR_STATUS,
WM_ERROR_REPEAT_OPERATION,
WM_ERROR_INVALID_SESSION,
WM_ERROR_INVALID_CALLING,
@ -214,7 +214,7 @@ enum class WmErrorCode : int32_t {
WM_ERROR_START_ABILITY_FAILED = 1300007,
WM_ERROR_INVALID_DISPLAY = 1300008,
WM_ERROR_INVALID_PARENT = 1300009,
WM_ERROR_OPER_FULLSCREEN_FAILED = 1300010,
WM_ERROR_INVALID_OP_IN_CUR_STATUS = 1300010,
WM_ERROR_PIP_DESTROY_FAILED = 1300011,
WM_ERROR_PIP_STATE_ABNORMALLY = 1300012,
WM_ERROR_PIP_CREATE_FAILED = 1300013,
@ -284,7 +284,7 @@ const std::map<WMError, WmErrorCode> WM_JS_TO_ERROR_CODE_MAP {
{WMError::WM_ERROR_NO_REMOTE_ANIMATION, WmErrorCode::WM_ERROR_SYSTEM_ABNORMALLY },
{WMError::WM_ERROR_INVALID_DISPLAY, WmErrorCode::WM_ERROR_INVALID_DISPLAY },
{WMError::WM_ERROR_INVALID_PARENT, WmErrorCode::WM_ERROR_INVALID_PARENT },
{WMError::WM_ERROR_OPER_FULLSCREEN_FAILED, WmErrorCode::WM_ERROR_OPER_FULLSCREEN_FAILED },
{WMError::WM_ERROR_INVALID_OP_IN_CUR_STATUS, WmErrorCode::WM_ERROR_INVALID_OP_IN_CUR_STATUS },
{WMError::WM_ERROR_REPEAT_OPERATION, WmErrorCode::WM_ERROR_REPEAT_OPERATION },
{WMError::WM_ERROR_NULLPTR, WmErrorCode::WM_ERROR_STATE_ABNORMALLY },
{WMError::WM_ERROR_SAMGR, WmErrorCode::WM_ERROR_SYSTEM_ABNORMALLY },

View File

@ -33,7 +33,7 @@ const std::map<WMError, WmErrorCode> WM_JS_TO_ERROR_CODE_MAP {
{WMError::WM_ERROR_NO_REMOTE_ANIMATION, WmErrorCode::WM_ERROR_SYSTEM_ABNORMALLY },
{WMError::WM_ERROR_INVALID_DISPLAY, WmErrorCode::WM_ERROR_INVALID_DISPLAY },
{WMError::WM_ERROR_INVALID_PARENT, WmErrorCode::WM_ERROR_INVALID_PARENT },
{WMError::WM_ERROR_OPER_FULLSCREEN_FAILED, WmErrorCode::WM_ERROR_OPER_FULLSCREEN_FAILED },
{WMError::WM_ERROR_INVALID_OP_IN_CUR_STATUS, WmErrorCode::WM_ERROR_INVALID_OP_IN_CUR_STATUS },
{WMError::WM_ERROR_REPEAT_OPERATION, WmErrorCode::WM_ERROR_REPEAT_OPERATION },
{WMError::WM_ERROR_NULLPTR, WmErrorCode::WM_ERROR_STATE_ABNORMALLY },
{WMError::WM_ERROR_SAMGR, WmErrorCode::WM_ERROR_SYSTEM_ABNORMALLY },

View File

@ -1501,9 +1501,9 @@ WMError WindowSceneSessionImpl::MoveWindowToGlobal(int32_t x, int32_t y)
}
if (GetMode() != WindowMode::WINDOW_MODE_FLOATING) {
TLOGW(WmsLogTag::WMS_LAYOUT, "FullScreen window should not move, winId:%{public}u, mode:%{public}u",
TLOGW(WmsLogTag::WMS_LAYOUT, "window should not move, winId:%{public}u, mode:%{public}u",
GetWindowId(), GetMode());
return WMError::WM_ERROR_OPER_FULLSCREEN_FAILED;
return WMError::WM_ERROR_INVALID_OP_IN_CUR_STATUS;
}
if (property_->GetWindowType() == WindowType::WINDOW_TYPE_PIP) {
@ -1551,9 +1551,9 @@ WMError WindowSceneSessionImpl::MoveToAsync(int32_t x, int32_t y)
}
if (GetMode() != WindowMode::WINDOW_MODE_FLOATING) {
TLOGW(WmsLogTag::WMS_LAYOUT, "FullScreen window should not move, winId:%{public}u, mode:%{public}u",
TLOGW(WmsLogTag::WMS_LAYOUT, "window should not move, winId:%{public}u, mode:%{public}u",
GetWindowId(), GetMode());
return WMError::WM_ERROR_OPER_FULLSCREEN_FAILED;
return WMError::WM_ERROR_INVALID_OP_IN_CUR_STATUS;
}
auto ret = MoveTo(x, y);
if (state_ == WindowState::STATE_SHOWN) {
@ -1749,9 +1749,9 @@ WMError WindowSceneSessionImpl::ResizeAsync(uint32_t width, uint32_t height)
}
if (GetMode() != WindowMode::WINDOW_MODE_FLOATING) {
TLOGW(WmsLogTag::WMS_LAYOUT, "Fullscreen window should not resize, winId:%{public}u, mode:%{public}u",
TLOGW(WmsLogTag::WMS_LAYOUT, "window should not resize, winId:%{public}u, mode:%{public}u",
GetWindowId(), GetMode());
return WMError::WM_ERROR_OPER_FULLSCREEN_FAILED;
return WMError::WM_ERROR_INVALID_OP_IN_CUR_STATUS;
}
auto ret = Resize(width, height);
if (state_ == WindowState::STATE_SHOWN) {

View File

@ -829,7 +829,7 @@ HWTEST_F(WindowSceneSessionImplTest4, MoveToAsync01, Function | SmallTest | Leve
sptr<SessionMocker> session = sptr<SessionMocker>::MakeSptr(sessionInfo);
window->hostSession_ = session;
window->property_->SetPersistentId(1);
ASSERT_EQ(WMError::WM_ERROR_OPER_FULLSCREEN_FAILED, window->MoveToAsync(10, 10));
ASSERT_EQ(WMError::WM_ERROR_INVALID_OP_IN_CUR_STATUS, window->MoveToAsync(10, 10));
}
/**
@ -889,7 +889,7 @@ HWTEST_F(WindowSceneSessionImplTest4, ResizeAsync01, Function | SmallTest | Leve
sptr<SessionMocker> session = sptr<SessionMocker>::MakeSptr(sessionInfo);
window->hostSession_ = session;
window->property_->SetPersistentId(1);
ASSERT_EQ(WMError::WM_ERROR_OPER_FULLSCREEN_FAILED, window->ResizeAsync(500, 500));
ASSERT_EQ(WMError::WM_ERROR_INVALID_OP_IN_CUR_STATUS, window->ResizeAsync(500, 500));
}
/**