From fc25f9ce88618cf61f83be53e06e80462fb28d0e Mon Sep 17 00:00:00 2001 From: Mupceet Date: Sat, 22 Oct 2022 12:50:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0=E9=9A=9C=E7=A2=8D=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E6=B5=8B=E8=AF=95errorCode=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mupceet --- barrierfree/accessibletest/BUILD.gn | 1 + .../AppScope/app.json | 19 + .../resources/base/element/string.json | 8 + .../resources/base/media/app_icon.png | Bin 0 -> 6790 bytes .../actsgesturesimulationtest/BUILD.gn | 43 + .../actsgesturesimulationtest/Test.json | 29 + .../src/main/ets/Application/AbilityStage.ts | 24 + .../src/main/ets/MainAbility/MainAbility.ts | 59 ++ .../src/main/ets/MainAbility/pages/index.ets | 235 ++++++ .../ServiceExtAbility/ServiceExtAbility.ts | 581 +++++++++++++ .../src/main/ets/TestAbility/TestAbility.ts | 59 ++ .../src/main/ets/TestAbility/pages/index.ets | 48 ++ .../ets/TestRunner/OpenHarmonyTestRunner.ts | 78 ++ .../entry/src/main/ets/test/Ability.test.ets | 797 ++++++++++++++++++ .../entry/src/main/ets/test/List.test.ets | 19 + .../entry/src/main/module.json | 68 ++ .../main/resources/base/element/string.json | 24 + .../src/main/resources/base/media/icon.png | Bin 0 -> 6790 bytes .../base/profile/accessibility_config.json | 8 + .../resources/base/profile/main_pages.json | 5 + .../signature/openharmony_sx.p7b | Bin 0 -> 3842 bytes 21 files changed, 2105 insertions(+) create mode 100644 barrierfree/accessibletest/actsgesturesimulationtest/AppScope/app.json create mode 100644 barrierfree/accessibletest/actsgesturesimulationtest/AppScope/resources/base/element/string.json create mode 100644 barrierfree/accessibletest/actsgesturesimulationtest/AppScope/resources/base/media/app_icon.png create mode 100644 barrierfree/accessibletest/actsgesturesimulationtest/BUILD.gn create mode 100644 barrierfree/accessibletest/actsgesturesimulationtest/Test.json create mode 100644 barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/ets/Application/AbilityStage.ts create mode 100644 barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/ets/MainAbility/MainAbility.ts create mode 100644 barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/ets/MainAbility/pages/index.ets create mode 100644 barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts create mode 100644 barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/ets/TestAbility/TestAbility.ts create mode 100644 barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/ets/TestAbility/pages/index.ets create mode 100644 barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts create mode 100644 barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/ets/test/Ability.test.ets create mode 100644 barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/ets/test/List.test.ets create mode 100644 barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/module.json create mode 100644 barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/resources/base/element/string.json create mode 100644 barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/resources/base/media/icon.png create mode 100644 barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/resources/base/profile/accessibility_config.json create mode 100644 barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/resources/base/profile/main_pages.json create mode 100644 barrierfree/accessibletest/actsgesturesimulationtest/signature/openharmony_sx.p7b diff --git a/barrierfree/accessibletest/BUILD.gn b/barrierfree/accessibletest/BUILD.gn index bacf236cb..4a4805f14 100644 --- a/barrierfree/accessibletest/BUILD.gn +++ b/barrierfree/accessibletest/BUILD.gn @@ -19,6 +19,7 @@ group("actsaccessibletest") { deps = [ "actsabilitylisttest:ActsAbilityListTest", "actscaptionconfigurationtest:ActsCaptionConfigurationTest", + "actsgesturesimulationtest:ActsGestureSimulationTest", "sceneProject/accessibilityAudibleAbility:accessibilityAudibleAbility", "sceneProject/accessibilityGenericAbility:accessibilityGenericAbility", "sceneProject/accessibilityHapticAbility:accessibilityHapticAbility", diff --git a/barrierfree/accessibletest/actsgesturesimulationtest/AppScope/app.json b/barrierfree/accessibletest/actsgesturesimulationtest/AppScope/app.json new file mode 100644 index 000000000..80ca0d4c4 --- /dev/null +++ b/barrierfree/accessibletest/actsgesturesimulationtest/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.gesturesimulationtest", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive": true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/barrierfree/accessibletest/actsgesturesimulationtest/AppScope/resources/base/element/string.json b/barrierfree/accessibletest/actsgesturesimulationtest/AppScope/resources/base/element/string.json new file mode 100644 index 000000000..4141cc986 --- /dev/null +++ b/barrierfree/accessibletest/actsgesturesimulationtest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "GestureSimulationTest" + } + ] +} diff --git a/barrierfree/accessibletest/actsgesturesimulationtest/AppScope/resources/base/media/app_icon.png b/barrierfree/accessibletest/actsgesturesimulationtest/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpBl$qoSA!PUg~PA65-S00{{S`XKG6NkG0RgjEntPrmV+?0|00mu7;+5 zrdpa{2QLqPJ4Y{j7=Mrl{BaxrkdY69+c~(w{Fv-v&aR%aEI&JYSeRTLWm!zbv;?)_ ziZB;fwGbbeL5Q}YLx`J$lp~A09KK8t_z}PZ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&rYLOxgFdG>O@+XHy z9#;|&vBCPXH5Mon^I`jSuR$&~ZWtyB67ujzFSj!51>#C}C17~TffQ{c-!QFQkTQ%! zIR^b1`zHx|*1GU?tbBx23weFLz5H?y_Q%N&t$}k?w+``2A=aotj0;2v$~AL z{scF-cL{wsdrmPvf#a9OHyYLcwQD4Kcm)`LLwMh4WT~p29f7M!iafJSU`IV}QY5Wa z(n44-9oA}?J{a+ah*@31WTs#&J#o1`H98#6IQf;Wv0N_!);f&9g7o-k(lW5rWnDUR zQBFIRG+X=6NnsI@mxnwm;tf5;_Uxg?jZ8m-m0}&6+DA!qam(p$mN5R})yA_7m$q@| zFEd|dpS595rxQr-n#GjI5i-AhnUE>Cr;jpCqSrD~EwK_DqI^7%3#p5)%T_od!t3SOmH9MyXeeGO2(UQL;ax|x?Ncixmeo1=$ z{-);Au{*tfzOG?KQ~K|ak8-HQ?`Pekhe2WM(8s{xv-p>Zmu_6{G!-oE$7$mY`MOJorI=+mMx?H;`pr!;fVYz?5~yXBACruWB`Ph zZM}90_<^OBxIhyZ9BW$`>6JvO;%VFpqVr8|7t3~AmxYak6?`Pp#c;**_SYmi`&z23 z`p6_~ePvH)C6x-G9$hgL=eVALq`-AiamN>!3~Lxw&{H(b{B(7xSRm6<3<{%{yXiH# zos5Rv1L+8fUKJLo%P>4I&$}y OnePath({ pathInfo: pathInfo })) + Stack() + .width('100%') + .height('100%') + .onTouch((event: TouchEvent) => { + let x = vp2px(event.touches[0].x) + let y = vp2px(event.touches[0].y) + switch (event.type) { + case TouchType.Down: + this.pathInfoArray.push(new PathInfo(`M${x} ${y}`, this.paintSize, this.paintColor)) + break + case TouchType.Move: + this.pathInfoArray[this.pathInfoArray.length-1].commands += `L${x} ${y}` + break + case TouchType.Up: + this.publishEvent() + setTimeout(()=>{ + this.pathInfoArray.length = 0 + }, 1500) + break + } + }) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.Start }) { + Stack({ alignContent: Alignment.TopEnd }) { + this.Canvas() + Row() { + Button('clear').onClick(() => this.pathInfoArray.length = 0) + }.margin(5) + }.height(545).width('100%') + + Button('Test1', {stateEffect: true}) + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 10 }) + .width('60%') + .height(40) + .gesture(LongPressGesture({ repeat: false }) + .onActionEnd(() => { + prompt.showToast({ message: '长点击结束' }) + this.publishEvent() + }) + ) + .onClick((e) => { + let position = 'screenX:' + vp2px(e.screenX) + ' screenY:' + vp2px(e.screenY) + ' x:' + vp2px(e.x) + ' y:' + vp2px(e.y) + console.info(LOG_PREFIX + ' button position : ' + position) + prompt.showToast({ message: position }) + this.publishEvent() + }) + + //滑动 + List({ initialIndex: 12, scroller: this.scroller }) { + ForEach(this.arr, (item) => { + ListItem() { + Text(item) + .width('100%') + .height(25) + .fontSize(16) + .textAlign(TextAlign.Center) + .borderRadius(10) + .backgroundColor(0xF9CF93) + .onClick((e) => { + let position = 'screenX:' + vp2px(e.screenX) + ' screenY:' + vp2px(e.screenY) + ' x:' + vp2px(e.x) + ' y:' + vp2px(e.y) + console.info(LOG_PREFIX + ' list1 position : ' + position) + }) + }.editable(true) + }, item => item) + } + .listDirection(Axis.Vertical) + .divider({ strokeWidth: 2, color: 0xFFFFFF, startMargin: 20, endMargin: 20 }) + .edgeEffect(EdgeEffect.None) + .chainAnimation(false) + .scrollBar(BarState.On) + .onScroll((scrollOffset: number, scrollState: ScrollState) => { + this.getMaxMinNum(scrollOffset) + if (this.notEnd && scrollState == ScrollState.Idle) { + if (this.minNum < 0 && this.maxNum == 0) { + prompt.showToast({ message: '向(上)前滑动' }) + this.publishEvent() + } else if (this.minNum == 0 && this.maxNum > 0) { + prompt.showToast({ message: '向(下)后滑动' }) + this.publishEvent() + } + this.resetNum() + } + }) + .editMode(false) + .margin({ top: 10 }) + .height(140) + + Text(this.message).fontSize(20).fontWeight(FontWeight.Bold).height(20) + }.height('100%').width('100%') + } + + getMaxMinNum(scrollOffset: number){ + this.addNum += scrollOffset + this.minNum = Math.min(this.addNum, this.minNum) + this.maxNum = Math.max(this.addNum, this.maxNum) + } + + resetNum(){ + this.addNum = 0 + this.minNum = 0 + this.maxNum = 0 + } + + publishEvent() { + let commonEventPublishData = { + data: this.caseCode, parameters: { res: true } + } + console.info(LOG_PREFIX + 'publishEvent data : ' + JSON.stringify(commonEventPublishData)) + try { + commonEvent.publish(EVENT_NAME_BACK, commonEventPublishData, (err, data) => { + if (err && err.code != 0) { + console.info(LOG_PREFIX + 'failed to publish because ' + JSON.stringify(err)) + return + } + console.info(LOG_PREFIX + 'success data : ' + JSON.stringify(data)) + }) + } catch (e) { + console.info(LOG_PREFIX + '[publishEvent] error' + e.message) + } + } + + createSubscriber(){ + commonEvent.createSubscriber(CommonEventSubscribeInfo).then((subscriber) => { + this.subScriber = subscriber + commonEvent.subscribe(subscriber, (error, commonEventData) => { + if (error.code != 0) { + console.info(LOG_PREFIX + 'subscribe failed. Cause:' + JSON.stringify(error)) + return + } + console.info(LOG_PREFIX + 'subscribeTest callback : ' + JSON.stringify(commonEventData)) + this.caseCode = commonEventData.data + if(commonEventData.data === 'GestureSimulation_0090'){ + this.notEnd = false + } + }) + }).catch((error) => { + console.info(LOG_PREFIX + 'createSubscriber failed. Cause: ' + JSON.stringify(error)) + return + }) + } +} + + +@Component +struct OnePath { + @ObjectLink pathInfo: PathInfo + + build() { + Path() + .width('100%') + .height('100%') + .fillOpacity(0) + .commands(this.pathInfo.commands) + .strokeWidth(this.pathInfo.width) + .stroke(this.pathInfo.color) + } +} + + +@Observed +class PathInfo { + commands: string + width: number + color: Color + + constructor(commands: string, width: number, color: Color) { + this.commands = commands + this.width = width + this.color = color + } +} \ No newline at end of file diff --git a/barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts b/barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts new file mode 100644 index 000000000..f9ea8be22 --- /dev/null +++ b/barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts @@ -0,0 +1,581 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtensionAbility' +import { GesturePath } from '@ohos.accessibility.GesturePath'; +import { GesturePoint } from '@ohos.accessibility.GesturePoint'; +import commonEvent from '@ohos.commonEvent' + + +const LOG_PREFIX = '[CQH-GESTURE-ABILITY-ACCESSIBLE]' +const EVENT_NAME = 'on_assist_change' +const EVENT_NAME_BACK = 'on_assist_change_extra' +const MS_400 = 400 +const MS_500 = 500 +const MS_800 = 800 +const MS_1000 = 1000 +let CommonEventSubscribeInfo = { + events: [EVENT_NAME] +} + +var subscriber +class ServiceExtAbility extends AccessibilityExtensionAbility { + onConnect() { + console.info(LOG_PREFIX + " onConnect") + let context = this.context + commonEvent.createSubscriber(CommonEventSubscribeInfo).then((data) => { + subscriber = data + commonEvent.subscribe(subscriber, (error, commonEventData) => { + if (error.code != 0) { + console.info(LOG_PREFIX + 'subscribe failed. Cause:' + JSON.stringify(error)) + return + } + console.info(LOG_PREFIX + 'subscribeTest callback : ' + JSON.stringify(commonEventData)) + selectCode(context, commonEventData.data) + }) + }).catch((error) => { + console.info(LOG_PREFIX + 'createSubscriber failed. Cause: ' + JSON.stringify(error)) + return + }) + } + + onDisconnect() { + console.info(LOG_PREFIX + " onDisconnect") + commonEvent.unsubscribe(subscriber) + } + + onAccessibilityEvent(accessibilityEvent) { + console.info(LOG_PREFIX + " accessibilityEvent : " + JSON.stringify(accessibilityEvent)) + } + + onKeyEvent(keyEvent) { + console.info(LOG_PREFIX + " keyEvent : " + JSON.stringify(keyEvent)) + return true + } +} + +function selectCode(context, caseCode) { + switch (caseCode) { + case 'GestureSimulation_0010': + GestureSimulation_0010(context, caseCode) + break + case 'GestureSimulation_0020': + GestureSimulation_0020(context, caseCode) + break + case 'GestureSimulation_0030': + GestureSimulation_0030(context, caseCode) + break + case 'GestureSimulation_0040': + GestureSimulation_0040(context, caseCode) + break + case 'GestureSimulation_0050': + GestureSimulation_0050(context, caseCode) + break + case 'GestureSimulation_0060': + GestureSimulation_0060(context, caseCode) + break + case 'GestureSimulation_0070': + GestureSimulation_0070(context, caseCode) + break + case 'GestureSimulation_0080': + GestureSimulation_0080(context, caseCode) + break + case 'GestureSimulation_0090': + GestureSimulation_0090(context, caseCode) + break + case 'GestureSimulation_0100': + GestureSimulation_0100(context, caseCode) + break + case 'GestureSimulation_0110': + GestureSimulation_0110(context, caseCode) + break + case 'GestureSimulation_0120': + GestureSimulation_0120(context, caseCode) + break + case 'GestureSimulation_0130': + GestureSimulation_0130(context, caseCode) + break + case 'GestureSimulation_0140': + GestureSimulation_0140(context, caseCode) + break + case 'GestureSimulation_0150': + GestureSimulation_0150(context, caseCode) + break + case 'GestureSimulation_0160': + GestureSimulation_0160(context, caseCode) + break + case 'GestureSimulation_0170': + GestureSimulation_0170(context, caseCode) + break + case 'GestureSimulation_0180': + GestureSimulation_0180(context, caseCode) + break + case 'GestureSimulation_0190': + GestureSimulation_0190(context, caseCode) + break + case 'GestureSimulation_0200': + GestureSimulation_0200(context, caseCode) + break + case 'GestureSimulation_0210': + GestureSimulation_0210(context, caseCode) + break + case 'GestureSimulation_0220': + GestureSimulation_0220(context, caseCode) + break + case 'GestureSimulation_0230': + GestureSimulation_0230(context, caseCode) + break + case 'GestureSimulation_0240': + GestureSimulation_0240(context, caseCode) + break + case 'GestureSimulation_0250': + GestureSimulation_0250(context, caseCode) + break + case 'GestureSimulation_0260': + GestureSimulation_0260(context, caseCode) + break + case 'GestureSimulation_0270': + GestureSimulation_0270(context, caseCode) + break + case 'GestureSimulation_0280': + GestureSimulation_0280(context, caseCode) + break + case 'GestureSimulation_0290': + GestureSimulation_0290(context, caseCode) + break + case 'GestureSimulation_0300': + GestureSimulation_0300(context, caseCode) + break + case 'GestureSimulation_0310': + GestureSimulation_0310(context, caseCode) + break + case 'GestureSimulation_0320': + GestureSimulation_0320(context, caseCode) + break + case 'GestureSimulation_0330': + GestureSimulation_0330(context, caseCode) + break + case 'GestureSimulation_0340': + GestureSimulation_0340(context, caseCode) + break + case 'GestureSimulation_0350': + GestureSimulation_0350(context, caseCode) + break + case 'GestureSimulation_0360': + GestureSimulation_0360(context, caseCode) + break + case 'GestureSimulation_0370': + GestureSimulation_0370(context, caseCode) + break + case 'GestureSimulation_0380': + GestureSimulation_0380(context, caseCode) + break + case 'GestureSimulation_0390': + GestureSimulation_0390(context, caseCode) + break + case 'GestureSimulation_0400': + GestureSimulation_0400(context, caseCode) + break + case 'GestureSimulation_0410': + GestureSimulation_0410(context, caseCode) + break + case 'GestureSimulation_0420': + GestureSimulation_0420(context, caseCode) + break + } +} + +function getGesturePath(durationTime: number, array: Array) { + let gesturePath = new GesturePath(durationTime) + for (let item of array) { + let pos = item.split(',') + let point = new GesturePoint(Number(pos[0]), Number(pos[1])) + gesturePath.points.push(point) + } + return gesturePath +} + +let click = ["332,945"] + +//click +function GestureSimulation_0010(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_400, click) + gestureInjectCallback1(logTag, context, gesturePath, caseCode) +} + +//click +function GestureSimulation_0020(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_400, click) + gestureInjectPromise1(logTag, context, gesturePath, caseCode) +} + +//longClick +function GestureSimulation_0030(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_1000, click) + gestureInjectCallback1(logTag, context, gesturePath, caseCode) +} + +//longClick +function GestureSimulation_0040(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_1000, click) + gestureInjectPromise1(logTag, context, gesturePath, caseCode) +} + + +let scrollForward = ["378,1069", "377,1028", "377,983"] +let scrollBackward = ["377,983", "377,1028", "378,1069"] +//scrollForward +function GestureSimulation_0050(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_500, scrollForward) + gestureInjectCallback1(logTag, context, gesturePath, caseCode) +} + +//scrollForward +function GestureSimulation_0060(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_500, scrollForward) + gestureInjectPromise1(logTag, context, gesturePath, caseCode) +} + +//scrollBackward +function GestureSimulation_0070(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_500, scrollBackward) + gestureInjectCallback1(logTag, context, gesturePath, caseCode) +} + +//scrollBackward +function GestureSimulation_0080(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_500, scrollBackward) + gestureInjectPromise1(logTag, context, gesturePath, caseCode) +} + + +let left = ["394,416", "389,416", "373,416", "357,416", "344,417", "332,417", "323,418", "315,418", "305,418", "295,418", "285,418", "277,419", "269,419", "259,419", "248,421", "238,422", "230,423", "223,424", "218,424", "213,424", "207,425", "202,425", "198,425", "197,425", "196,425", "195,425", "194,425", "194,425"] +let leftThenRight = ["438,420", "431,420", "418,420", "400,420", "384,422", "368,424", "351,427", "334,430", "316,433", "300,436", "283,439", "268,441", "255,443", "243,445", "233,446", "223,447", "216,448", "212,449", "211,450", "209,450", "207,450", "202,450", "201,450", "200,450", "199,450", "198,450", "197,450", "198,450", "199,449", "205,446", "211,443", "219,439", "226,435", "233,432", "239,429", "246,426", "252,423", "258,422", "264,421", "271,420", "281,419", "291,418", "302,415", "311,414", "320,413", "325,410", "330,409", "335,408", "336,407", "337,407", "338,407", "339,407", "340,407", "344,406", "345,406", "349,406", "350,405", "351,405", "352,405", "353,405", "354,405", "355,404", "356,404", "357,404", "358,404", "363,404", "367,403", "373,403", "377,403", "378,402", "379,402", "380,402", "380,402"] +let leftThenUp = ["476,408", "469,408", "459,408", "443,408", "429,408", "415,408", "400,409", "384,411", "369,414", "354,416", "327,420", "281,425", "268,425", "264,425", "263,425", "259,424", "258,423", "257,422", "256,422", "255,421", "254,420", "253,417", "251,414", "245,407", "241,402", "239,387", "237,377", "234,367", "233,357", "232,354", "232,349", "232,345", "231,341", "231,336", "231,325", "231,321", "231,317", "231,314", "231,311", "230,308", "230,304", "229,300", "229,296", "228,292", "228,289", "227,286", "227,285", "227,282", "226,281", "226,278", "226,275", "225,271", "225,268", "225,265", "225,262", "225,261", "224,258", "224,257", "224,254", "224,253", "224,252", "224,251", "224,250", "223,250", "223,250"] +let leftThenDown = ["456,360", "451,360", "435,359", "429,358", "423,357", "414,356", "405,355", "394,354", "385,354", "376,354", "369,354", "361,354", "352,354", "345,353", "337,353", "329,353", "321,353", "314,353", "307,353", "300,353", "293,353", "285,353", "278,353", "273,353", "269,353", "265,353", "259,355", "251,358", "245,359", "241,361", "239,364", "234,367", "230,371", "225,381", "221,382", "219,385", "215,388", "213,391", "211,395", "209,406", "208,417", "206,430", "205,442", "204,453", "204,457", "204,472", "204,475", "204,487", "204,490", "204,500", "204,502", "204,506", "204,510", "204,514", "204,517", "204,521", "204,525", "205,529", "205,532", "205,534", "206,535", "206,536", "206,538", "206,541", "206,544", "206,546", "206,547", "206,548", "206,549", "206,550", "206,550"] + +//left +function GestureSimulation_0090(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_500, left) + gestureInjectCallback1(logTag, context, gesturePath, caseCode) +} + +//left +function GestureSimulation_0100(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_500, left) + gestureInjectPromise1(logTag, context, gesturePath, caseCode) +} + +//leftThenRight +function GestureSimulation_0110(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_800, leftThenRight) + gestureInjectCallback1(logTag, context, gesturePath, caseCode) +} + +//leftThenRight +function GestureSimulation_0120(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_800, leftThenRight) + gestureInjectPromise1(logTag, context, gesturePath, caseCode) +} + +//leftThenUp +function GestureSimulation_0130(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_800, leftThenUp) + gestureInjectCallback1(logTag, context, gesturePath, caseCode) +} + +//leftThenUp +function GestureSimulation_0140(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_800, leftThenUp) + gestureInjectPromise1(logTag, context, gesturePath, caseCode) +} + +//leftThenDown +function GestureSimulation_0150(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_800, leftThenDown) + gestureInjectCallback1(logTag, context, gesturePath, caseCode) +} + +//leftThenDown +function GestureSimulation_0160(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_800, leftThenDown) + gestureInjectPromise1(logTag, context, gesturePath, caseCode) +} + + +let right = ["258,438", "265,438", "276,437", "289,433", "298,430", "304,427", "310,424", "316,423", "322,422", "329,421", "337,420", "344,419", "351,419", "357,418", "364,417", "374,416", "383,415", "392,414", "399,414", "406,414", "413,413", "420,413", "428,412", "436,412", "444,412", "450,412", "456,412", "461,412", "465,412", "470,412", "476,412", "482,412", "489,412", "494,412", "498,412", "503,412", "504,412", "510,412", "511,412", "512,412", "513,412", "514,412", "515,412", "516,412", "516,414", "516,414"] +let rightThenLeft = ["289,451", "295,451", "307,450", "327,447", "350,444", "375,441", "402,438", "428,435", "450,434", "468,433", "480,432", "487,431", "488,430", "492,429", "492,428", "493,428", "494,428", "495,428", "501,428", "506,427", "511,427", "512,426", "518,425", "522,424", "526,424", "536,423", "540,422", "544,422", "545,422", "546,422", "546,421", "545,420", "543,419", "539,418", "535,418", "531,418", "527,418", "522,418", "518,417", "513,416", "508,415", "502,414", "497,413", "492,412", "486,411", "480,410", "475,409", "470,408", "464,408", "450,407", "443,407", "436,406", "429,406", "423,405", "418,405", "412,405", "406,405", "391,405", "384,405", "378,405", "373,405", "369,405", "367,405", "362,405", "358,405", "356,405", "354,405", "352,405", "351,405", "350,405", "349,405", "349,405"] +let rightThenUp = ["258,454", "265,454", "278,454", "293,454", "307,454", "320,454", "335,454", "347,453", "357,453", "366,453", "375,453", "392,453", "398,453", "404,453", "410,453", "416,453", "424,453", "432,453", "440,452", "446,451", "450,450", "451,450", "455,450", "456,450", "457,449", "461,448", "462,447", "467,444", "471,441", "472,438", "477,435", "478,431", "482,427", "483,423", "487,419", "487,416", "488,413", "489,412", "493,409", "493,406", "494,403", "495,400", "496,390", "497,387", "497,373", "497,369", "497,365", "497,361", "497,360", "498,357", "498,354", "498,351", "498,347", "498,337", "498,333", "498,322", "498,319", "498,314", "498,309", "498,299", "498,298", "498,294", "498,290", "498,286", "498,283", "498,280", "498,279", "498,278", "498,277", "498,276", "498,275", "498,274", "498,273", "498,272", "498,271", "498,271"] +let rightThenDown = ["250,408", "257,408", "269,408", "286,407", "302,404", "316,401", "330,398", "343,395", "355,392", "365,391", "385,389", "394,388", "402,387", "407,386", "412,385", "418,384", "423,384", "424,384", "429,384", "430,384", "436,384", "443,384", "449,384", "454,384", "455,384", "456,384", "457,384", "458,384", "459,384", "465,384", "470,384", "471,384", "476,384", "477,385", "481,386", "482,388", "487,390", "488,393", "493,395", "494,398", "498,401", "499,404", "500,407", "501,410", "505,420", "506,423", "507,427", "508,439", "509,442", "510,453", "511,455", "512,458", "512,461", "512,464", "513,471", "513,475", "514,479", "514,484", "514,486", "514,488", "514,490", "514,491", "514,492", "514,494", "514,498", "514,509", "515,510", "515,513", "515,515", "515,517", "515,517"] + +//right +function GestureSimulation_0170(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_500, right) + gestureInjectCallback1(logTag, context, gesturePath, caseCode) +} + +//right +function GestureSimulation_0180(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_500, right) + gestureInjectPromise1(logTag, context, gesturePath, caseCode) +} + +//rightThenLeft +function GestureSimulation_0190(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_800, rightThenLeft) + gestureInjectCallback1(logTag, context, gesturePath, caseCode) +} + +//rightThenLeft +function GestureSimulation_0200(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_800, rightThenLeft) + gestureInjectPromise1(logTag, context, gesturePath, caseCode) +} + +//rightThenUp +function GestureSimulation_0210(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_800, rightThenUp) + gestureInjectCallback1(logTag, context, gesturePath, caseCode) +} + +//rightThenUp +function GestureSimulation_0220(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_800, rightThenUp) + gestureInjectPromise1(logTag, context, gesturePath, caseCode) +} + +//rightThenDown +function GestureSimulation_0230(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_800, rightThenDown) + gestureInjectCallback1(logTag, context, gesturePath, caseCode) +} + +//rightThenDown +function GestureSimulation_0240(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_800, rightThenDown) + gestureInjectPromise1(logTag, context, gesturePath, caseCode) +} + + +let up = ["365,475", "365,467", "365,455", "364,452", "364,448", "364,443", "364,432", "364,422", "364,409", "365,393", "366,380", "367,375", "368,365", "370,361", "370,357", "370,346", "371,334", "372,322", "373,319", "373,316", "373,315", "373,314", "374,311", "375,301", "376,291", "377,280", "378,277", "379,274", "380,273", "380,270", "380,266", "381,261", "381,250", "382,247", "382,244", "382,243", "382,240", "382,237", "382,234", "382,233", "382,232", "382,229", "382,226", "382,222", "382,218", "382,215", "382,214", "382,213", "382,212", "382,212"] +let upThenDown = ["361,523", "361,520", "361,509", "360,499", "360,496", "360,492", "360,488", "360,485", "360,484", "360,474", "360,469", "361,456", "362,452", "363,442", "364,438", "365,433", "366,422", "367,419", "367,415", "367,412", "367,409", "367,406", "368,390", "369,386", "370,382", "370,378", "370,375", "370,372", "371,361", "373,344", "374,341", "374,338", "374,335", "374,332", "374,327", "375,316", "375,312", "375,300", "375,296", "374,291", "374,280", "373,277", "372,272", "371,264", "371,263", "371,262", "371,261", "371,260", "371,262", "371,265", "372,269", "373,272", "373,276", "374,280", "375,290", "375,293", "375,297", "376,301", "376,305", "376,309", "376,319", "376,321", "377,324", "377,327", "378,330", "378,334", "378,337", "378,341", "378,351", "378,353", "378,356", "378,360", "378,370", "378,372", "378,375", "378,377", "378,379", "378,381", "378,384", "378,388", "378,392", "378,402", "378,404", "378,407", "378,409", "378,411", "378,414", "378,417", "378,421", "378,425", "378,428", "378,430", "378,433", "378,436", "378,439", "378,440", "378,441", "378,443", "378,446"] +let upThenLeft = ["379,465", "380,445", "381,425", "385,406", "385,388", "385,373", "386,359", "386,344", "386,332", "387,322", "387,318", "387,307", "387,304", "387,300", "387,299", "387,298", "387,297", "387,296", "387,295", "387,294", "386,293", "385,290", "383,286", "381,283", "379,280", "377,279", "372,275", "370,272", "366,271", "365,270", "363,269", "359,266", "357,265", "352,264", "350,263", "345,262", "341,261", "335,260", "329,259", "321,258", "314,258", "308,257", "301,257", "293,257", "279,257", "274,257", "272,257", "271,257", "270,257", "269,257", "268,257", "267,257", "266,257", "265,257", "264,257", "263,257", "263,256", "263,256"] +let upThenRight = ["329,528", "329,525", "329,510", "329,493", "329,476", "328,459", "326,442", "325,425", "323,410", "322,396", "321,383", "320,370", "320,360", "320,350", "320,347", "320,343", "321,342", "321,341", "321,340", "321,339", "322,336", "323,332", "325,327", "326,326", "326,325", "326,324", "326,323", "327,322", "328,321", "329,320", "334,317", "334,316", "335,315", "335,314", "336,313", "340,312", "341,311", "345,310", "345,309", "346,308", "347,308", "348,307", "355,306", "363,303", "372,300", "383,297", "392,294", "401,293", "406,290", "411,289", "412,288", "413,288", "414,288", "415,288", "420,287", "424,287", "429,286", "435,286", "441,285", "446,284", "447,284", "451,283", "452,283", "456,283", "457,283", "458,283", "459,283", "460,283", "461,283", "462,283", "463,283", "464,283", "471,283", "477,283", "482,283", "487,283", "487,283"] + +//up +function GestureSimulation_0250(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_500, up) + gestureInjectCallback1(logTag, context, gesturePath, caseCode) +} + +//up +function GestureSimulation_0260(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_500, up) + gestureInjectPromise1(logTag, context, gesturePath, caseCode) +} + +//upThenLeft +function GestureSimulation_0270(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_800, upThenLeft) + gestureInjectCallback1(logTag, context, gesturePath, caseCode) +} + +//upThenLeft +function GestureSimulation_0280(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_800, upThenLeft) + gestureInjectPromise1(logTag, context, gesturePath, caseCode) +} + +//upThenRight +function GestureSimulation_0290(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_800, upThenRight) + gestureInjectCallback1(logTag, context, gesturePath, caseCode) +} + +//upThenRight +function GestureSimulation_0300(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_800, upThenRight) + gestureInjectPromise1(logTag, context, gesturePath, caseCode) +} + +//upThenDown +function GestureSimulation_0310(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_800, upThenDown) + gestureInjectCallback1(logTag, context, gesturePath, caseCode) +} + +//upThenDown +function GestureSimulation_0320(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_800, upThenDown) + gestureInjectPromise1(logTag, context, gesturePath, caseCode) +} + +let down = ["372,271", "372,273", "372,284", "373,295", "374,298", "378,310", "378,314", "379,327", "380,331", "381,346", "381,356", "381,367", "381,377", "381,381", "381,391", "381,394", "381,404", "381,407", "381,419", "381,429", "381,433", "380,445", "380,446", "379,456", "378,460", "377,475", "377,479", "377,490", "377,491", "377,494", "377,495", "377,496", "377,499", "376,503", "376,506", "375,509", "375,511", "375,512", "375,513", "375,513"] +let downThenUp = ["325,309", "325,312", "326,329", "332,349", "333,367", "334,386", "335,405", "340,443", "345,461", "346,477", "350,493", "351,509", "355,524", "356,539", "357,551", "358,563", "362,566", "362,576", "363,576", "364,572", "368,559", "369,549", "373,536", "373,531", "374,518", "374,515", "374,504", "374,500", "374,489", "374,486", "374,482", "374,478", "374,470", "374,466", "374,462", "374,459", "374,458", "374,457", "374,454", "374,450", "374,443", "374,442", "374,441", "374,440", "374,439", "374,438", "374,437", "374,434", "374,430", "375,425", "375,421", "375,418", "375,417", "375,416", "375,415", "375,412", "375,409", "375,406", "375,403", "375,402", "375,401", "375,400", "375,399", "375,398", "375,397", "375,397"] +let downThenLeft = ["363,267", "363,270", "363,286", "364,301", "368,314", "369,326", "370,338", "371,349", "375,361", "375,371", "375,383", "375,406", "375,417", "375,428", "375,439", "374,449", "373,460", "373,464", "372,476", "371,479", "371,489", "370,491", "370,494", "369,497", "368,509", "366,513", "362,526", "360,529", "355,533", "353,543", "351,543", "349,545", "342,548", "332,551", "318,554", "305,557", "290,560", "276,563", "263,565", "254,566", "246,567", "242,567", "238,567", "237,568", "236,568", "235,568", "234,568", "233,568", "233,568"] +let downThenRight = ["331,286", "331,288", "331,298", "332,302", "333,313", "334,316", "335,330", "336,341", "338,362", "338,374", "338,386", "338,398", "337,402", "336,413", "335,416", "334,427", "333,431", "332,443", "332,447", "331,459", "331,473", "331,476", "331,480", "331,490", "331,493", "331,497", "331,507", "332,508", "332,511", "333,515", "334,519", "335,529", "336,530", "341,534", "342,538", "343,542", "347,546", "348,550", "352,554", "353,560", "354,561", "358,563", "359,565", "367,568", "376,571", "385,574", "395,576", "402,577", "408,578", "416,578", "426,578", "435,578", "451,578", "459,578", "466,577", "472,576", "477,575", "478,574", "479,573", "480,572", "481,572", "481,571", "482,571", "495,570", "505,569", "514,566", "519,565", "520,564", "521,563", "522,563", "523,563", "523,563"] + +//down +function GestureSimulation_0330(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_500, down) + gestureInjectCallback1(logTag, context, gesturePath, caseCode) +} + +//down +function GestureSimulation_0340(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_500, down) + gestureInjectPromise1(logTag, context, gesturePath, caseCode) +} + +//downThenLeft +function GestureSimulation_0350(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_800, downThenLeft) + gestureInjectCallback1(logTag, context, gesturePath, caseCode) +} + +//downThenLeft +function GestureSimulation_0360(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_800, downThenLeft) + gestureInjectPromise1(logTag, context, gesturePath, caseCode) +} + +//downThenRight +function GestureSimulation_0370(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_800, downThenRight) + gestureInjectCallback1(logTag, context, gesturePath, caseCode) +} + +//downThenRight +function GestureSimulation_0380(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_800, downThenRight) + gestureInjectPromise1(logTag, context, gesturePath, caseCode) +} + +//downThenUp +function GestureSimulation_0390(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_800, downThenUp) + gestureInjectCallback1(logTag, context, gesturePath, caseCode) +} + +//downThenUp +function GestureSimulation_0400(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_800, downThenUp) + gestureInjectPromise1(logTag, context, gesturePath, caseCode) +} + +//up +function GestureSimulation_0410(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_500, up) + gestureInjectCallback1(logTag, context, gesturePath, caseCode) +} + +//up +function GestureSimulation_0420(context, caseCode) { + const logTag = LOG_PREFIX + caseCode + let gesturePath = getGesturePath(MS_500, up) + gestureInjectPromise1(logTag, context, gesturePath, caseCode) +} + +function gestureInjectCallback1(logTag, context, gesturePath, caseCode) { + try { + context.injectGesture(gesturePath, (data) => { + console.info(logTag + "injectGesture Callback res: " + JSON.stringify(data)) + var commonEventPublishData = { data: caseCode, parameters: { res: data.code === 0 } } + publishEvent(commonEventPublishData) + }) + } catch (e) { + console.info(logTag + " injectGesture Callback Exception: " + JSON.stringify(e.message)) + return + } +} + +function gestureInjectPromise1(logTag, context, gesturePath, caseCode) { + try { + context.injectGesture(gesturePath) + .then(() => { + console.info(logTag + "injectGesture Promise success") + var commonEventPublishData = { data: caseCode, parameters: { res: true } } + publishEvent(commonEventPublishData) + }) + .catch((err) => { + console.info(logTag + "injectGesture Promise err=" + JSON.stringify(err)) + var commonEventPublishData = { data: caseCode, parameters: { res: false } } + publishEvent(commonEventPublishData) + }) + } catch (e) { + console.info(LOG_PREFIX + " injectGesture Promise Exception: " + JSON.stringify(e.message)) + return + } +} + + +function publishEvent(commonEventPublishData) { + console.info(LOG_PREFIX + 'publishEvent data : ' + JSON.stringify(commonEventPublishData)) + try { + commonEvent.publish(EVENT_NAME_BACK, commonEventPublishData, (err, data) => { + if (err && err.code != 0) { + console.info(LOG_PREFIX + 'failed to publish because ' + JSON.stringify(err)) + return + } + console.info(LOG_PREFIX + 'success data : ' + JSON.stringify(data)) + }) + } catch (e) { + console.info(LOG_PREFIX + '[publishEvent] error' + e.message) + return + } +} + +export default ServiceExtAbility \ No newline at end of file diff --git a/barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/ets/TestAbility/TestAbility.ts b/barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/ets/TestAbility/TestAbility.ts new file mode 100644 index 000000000..20877f79a --- /dev/null +++ b/barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/ets/TestAbility/TestAbility.ts @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default class TestAbility extends Ability { + onCreate(want, launchParam) { + console.log('TestAbility onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log('TestAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('TestAbility onWindowStageCreate') + windowStage.loadContent("TestAbility/pages/index", (err, data) => { + if (err.code) { + console.error('Failed to load the content. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data)) + }); + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('TestAbility onWindowStageDestroy') + } + + onForeground() { + console.log('TestAbility onForeground') + } + + onBackground() { + console.log('TestAbility onBackground') + } +}; diff --git a/barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/ets/TestAbility/pages/index.ets b/barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100644 index 000000000..33b5d087a --- /dev/null +++ b/barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import router from '@ohos.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('TestAbility index aboutToAppear') + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } diff --git a/barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 000000000..98dc665d2 --- /dev/null +++ b/barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout', + '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a com.example.gesturesimulationtest.MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + if (debug == 'true') + { + cmd += ' -D' + } + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; diff --git a/barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/ets/test/Ability.test.ets b/barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 000000000..c92ff996e --- /dev/null +++ b/barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,797 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import commonEvent from '@ohos.commonEvent' +import prompt from '@system.prompt' +import config from '@ohos.accessibility.config' + +const ASSIST_BUNDLE_NAME = 'com.example.gesturesimulationtest/ServiceExtAbility' +const LOG_PREFIX = '[CQH-GESTURE-ABILITY-TEST]' +const EVENT_NAME = 'on_assist_change' +const A_EVENT_NAME_BACK = 'on_assist_change_extra' +const T_EVENT_NAME_BACK = 'on_target_change_extra' +const TIME_OUT = 3000 +const TIME_OUT_L = 5000 +let CommonEventSubscribeInfo = { + events: [T_EVENT_NAME_BACK, A_EVENT_NAME_BACK] +} + +export default function abilityTest() { + + let subscriber = undefined + let tarResult: Map = new Map() + let assResult: Map = new Map() + + describe('ActsGestureSimulationTest', function (abilityContext) { + beforeAll(async function (done) { + console.info(LOG_PREFIX + '[StartTargetApp] start') + try { + subscriber = await commonEvent.createSubscriber(CommonEventSubscribeInfo) + try { + commonEvent.subscribe(subscriber, (error, commonEventData) => { + if (error.code != 0) { + console.info(LOG_PREFIX + 'subscribe callback error. Cause:' + JSON.stringify(error)) + return + } + console.info(LOG_PREFIX + 'subscribeTest callback : ' + JSON.stringify(commonEventData)) + if (commonEventData.event === T_EVENT_NAME_BACK) { + tarResult.set(commonEventData.data, commonEventData.parameters.res) + } else { + assResult.set(commonEventData.data, commonEventData.parameters.res) + } + }) + } catch (e) { + console.info(LOG_PREFIX + 'subscribe failed. Cause:' + JSON.stringify(e)) + } + enableAbility(LOG_PREFIX, ASSIST_BUNDLE_NAME, ['gesture']) + setTimeout(() => { + done() + }, 1000) + } catch (e) { + console.info(LOG_PREFIX + '[StartTargetApp] error' + e.message) + } + }) + afterAll(async function (done) { + prompt.showToast({ + message: 'CASE All End' + }) + disableAbility(LOG_PREFIX, ASSIST_BUNDLE_NAME) + done() + }) + beforeEach(function (done) { + setTimeout(() => { + done() + }, 2000) + }) + /** + * @tc.number: GestureSimulation_0010 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute click gesture operation(callback). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute click gesture operation(callback). + */ + it('GestureSimulation_0010', 1, async function (done) { + var caseCode = 'GestureSimulation_0010' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + 'GestureSimulation_0010 tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0020 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute click gesture operation(promise). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute click gesture operation(promise). + */ + it('GestureSimulation_0020', 1, async function (done) { + var caseCode = 'GestureSimulation_0020' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + 'GestureSimulation_0020 tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0030 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute longClick gesture operation(callback). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute longClick gesture operation(callback). + */ + it('GestureSimulation_0030', 1, async function (done) { + var caseCode = 'GestureSimulation_0030' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + 'GestureSimulation_0030 tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT_L) + }) + /** + * @tc.number: GestureSimulation_0040 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute longClick gesture operation(promise). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute longClick gesture operation(promise). + */ + it('GestureSimulation_0040', 1, async function (done) { + var caseCode = 'GestureSimulation_0040' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + 'GestureSimulation_0040 tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT_L) + }) + /** + * @tc.number: GestureSimulation_0070 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute scrollBackward gesture operation(callback). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute scrollBackward gesture operation(callback). + */ + it('GestureSimulation_0070', 1, async function (done) { + var caseCode = 'GestureSimulation_0070' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + 'GestureSimulation_0070 tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0080 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute scrollBackward gesture operation(promise). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute scrollBackward gesture operation(promise). + */ + it('GestureSimulation_0080', 1, async function (done) { + var caseCode = 'GestureSimulation_0080' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + 'GestureSimulation_0080 tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0090 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute left gesture operation(callback). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute left gesture operation(callback). + */ + it('GestureSimulation_0090', 1, async function (done) { + var caseCode = 'GestureSimulation_0090' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0100 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute left gesture operation(promise). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute left gesture operation(promise). + */ + it('GestureSimulation_0100', 1, async function (done) { + var caseCode = 'GestureSimulation_0100' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0110 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute leftThenRight gesture operation(callback). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute leftThenRight gesture operation(callback). + */ + it('GestureSimulation_0110', 1, async function (done) { + var caseCode = 'GestureSimulation_0110' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0120 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute leftThenRight gesture operation(promise). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute leftThenRight gesture operation(promise). + */ + it('GestureSimulation_0120', 1, async function (done) { + var caseCode = 'GestureSimulation_0120' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0130 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute leftThenUp gesture operation(callback). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute leftThenUp gesture operation(callback). + */ + it('GestureSimulation_0130', 1, async function (done) { + var caseCode = 'GestureSimulation_0130' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0140 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute leftThenUp gesture operation(promise). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute leftThenUp gesture operation(promise). + */ + it('GestureSimulation_0140', 1, async function (done) { + var caseCode = 'GestureSimulation_0140' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0150 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute leftThenDown gesture operation(callback). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute leftThenDown gesture operation(callback). + */ + it('GestureSimulation_0150', 1, async function (done) { + var caseCode = 'GestureSimulation_0150' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0160 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute leftThenDown gesture operation(promise). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute leftThenDown gesture operation(promise). + */ + it('GestureSimulation_0160', 1, async function (done) { + var caseCode = 'GestureSimulation_0160' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0170 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute right gesture operation(callback). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute right gesture operation(callback). + */ + it('GestureSimulation_0170', 1, async function (done) { + var caseCode = 'GestureSimulation_0170' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0180 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute right gesture operation(promise). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute right gesture operation(promise). + */ + it('GestureSimulation_0180', 1, async function (done) { + var caseCode = 'GestureSimulation_0180' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0190 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute rightThenLeft gesture operation(callback). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute rightThenLeft gesture operation(callback). + */ + it('GestureSimulation_0190', 1, async function (done) { + var caseCode = 'GestureSimulation_0190' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0200 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute rightThenLeft gesture operation(promise). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute rightThenLeft gesture operation(promise). + */ + it('GestureSimulation_0200', 1, async function (done) { + var caseCode = 'GestureSimulation_0200' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0210 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute rightThenUp gesture operation(callback). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute rightThenUp gesture operation(callback). + */ + it('GestureSimulation_0210', 1, async function (done) { + var caseCode = 'GestureSimulation_0210' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0220 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute rightThenUp gesture operation(promise). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute rightThenUp gesture operation(promise). + */ + it('GestureSimulation_0220', 1, async function (done) { + var caseCode = 'GestureSimulation_0220' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0230 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute rightThenDown gesture operation(callback). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute rightThenDown gesture operation(callback). + */ + it('GestureSimulation_0230', 1, async function (done) { + var caseCode = 'GestureSimulation_0230' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0220 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute rightThenDown gesture operation(promise). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute rightThenDown gesture operation(promise). + */ + it('GestureSimulation_0240', 1, async function (done) { + var caseCode = 'GestureSimulation_0240' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0250 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute up gesture operation(callback). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute up gesture operation(callback). + */ + it('GestureSimulation_0250', 1, async function (done) { + var caseCode = 'GestureSimulation_0250' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0260 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute up gesture operation(promise). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute up gesture operation(promise). + */ + it('GestureSimulation_0260', 1, async function (done) { + var caseCode = 'GestureSimulation_0260' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0270 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute upThenLeft gesture operation(callback). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute upThenLeft gesture operation(callback). + */ + it('GestureSimulation_0270', 1, async function (done) { + var caseCode = 'GestureSimulation_0270' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0280 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute upThenLeft gesture operation(promise). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute upThenLeft gesture operation(promise). + */ + it('GestureSimulation_0280', 1, async function (done) { + var caseCode = 'GestureSimulation_0280' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0290 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute upThenRight gesture operation(callback). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute upThenRight gesture operation(callback). + */ + it('GestureSimulation_0290', 1, async function (done) { + var caseCode = 'GestureSimulation_0290' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0300 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute upThenRight gesture operation(promise). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute upThenRight gesture operation(promise). + */ + it('GestureSimulation_0300', 1, async function (done) { + var caseCode = 'GestureSimulation_0300' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0310 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute upThenDown gesture operation(callback). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute upThenDown gesture operation(callback). + */ + it('GestureSimulation_0310', 1, async function (done) { + var caseCode = 'GestureSimulation_0310' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0320 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute upThenDown gesture operation(promise). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute upThenDown gesture operation(promise). + */ + it('GestureSimulation_0320', 1, async function (done) { + var caseCode = 'GestureSimulation_0320' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0330 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute down gesture operation(callback). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute down gesture operation(callback). + */ + it('GestureSimulation_0330', 1, async function (done) { + var caseCode = 'GestureSimulation_0330' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0340 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute down gesture operation(promise). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute down gesture operation(promise). + */ + it('GestureSimulation_0340', 1, async function (done) { + var caseCode = 'GestureSimulation_0340' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0350 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute downThenLeft gesture operation(callback). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute downThenLeft gesture operation(callback). + */ + it('GestureSimulation_0350', 1, async function (done) { + var caseCode = 'GestureSimulation_0350' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0360 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute downThenLeft gesture operation(promise). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute downThenLeft gesture operation(promise). + */ + it('GestureSimulation_0360', 1, async function (done) { + var caseCode = 'GestureSimulation_0360' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0370 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute downThenRight gesture operation(callback). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute downThenRight gesture operation(callback). + */ + it('GestureSimulation_0370', 1, async function (done) { + var caseCode = 'GestureSimulation_0370' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0380 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute downThenRight gesture operation(promise). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute downThenRight gesture operation(promise). + */ + it('GestureSimulation_0380', 1, async function (done) { + var caseCode = 'GestureSimulation_0380' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0390 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute downThenUp gesture operation(callback). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute downThenUp gesture operation(callback). + */ + it('GestureSimulation_0390', 1, async function (done) { + var caseCode = 'GestureSimulation_0390' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0400 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute downThenUp gesture operation(promise). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute downThenUp gesture operation(promise). + */ + it('GestureSimulation_0400', 1, async function (done) { + var caseCode = 'GestureSimulation_0400' + publish(caseCode) + setTimeout(()=>{ + let tarData = tarResult.get(caseCode) + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + caseCode + ' tarData: ' + tarData + ' assData: ' + assData + ' expect assertTrue') + disableAbility(LOG_PREFIX, ASSIST_BUNDLE_NAME) + setTimeout(()=>enableAbility(LOG_PREFIX, ASSIST_BUNDLE_NAME, ['retrieve']), 600) + expect(tarData).assertTrue() + expect(assData).assertTrue() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0410 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute up gesture operation(callback). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute up gesture operation(callback). + */ + it('GestureSimulation_0410', 1, async function (done) { + var caseCode = 'GestureSimulation_0410' + publish(caseCode) + setTimeout(()=>{ + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + 'GestureSimulation_0410 assData: ' + assData + ' expect assertFalse') + expect(assData).assertFalse() + done() + }, TIME_OUT) + }) + /** + * @tc.number: GestureSimulation_0420 + * @tc.name: The auxiliary application simulates gesture operation to trigger the target application to execute up gesture operation(promise). + * @tc.desc: The auxiliary application simulates gesture operation to trigger the target application to execute up gesture operation(promise). + */ + it('GestureSimulation_0420', 1, async function (done) { + var caseCode = 'GestureSimulation_0420' + publish(caseCode) + setTimeout(()=>{ + let assData = assResult.get(caseCode) + console.info(LOG_PREFIX + 'GestureSimulation_0420 assData: ' + assData + ' expect assertFalse') + expect(assData).assertFalse() + done() + }, TIME_OUT) + }) + + }) + + function enableAbility(logTag, bundleName, capability) { + config.enableAbility(bundleName, capability).then(() => { + console.info(logTag + 'enableAbility success.') + }).catch((error) => { + console.info(logTag + 'enableAbility failed. Cause: ' + JSON.stringify(error)) + return + }) + } + + function disableAbility(logTag, bundleName) { + config.disableAbility(bundleName).then(() => { + console.info(logTag + 'disableAbility success.') + }).catch((error) => { + console.info(logTag + 'disableAbility failed. Cause: ' + JSON.stringify(error)) + return + }) + } + + function publish(caseCode) { + let commonEventPublishData = { + data: caseCode + } + try { + commonEvent.publish(EVENT_NAME, commonEventPublishData, (err, data) => { + if (err && err.code != 0) { + console.info(LOG_PREFIX + caseCode + ' failed to publish because ' + JSON.stringify(err)) + return + } + console.info(LOG_PREFIX + caseCode + ' success publish') + prompt.showToast({ + message: 'CASE ' + caseCode + }) + }) + } catch (e) { + console.info(LOG_PREFIX + caseCode + ' error to publish because ' + JSON.stringify(e)) + } + } +} \ No newline at end of file diff --git a/barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/ets/test/List.test.ets b/barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 000000000..cb35098ac --- /dev/null +++ b/barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import abilityTest from './Ability.test' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/module.json b/barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/module.json new file mode 100644 index 000000000..795bfb8f3 --- /dev/null +++ b/barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/module.json @@ -0,0 +1,68 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "com.example.gesturesimulationtest.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "srcEntrance": "./ets/ServiceExtAbility/ServiceExtAbility.ts", + "name": "ServiceExtAbility", + "icon": "$media:icon", + "description": "$string:description_serviceability", + "type": "accessibility", + "visible": true, + "metadata": [ + { + "name": "ohos.accessibleability", + "resource": "$profile:accessibility_config" + } + ], + "permissions": ["ohos.permission.GET_BUNDLE_INFO"] + } + ], + "requestPermissions": [ + { + "name": "ohos.permission.SYSTEM_FLOAT_WINDOW", + "reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW" + }, + { + "name": "ohos.permission.CAPTURE_SCREEN", + "reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW" + }, + { + "name": "ohos.permission.WRITE_ACCESSIBILITY_CONFIG", + "reason": "need use ohos.permission.WRITE_ACCESSIBILITY_CONFIG" + } + ] + } +} diff --git a/barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/resources/base/element/string.json b/barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/resources/base/element/string.json new file mode 100644 index 000000000..eb31713f2 --- /dev/null +++ b/barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "GestureSimulationTest entry" + }, + { + "name": "MainAbility_desc", + "value": "GestureSimulationTest MainAbility" + }, + { + "name": "MainAbility_label", + "value": "GestureSimulationTest" + }, + { + "name": "description_serviceability", + "value": "Gesture后台服务" + }, + { + "name": "form_description", + "value": "Gesture辅助应用" + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/resources/base/media/icon.png b/barrierfree/accessibletest/actsgesturesimulationtest/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpBl$qoSA!PUg~PA65-S00{{S`XKG6NkG0RgjEntPrmV+?0|00mu7;+5 zrdpa{2QLqPJ4Y{j7=Mrl{BaxrkdY69+c~(w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