From e26b2b34574e5de260710c277568c1a519de20a5 Mon Sep 17 00:00:00 2001 From: wmlih Date: Fri, 17 Feb 2023 09:47:45 +0800 Subject: [PATCH] test:modify common.ets and signature file Signed-off-by: wmlih --- .../main/ets/MainAbility/common/Common.ets | 110 ++++-------------- .../signature/openharmony_sx.p7b | Bin 3466 -> 3439 bytes 2 files changed, 21 insertions(+), 89 deletions(-) diff --git a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/common/Common.ets b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/common/Common.ets index 3ce9a6789..ac733f8d2 100644 --- a/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/common/Common.ets +++ b/arkui/ace_ets_layout_test/entry/src/main/ets/MainAbility/common/Common.ets @@ -19,99 +19,31 @@ export default class CommonFunc { static rect_right; static rect_bottom; static rect_value; - - static sleep(time) { - return new Promise((resolve, reject) => { - setTimeout(() => { - resolve() - }, time) - }).then(() => { - console.info(`sleep ${time} over...`) - }) + + static sleep(time){ + return new Promise((resolve,reject)=>{ + setTimeout(()=>{ + resolve("ok") + },time) + }).then(()=>{ + console.info(`sleep ${time} over...`) + }) } - - static getComponentRect(key) { + + static getComponentRect(key) { let strJson = getInspectorByKey(key); let obj = JSON.parse(strJson); console.info("[getInspectorByKey] current component obj is: " + JSON.stringify(obj)); - let rectInfo = JSON.parse('[' + obj.$rect + ']') - console.info("[getInspectorByKey] rectInfo is: " + rectInfo); - this.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0] - this.rect_top = JSON.parse('[' + rectInfo[0] + ']')[1] - this.rect_right = JSON.parse('[' + rectInfo[1] + ']')[0] - this.rect_bottom = JSON.parse('[' + rectInfo[1] + ']')[1] - return this.rect_value = { - "left": this.rect_left, "top": this.rect_top, "right": this.rect_right, "bottom": this.rect_bottom - } - } - - static async swipe(downX, downY, upX, upY, steps) { - console.info('start to swipe') - this.drags(downX, downY, upX, upY, steps, false) - } - - static async drag(downX, downY, upX, upY, steps) { - console.info('start to drag') - this.drags(downX, downY, upX, upY, steps, true) - } - - static async drags(downX, downY, upX, upY, steps, drag) { - var xStep; - var yStep; - var swipeSteps; - var ret; - xStep = 0; - yStep = 0; - ret = false; - swipeSteps = steps; - if (swipeSteps == 0) { - swipeSteps = 1; - } - xStep = (upX - downX) / swipeSteps; - yStep = (upY - downY) / swipeSteps; - console.info('move step is: ' + 'xStep: ' + xStep + ' yStep: ' + yStep) - var downPonit: TouchObject = { - id: 1, - x: downX, - y: downY, - type: TouchType.Down, - } - console.info('down touch started: ' + JSON.stringify(downPonit)) - sendTouchEvent(downPonit); - console.info('start to move') - if (drag) { - await this.sleep(500) - } - for (var i = 1;i <= swipeSteps; i++) { - var movePoint: TouchObject = { - id: 1, - x: downX + (xStep * i), - y: downY + (yStep * i), - type: TouchType.Move - } - console.info('move touch started: ' + JSON.stringify(movePoint)) - ret = sendTouchEvent(movePoint) - if (ret == false) { - break; - } - await this.sleep(5) - } - console.info('start to up') - if (drag) { - await this.sleep(100) - } - var upPoint: TouchObject = { - id: 1, - x: upX, - y: upY, - type: TouchType.Up, - } - console.info('up touch started: ' + JSON.stringify(upPoint)) - sendTouchEvent(upPoint) - await this.sleep(500) + let rectInfo = JSON.parse('[' + obj.$rect + ']'); + this.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0]; + this.rect_top = JSON.parse('[' + rectInfo[0] + ']')[1]; + this.rect_right = JSON.parse('[' + rectInfo[1] + ']')[0]; + this.rect_bottom = JSON.parse('[' + rectInfo[1] + ']')[1]; + this.rect_value = { + "left": this.rect_left, "top": this.rect_top, "right": this.rect_right, "bottom": this.rect_bottom + }; + console.info(JSON.stringify(this.rect_value)); + return this.rect_value; } } - - - diff --git a/arkui/ace_ets_layout_test/signature/openharmony_sx.p7b b/arkui/ace_ets_layout_test/signature/openharmony_sx.p7b index de77b14599538e5185cbddf4c765ef9c905d2c34..7154dfdbb347678fb6d55380335b7b7b68d7029e 100644 GIT binary patch delta 340 zcmeB@elL}7(8Qa~#;Mij(e|B}k)3Hl6K@PqD1wQR(U8}Gn~gJ}&4V$OnT3hbpox_S zp^$Mw6U$$gCYGPoN@b}<#hLkey2<$|sY+IcI&gu!#9W|&lA)e~p25TkhWsU!1t5M= zYEEimajMe94DE>rZ8q~UE?^c*OfD(bODxJR&D6_DtjsSh(JM(UE}49oMTNV#vbZEQ zH$JhTKxs2Ss}(z|qd^m+?PNcm)%C^(Mh3Q!5g43vyERaw~zl zb25_?K^i9?VNub@%P-1J%!vmIE7bzcPR=P-vZ_`}%*n|wPfgK<@S~NKVmE(gv0~?P zFlb`50s6@xdvXC+>f|{*j`c={Mn*=4hNhOrmQe=!aG!Cq7%H(Se9^TEveW%+rFud3 zTUkegMBF?<4eg2M`y5@5Z%Ileu&R?Ds Jz3auddjMDRgU0{> -- GitLab