mirror of
https://github.com/openharmony/arkXtest.git
synced 2026-07-20 04:24:07 -04:00
修复心跳机制导致connection dead的BUG,窗口操作调整.Signed-off-by: <zhouke35@huawei.com>.
Signed-off-by: zhouke <zhouke35@huawei.com>
This commit is contained in:
@@ -154,7 +154,7 @@ namespace OHOS::uitest {
|
||||
const auto millis = GetCurrentMillisecond();
|
||||
const auto outgoingIdleTime = millis - transceiver->lastOutgoingMessageMillis_.load();
|
||||
const auto incomingIdleTime = millis - transceiver->lastIncomingMessageMillis_.load();
|
||||
if (emitHandshake && outgoingIdleTime > secureDurationMs) {
|
||||
if (emitHandshake && (outgoingIdleTime > secureDurationMs || incomingIdleTime > secureDurationMs)) {
|
||||
// emit handshake in secure_duration
|
||||
transceiver->EmitHandshake();
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ namespace OHOS::uitest {
|
||||
{"UiWindow.getWindowMode", "():int", false, false}, // WindowMode enum as int value
|
||||
{"UiWindow.isFocused", "():bool", false, false},
|
||||
{"UiWindow.isActived", "():bool", false, false},
|
||||
{"UiWindow.focuse", "():bool", false, false},
|
||||
{"UiWindow.focus", "():bool", false, false},
|
||||
{"UiWindow.moveTo", "(int,int):bool", false, false},
|
||||
{"UiWindow.resize", "(int,int,int):bool", false, false}, // ResizeDirection enum as int value
|
||||
{"UiWindow.split", "():bool", false, false},
|
||||
|
||||
@@ -660,7 +660,7 @@ namespace OHOS::uitest {
|
||||
} else if (in.apiId_ == "UiWindow.getTitle") {
|
||||
out.resultValue_ = snapshot->title_;
|
||||
} else if (in.apiId_ == "UiWindow.getWindowMode") {
|
||||
out.resultValue_ = (uint8_t)(snapshot->mode_);
|
||||
out.resultValue_ = (uint8_t)(snapshot->mode_ - 1);
|
||||
} else if (in.apiId_ == "UiWindow.isFocused") {
|
||||
out.resultValue_ = snapshot->focused_;
|
||||
} else if (in.apiId_ == "UiWindow.isActived") {
|
||||
@@ -703,11 +703,11 @@ namespace OHOS::uitest {
|
||||
out.resultValue_ = wOp.Minimize(out);
|
||||
} else if (action == "UiWindow.close") {
|
||||
out.resultValue_ = wOp.Close(out);
|
||||
} else if (action == "UiWindow.focuse") {
|
||||
} else if (action == "UiWindow.focus") {
|
||||
out.resultValue_ = wOp.Focuse(out);
|
||||
}
|
||||
};
|
||||
server.AddHandler("UiWindow.focuse", genericWinOperationHandler);
|
||||
server.AddHandler("UiWindow.focus", genericWinOperationHandler);
|
||||
server.AddHandler("UiWindow.moveTo", genericWinOperationHandler);
|
||||
server.AddHandler("UiWindow.resize", genericWinOperationHandler);
|
||||
server.AddHandler("UiWindow.split", genericWinOperationHandler);
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace OHOS::uitest {
|
||||
using namespace nlohmann;
|
||||
|
||||
enum WindowAction : uint8_t {
|
||||
FOCUSE,
|
||||
FOCUS,
|
||||
MOVETO,
|
||||
RESIZE,
|
||||
SPLIT,
|
||||
@@ -109,8 +109,9 @@ namespace OHOS::uitest {
|
||||
return true;
|
||||
} else {
|
||||
auto rect = window_.bounds_;
|
||||
Point windowCenter(rect.GetCenterX(), rect.GetCenterY());
|
||||
auto touch = GenericClick(TouchOp::CLICK, windowCenter);
|
||||
static constexpr uint32_t step = 10;
|
||||
Point focus(rect.GetCenterX(), rect.top_ + step);
|
||||
auto touch = GenericClick(TouchOp::CLICK, focus);
|
||||
driver_.PerformTouch(touch, options_, out.exception_);
|
||||
return (out.exception_.code_ == ErrCode::NO_ERROR);
|
||||
}
|
||||
@@ -123,9 +124,9 @@ namespace OHOS::uitest {
|
||||
return false;
|
||||
}
|
||||
auto rect = window_.bounds_;
|
||||
static constexpr uint32_t step = 30;
|
||||
static constexpr uint32_t step = 40;
|
||||
Point from(rect.left_ + step, rect.top_ + step);
|
||||
Point to(endX, endY);
|
||||
Point to(endX + step, endY + step);
|
||||
auto touch = GenericSwipe(TouchOp::DRAG, from, to);
|
||||
driver_.PerformTouch(touch, options_, out.exception_);
|
||||
return (out.exception_.code_ == ErrCode::NO_ERROR);
|
||||
|
||||
@@ -464,6 +464,7 @@ namespace OHOS::uitest {
|
||||
NAPI_CALL(env, ExportClass(env, exports, UI_WINDOW_DEF));
|
||||
NAPI_CALL(env, ExportEnumrator(env, exports, MATCH_PATTERN_DEF));
|
||||
NAPI_CALL(env, ExportEnumrator(env, exports, RESIZE_DIRECTION_DEF));
|
||||
NAPI_CALL(env, ExportEnumrator(env, exports, WINDOW_MODE_DEF));
|
||||
LOG_I("End export uitest apis");
|
||||
return exports;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user