提交 fc25f9ce 编写于 作者: Mupceet's avatar Mupceet

无障碍功能测试errorCode处理

Signed-off-by: Mupceet's avatarMupceet <mupceet@gmail.com>
上级 884a0488
......@@ -19,6 +19,7 @@ group("actsaccessibletest") {
deps = [
"actsabilitylisttest:ActsAbilityListTest",
"actscaptionconfigurationtest:ActsCaptionConfigurationTest",
"actsgesturesimulationtest:ActsGestureSimulationTest",
"sceneProject/accessibilityAudibleAbility:accessibilityAudibleAbility",
"sceneProject/accessibilityGenericAbility:accessibilityGenericAbility",
"sceneProject/accessibilityHapticAbility:accessibilityHapticAbility",
......
{
"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
}
}
}
{
"string": [
{
"name": "app_name",
"value": "GestureSimulationTest"
}
]
}
# 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsGestureSimulationTest") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":accessible_js_assets",
":accessible_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsGestureSimulationTest"
subsystem_name = "barrierfree"
part_name = "accessibility"
}
ohos_app_scope("accessible_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("accessible_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("accessible_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":accessible_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "400000",
"bundle-name": "com.example.gesturesimulationtest",
"module-name": "phone",
"shell-timeout": "600000",
"testcase-timeout": 70000
},
"kits": [
{
"test-file-name": [
"ActsGestureSimulationTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"param set persist.ace.testmode.enabled 1"
],
"teardown-command":[
"bm uninstall -n com.example.gesturesimulationtest"
]
}
]
}
/*
* 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 AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.info("[GestureSimulationTest] MyAbilityStage onCreate")
globalThis.stageOnCreateRun = 1
globalThis.stageContext = this.context
}
}
\ No newline at end of file
/*
* 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
import Ability from '@ohos.application.Ability'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
// Ability is creating, initialize resources for this ability
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
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("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
globalThis.windowStage = windowStage
globalThis.abilityContext = this.context
windowStage.setUIContent(this.context, "MainAbility/pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};
/*
* 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 file from '@system.file'
import prompt from '@system.prompt'
import commonEvent from '@ohos.commonEvent'
const LOG_PREFIX = '[CQH-GESTURE-TARGET-1]'
const EVENT_NAME_BACK = 'on_target_change_extra'
const CommonEventSubscribeInfo = {
events: ['on_assist_change']
}
@Entry
@Component
struct Index {
@State message: string = 'GestureSimulationTest'
private caseCode: string = ''
private scroller: Scroller = new Scroller()
private context2D: CanvasRenderingContext2D = new CanvasRenderingContext2D()
private swiperController: SwiperController = new SwiperController()
private arr: string[] = ["列表文本1", "列表文本2", "列表文本3", "列表文本4", "列表文本5", "列表文本6", "列表文本7",
"列表文本8", "列表文本9", "列表文本10", "列表文本11", "列表文本12", "列表文本13", "列表文本14", "列表文本15", "列表文本16",
"列表文本17", "列表文本18", "列表文本19", "列表文本20", "列表文本21", "列表文本22", "列表文本23", "列表文本24", "列表文本25",
"列表文本26", "列表文本27", "列表文本28", "列表文本29", "列表文本30"]
private Number: String[] = ['1', '2', '3']
private minNum: number = 0
private maxNum: number = 0
private addNum: number = 0
private notEnd: boolean = true
@State paintSize: number= 5
@State paintColor: Color = Color.Orange
@State pathInfoArray: PathInfo[]= new Array()
private subScriber = undefined
aboutToAppear() {
console.info('TargetApp aboutToAppear')
this.createSubscriber()
}
aboutToDisappear() {
console.info('TargetApp aboutToDisappear')
commonEvent.unsubscribe(this.subScriber)
this.subScriber = undefined
}
@Builder
Canvas() {
ForEach(this.pathInfoArray, (pathInfo) => 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
/*
* 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<string>) {
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
/*
* 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')
}
};
/*
* 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%')
}
}
/*
* 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')
}
};
/*
* 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<string, boolean> = new Map()
let assResult: Map<string, boolean> = 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
/*
* 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
{
"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"
}
]
}
}
{
"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
{
"accessibilityCapabilities": [
"retrieve",
"gesture"
],
"accessibilityCapabilityRationale": "a11y_rationale",
"settingsAbility": "com.example.myapplication.accessibilitySetting"
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册