窗口操作调整,增加报错信息.Signed-off-by: <zhouke35@huawei.com>.

Signed-off-by: zhouke <zhouke35@huawei.com>
This commit is contained in:
zhouke
2022-08-19 13:59:43 +08:00
parent 5523560735
commit 454c8dce0c
+33 -15
View File
@@ -818,16 +818,6 @@ namespace OHOS::uitest {
auto highth = ReadCallArg<uint32_t>(in, INDEX_ONE);
auto direction = ReadCallArg<ResizeDirection>(in, INDEX_TWO);
out.resultValue_ = wOp.Resize(width, highth, direction, out);
} else if (action == "UiWindow.split") {
out.resultValue_ = wOp.Split(out);
} else if (action == "UiWindow.maximize") {
out.resultValue_ = wOp.Maximize(out);
} else if (action == "UiWindow.resume") {
out.resultValue_ = wOp.Resume(out);
} else if (action == "UiWindow.minimize") {
out.resultValue_ = wOp.Minimize(out);
} else if (action == "UiWindow.close") {
out.resultValue_ = wOp.Close(out);
} else if (action == "UiWindow.focus") {
out.resultValue_ = wOp.Focuse(out);
}
@@ -835,11 +825,38 @@ namespace OHOS::uitest {
server.AddHandler("UiWindow.focus", genericWinOperationHandler);
server.AddHandler("UiWindow.moveTo", genericWinOperationHandler);
server.AddHandler("UiWindow.resize", genericWinOperationHandler);
server.AddHandler("UiWindow.split", genericWinOperationHandler);
server.AddHandler("UiWindow.maximize", genericWinOperationHandler);
server.AddHandler("UiWindow.resume", genericWinOperationHandler);
server.AddHandler("UiWindow.minimize", genericWinOperationHandler);
server.AddHandler("UiWindow.close", genericWinOperationHandler);
}
static void RegisterUiWinBarOperators()
{
auto &server = FrontendApiServer::Get();
auto genericWinBarOperationHandler = [](const ApiCallInfo &in, ApiReplyInfo &out) {
auto &window = GetBackendObject<Window>(in.callerObjRef_);
auto &driver = GetBoundUiDriver(in.callerObjRef_);
UiOpArgs uiOpArgs;
auto wOp = WindowOperator(driver, window, uiOpArgs);
auto action = in.apiId_;
if (window.decoratorEnabled_) {
if (action == "UiWindow.split") {
out.resultValue_ = wOp.Split(out);
} else if (action == "UiWindow.maximize") {
out.resultValue_ = wOp.Maximize(out);
} else if (action == "UiWindow.resume") {
out.resultValue_ = wOp.Resume(out);
} else if (action == "UiWindow.minimize") {
out.resultValue_ = wOp.Minimize(out);
} else if (action == "UiWindow.close") {
out.resultValue_ = wOp.Close(out);
}
} else {
out.exception_ = ApiCallErr(USAGE_ERROR, "this device can not support this action");
}
};
server.AddHandler("UiWindow.split", genericWinBarOperationHandler);
server.AddHandler("UiWindow.maximize", genericWinBarOperationHandler);
server.AddHandler("UiWindow.resume", genericWinBarOperationHandler);
server.AddHandler("UiWindow.minimize", genericWinBarOperationHandler);
server.AddHandler("UiWindow.close", genericWinBarOperationHandler);
}
static void RegisterPointerMatrixOperators()
@@ -900,6 +917,7 @@ namespace OHOS::uitest {
RegisterUiComponentOperators();
RegisterUiWindowAttrGetters();
RegisterUiWindowOperators();
RegisterUiWinBarOperators();
RegisterPointerMatrixOperators();
RegisterUiDriverMultiPointerOperators();
RegisterUiDriverDisplayOperators();