diff --git a/barrierfree/BUILD.gn b/barrierfree/BUILD.gn index 9d59ff6843b2b4ea7da5f167291b96f8c2364436..6405b531d3bb0fc22bfdec254b36bf7686a802d7 100644 --- a/barrierfree/BUILD.gn +++ b/barrierfree/BUILD.gn @@ -17,11 +17,17 @@ group("barrierfree") { testonly = true if (is_standard_system) { deps = [ + "accessibilityconfig:ActsAccessibilityConfigTest", + "accessibilityelement:ActsAccessibilityElementTest", + "accessibilityevent:ActsAccessibilityEventTest", + "accessibilityextension:ActsAccessibilityExtensionTest", + "accessibilityextensioncontext:ActsAccessibilityExtensionContextTest", "accessibleabilitylist:ActsAccessibleAbilityListTest", "accessiblecaptionconfiguration:ActsAccessibleCaptionConfigurationTest", "accessiblecheckability:ActsAccessibleCheckAbilityTest", "accessibleregisterstate:ActsAccessibleRegisterStateTest", "accessiblesendevent:ActsAccessibleSendEventTest", + "targetProject/aceTest:aceTest", ] } } diff --git a/barrierfree/accessibilityconfig/AppScope/app.json b/barrierfree/accessibilityconfig/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..c56032d28250fe436c77d52a624702c89d1a5d07 --- /dev/null +++ b/barrierfree/accessibilityconfig/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.accessibilityconfig", + "vendor": "huawei", + "versionCode": 1000000, + "versionName": "1.0.0", + "debug": false, + "icon": "$media:icon", + "label": "$string:app_name", + "description": "$string:description_application", + "distributedNotificationEnabled": true, + "keepAlive": true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} \ No newline at end of file diff --git a/barrierfree/accessibilityconfig/AppScope/resources/base/element/string.json b/barrierfree/accessibilityconfig/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..2c46549041c0fbe208c580a5587b0dc9b5500dbd --- /dev/null +++ b/barrierfree/accessibilityconfig/AppScope/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + }, + { + "name": "mainability_description", + "value": "ETS_Phone_Empty Stage Ability" + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessibilityconfig/AppScope/resources/base/media/app_icon.png b/barrierfree/accessibilityconfig/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibilityconfig/AppScope/resources/base/media/app_icon.png differ diff --git a/barrierfree/accessibilityconfig/BUILD.gn b/barrierfree/accessibilityconfig/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..69dc77298b0f2aec3b5b108d068fd4e72e8df663 --- /dev/null +++ b/barrierfree/accessibilityconfig/BUILD.gn @@ -0,0 +1,40 @@ +# 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("ActsAccessibilityConfigTest") { + hap_profile = "entry/src/main/module.json" + deps = [ + ":accessibilityconfig_js_assets", + ":accessibilityconfig_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsAccessibilityConfigTest" +} + +ohos_app_scope("accessibilityconfig_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("accessibilityconfig_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("accessibilityconfig_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":accessibilityconfig_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/barrierfree/accessibilityconfig/Test.json b/barrierfree/accessibilityconfig/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..c6b592b959dcf69c48fce927bff917c804e03fb0 --- /dev/null +++ b/barrierfree/accessibilityconfig/Test.json @@ -0,0 +1,24 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "180000", + "package": "com.example.accessibilityconfig", + "shell-timeout": "180000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAccessibilityConfigTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "teardown-command":[ + "bm uninstall -n com.example.accessibilityconfig" + ] + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessibilityconfig/entry/src/main/ets/Application/AbilityStage.ts b/barrierfree/accessibilityconfig/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..071c0d862407f266470cd7488a13b6bd745ee8fa --- /dev/null +++ b/barrierfree/accessibilityconfig/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,7 @@ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} diff --git a/barrierfree/accessibilityconfig/entry/src/main/ets/MainAbility/MainAbility.ts b/barrierfree/accessibilityconfig/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..e9c126eb7f2bb41f03a0bfc91f68a8568e38c8f8 --- /dev/null +++ b/barrierfree/accessibilityconfig/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,38 @@ +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; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate windowStage=" + windowStage) + //globalThis.windowStage = windowStage + //globalThis.abilityStorage = this.storage + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index/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") + } +}; \ No newline at end of file diff --git a/barrierfree/accessibilityconfig/entry/src/main/ets/pages/index/index.ets b/barrierfree/accessibilityconfig/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..d45c30711626494a6cf3dae2aa6f3f5bfa94f044 --- /dev/null +++ b/barrierfree/accessibilityconfig/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,56 @@ +/* + * 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 {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index" +import testsuite from "../../test/List.test" + +@Entry +@Component +struct Index { + @State message: string = 'Hello World'; + + aboutToAppear(){ + console.info("start run testcase!!!!"); + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)); + globalThis.abilityWant.parameters.timeout = 70000; + configService.setConfig(globalThis.abilityWant.parameters); + testsuite(globalThis.abilityContext); + core.execute(); + } + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/barrierfree/accessibilityconfig/entry/src/main/ets/test/AccessibilityConfig.test.ets b/barrierfree/accessibilityconfig/entry/src/main/ets/test/AccessibilityConfig.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a30566f31afe041cdbd7cad02f665bbfac429242 --- /dev/null +++ b/barrierfree/accessibilityconfig/entry/src/main/ets/test/AccessibilityConfig.test.ets @@ -0,0 +1,489 @@ +/* + * 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 'deccjsunit/index' +import config from '@ohos.accessibility.config' + +export default function abilityTest(abilityContext) { + describe('AccessibilityConfigTest', function () { + + beforeEach(async function (done) { + console.info(`AccessibilityConfigTest: beforeEach starts`); + done(); + }) + + afterEach(async function (done) { + console.info(`AccessibilityConfigTest: afterEach starts`); + setTimeout(done, 1000); + }) + + /* + * @tc.number AccessibilityConfigTest_enableAbility_asyncCallback_9300 + * @tc.name AccessibilityConfigTest_enableAbility_asyncCallback_9300 + * @tc.desc Test enableAbility() function in callback mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_enableAbility_asyncCallback_9300', 0, async function(done) { + console.info('AccessibilityConfigTest_enableAbility_asyncCallback_9300'); + let name = ''; + let capability = []; + config.enableAbility(name, capability, (err) => { + console.info(`AccessibilityConfigTest_enableAbility_asyncCallback_9300 error: ${JSON.stringify(err)}`); + if (err.code != 0) { + expect(true).assertTrue(); + } else { + expect(null).assertFail(); + } + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_enableAbility_asyncCallback_9400 + * @tc.name AccessibilityConfigTest_enableAbility_asyncCallback_9400 + * @tc.desc Test enableAbility() function in callback mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_enableAbility_asyncCallback_9400', 0, async function(done) { + console.info('AccessibilityConfigTest_enableAbility_asyncCallback_9400'); + let name = 'test'; + let capability = ['retrieve']; + config.enableAbility(name, capability, (err) => { + console.info(`AccessibilityConfigTest_enableAbility_asyncCallback_9400 error: ${JSON.stringify(err)}`); + if (err.code != 0) { + expect(true).assertTrue(); + } else { + expect(null).assertFail(); + } + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_enableAbility_asyncCallback_9500 + * @tc.name AccessibilityConfigTest_enableAbility_asyncCallback_9500 + * @tc.desc Test enableAbility() function in callback mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_enableAbility_asyncCallback_9500', 0, async function(done) { + console.info('AccessibilityConfigTest_enableAbility_asyncCallback_9500'); + let name = 'test.com'; + let capability = ['retrieve', 'touchGuide']; + config.enableAbility(name, capability, (err) => { + console.info(`AccessibilityConfigTest_enableAbility_asyncCallback_9500 error: ${JSON.stringify(err)}`); + if (err.code != 0) { + expect(true).assertTrue(); + } else { + expect(null).assertFail(); + } + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_enableAbility_asyncCallback_9600 + * @tc.name AccessibilityConfigTest_enableAbility_asyncCallback_9600 + * @tc.desc Test enableAbility() function in callback mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_enableAbility_asyncCallback_9600', 0, async function(done) { + console.info('AccessibilityConfigTest_enableAbility_asyncCallback_9600'); + let name = 'com.test'; + let capability = ['retrieve', 'touchGuide', 'keyEventObserver']; + config.enableAbility(name, capability, (err) => { + console.info(`AccessibilityConfigTest_enableAbility_asyncCallback_9600 error: ${JSON.stringify(err)}`); + if (err.code != 0) { + expect(true).assertTrue(); + } else { + expect(null).assertFail(); + } + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_enableAbility_asyncCallback_9700 + * @tc.name AccessibilityConfigTest_enableAbility_asyncCallback_9700 + * @tc.desc Test enableAbility() function in callback mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_enableAbility_asyncCallback_9700', 0, async function(done) { + console.info('AccessibilityConfigTest_enableAbility_asyncCallback_9700'); + let name = 'com.'; + let capability = ['retrieve', 'touchGuide', 'keyEventObserver', 'zoom', 'gesture']; + config.enableAbility(name, capability, (err) => { + console.info(`AccessibilityConfigTest_enableAbility_asyncCallback_9700 error: ${JSON.stringify(err)}`); + if (err.code != 0) { + expect(true).assertTrue(); + } else { + expect(null).assertFail(); + } + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_enableAbility_asyncPromise_9800 + * @tc.name AccessibilityConfigTest_enableAbility_asyncPromise_9800 + * @tc.desc Test enableAbility() function in promise mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_enableAbility_asyncPromise_9800', 0, async function(done) { + console.info('AccessibilityConfigTest_enableAbility_asyncPromise_9800'); + let name = ''; + let capability = []; + config.enableAbility(name, capability).then(() => { + console.info('AccessibilityConfigTest_enableAbility_asyncPromise_9800 result back'); + expect(null).assertFail(); + done(); + }).catch((err) => { + console.error(`AccessibilityConfigTest_enableAbility_asyncPromise_9800 has error: ${JSON.stringify(err)}`); + expect(true).assertTrue(); + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_enableAbility_asyncPromise_9900 + * @tc.name AccessibilityConfigTest_enableAbility_asyncPromise_9900 + * @tc.desc Test enableAbility() function in promise mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_enableAbility_asyncPromise_9900', 0, async function(done) { + console.info('AccessibilityConfigTest_enableAbility_asyncPromise_9900'); + let name = 'test'; + let capability = ['retrieve']; + config.enableAbility(name, capability).then(() => { + console.info('AccessibilityConfigTest_enableAbility_asyncPromise_9900 result back'); + expect(null).assertFail(); + done(); + }).catch((err) => { + console.error(`AccessibilityConfigTest_enableAbility_asyncPromise_9900 has error: ${JSON.stringify(err)}`); + expect(true).assertTrue(); + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_enableAbility_asyncPromise_10000 + * @tc.name AccessibilityConfigTest_enableAbility_asyncPromise_10000 + * @tc.desc Test enableAbility() function in promise mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_enableAbility_asyncPromise_10000', 0, async function(done) { + console.info('AccessibilityConfigTest_enableAbility_asyncPromise_10000'); + let name = 'test.com'; + let capability = ['retrieve', 'touchGuide']; + config.enableAbility(name, capability).then(() => { + console.info('AccessibilityConfigTest_enableAbility_asyncPromise_10000 result back'); + expect(null).assertFail(); + done(); + }).catch((err) => { + console.error(`AccessibilityConfigTest_enableAbility_asyncPromise_10000 has error: ${JSON.stringify(err)}`); + expect(true).assertTrue(); + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_enableAbility_asyncPromise_10100 + * @tc.name AccessibilityConfigTest_enableAbility_asyncPromise_10100 + * @tc.desc Test enableAbility() function in promise mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_enableAbility_asyncPromise_10100', 0, async function(done) { + console.info('AccessibilityConfigTest_enableAbility_asyncPromise_10100'); + let name = 'com.test'; + let capability = ['retrieve', 'touchGuide', 'keyEventObserver']; + config.enableAbility(name, capability).then(() => { + console.info('AccessibilityConfigTest_enableAbility_asyncPromise_10100 result back'); + expect(null).assertFail(); + done(); + }).catch((err) => { + console.error(`AccessibilityConfigTest_enableAbility_asyncPromise_10100 has error: ${JSON.stringify(err)}`); + expect(true).assertTrue(); + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_enableAbility_asyncPromise_10200 + * @tc.name AccessibilityConfigTest_enableAbility_asyncPromise_10200 + * @tc.desc Test enableAbility() function in promise mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_enableAbility_asyncPromise_10200', 0, async function(done) { + console.info('AccessibilityConfigTest_enableAbility_asyncPromise_10200'); + let name = 'com.'; + let capability = ['retrieve', 'touchGuide', 'keyEventObserver', 'zoom', 'gesture']; + config.enableAbility(name, capability).then(() => { + console.info('AccessibilityConfigTest_enableAbility_asyncPromise_10200 result back'); + expect(null).assertFail(); + done(); + }).catch((err) => { + console.error(`AccessibilityConfigTest_enableAbility_asyncPromise_10200 has error: ${JSON.stringify(err)}`); + expect(true).assertTrue(); + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_disableAbility_asyncCallback_10300 + * @tc.name AccessibilityConfigTest_disableAbility_asyncCallback_10300 + * @tc.desc Test disableAbility() function in callback mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_disableAbility_asyncCallback_10300', 0, async function(done) { + console.info('AccessibilityConfigTest_disableAbility_asyncCallback_10300'); + let name = ''; + config.disableAbility(name, (err) => { + console.info(`AccessibilityConfigTest_disableAbility_asyncCallback_10300 err: ${JSON.stringify(err)}`); + if (err.code != 0) { + expect(true).assertTrue(); + } else { + expect(null).assertFail(); + } + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_disableAbility_asyncCallback_10400 + * @tc.name AccessibilityConfigTest_disableAbility_asyncCallback_10400 + * @tc.desc Test disableAbility() function in callback mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_disableAbility_asyncCallback_10400', 0, async function(done) { + console.info('AccessibilityConfigTest_disableAbility_asyncCallback_10400'); + let name = 'test'; + config.disableAbility(name, (err) => { + console.info(`AccessibilityConfigTest_disableAbility_asyncCallback_10400 err: ${JSON.stringify(err)}`); + if (err.code != 0) { + expect(true).assertTrue(); + } else { + expect(null).assertFail(); + } + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_disableAbility_asyncCallback_10500 + * @tc.name AccessibilityConfigTest_disableAbility_asyncCallback_10500 + * @tc.desc Test disableAbility() function in callback mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_disableAbility_asyncCallback_10500', 0, async function(done) { + console.info('AccessibilityConfigTest_disableAbility_asyncCallback_10500'); + let name = 'test.com'; + config.disableAbility(name, (err) => { + console.info(`AccessibilityConfigTest_disableAbility_asyncCallback_10500 err: ${JSON.stringify(err)}`); + if (err.code != 0) { + expect(true).assertTrue(); + } else { + expect(null).assertFail(); + } + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_disableAbility_asyncCallback_10600 + * @tc.name AccessibilityConfigTest_disableAbility_asyncCallback_10600 + * @tc.desc Test disableAbility() function in callback mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_disableAbility_asyncCallback_10600', 0, async function(done) { + console.info('AccessibilityConfigTest_disableAbility_asyncCallback_10600'); + let name = 'com.test'; + config.disableAbility(name, (err) => { + console.info(`AccessibilityConfigTest_disableAbility_asyncCallback_10600 err: ${JSON.stringify(err)}`); + if (err.code != 0) { + expect(true).assertTrue(); + } else { + expect(null).assertFail(); + } + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_disableAbility_asyncCallback_10700 + * @tc.name AccessibilityConfigTest_disableAbility_asyncCallback_10700 + * @tc.desc Test disableAbility() function in callback mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_disableAbility_asyncCallback_10700', 0, async function(done) { + console.info('AccessibilityConfigTest_disableAbility_asyncCallback_10700'); + let name = 'com.'; + config.disableAbility(name, (err) => { + console.info(`AccessibilityConfigTest_disableAbility_asyncCallback_10700 err: ${JSON.stringify(err)}`); + if (err.code != 0) { + expect(true).assertTrue(); + } else { + expect(null).assertFail(); + } + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_disableAbility_asyncPromise_10800 + * @tc.name AccessibilityConfigTest_disableAbility_asyncPromise_10800 + * @tc.desc Test disableAbility() function in promise mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_disableAbility_asyncPromise_10800', 0, async function(done) { + console.info('AccessibilityConfigTest_disableAbility_asyncPromise_10800'); + let name = ''; + config.disableAbility(name).then(() => { + console.info('AccessibilityConfigTest_disableAbility_asyncPromise_10800 result back'); + expect(null).assertFail(); + done(); + }).catch((err) => { + console.error(`AccessibilityConfigTest_disableAbility_asyncPromise_10800 has error: ${JSON.stringify(err)}`); + expect(true).assertTrue(); + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_disableAbility_asyncPromise_10900 + * @tc.name AccessibilityConfigTest_disableAbility_asyncPromise_10900 + * @tc.desc Test disableAbility() function in promise mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_disableAbility_asyncPromise_10900', 0, async function(done) { + console.info('AccessibilityConfigTest_disableAbility_asyncPromise_10900'); + let name = 'test'; + config.disableAbility(name).then(() => { + console.info('AccessibilityConfigTest_disableAbility_asyncPromise_10900 result back'); + expect(null).assertFail(); + done(); + }).catch((err) => { + console.error(`AccessibilityConfigTest_disableAbility_asyncPromise_10900 has error: ${JSON.stringify(err)}`); + expect(true).assertTrue(); + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_disableAbility_asyncPromise_11000 + * @tc.name AccessibilityConfigTest_disableAbility_asyncPromise_11000 + * @tc.desc Test disableAbility() function in promise mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_disableAbility_asyncPromise_11000', 0, async function(done) { + console.info('AccessibilityConfigTest_disableAbility_asyncPromise_11000'); + let name = 'test.com'; + config.disableAbility(name).then(() => { + console.info('AccessibilityConfigTest_disableAbility_asyncPromise_11000 result back'); + expect(null).assertFail(); + done(); + }).catch((err) => { + console.error(`AccessibilityConfigTest_disableAbility_asyncPromise_11000 has error: ${JSON.stringify(err)}`); + expect(true).assertTrue(); + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_disableAbility_asyncPromise_11100 + * @tc.name AccessibilityConfigTest_disableAbility_asyncPromise_11100 + * @tc.desc Test disableAbility() function in promise mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_disableAbility_asyncPromise_11100', 0, async function(done) { + console.info('AccessibilityConfigTest_disableAbility_asyncPromise_11100'); + let name = 'com.test'; + config.disableAbility(name).then(() => { + console.info('AccessibilityConfigTest_disableAbility_asyncPromise_11100 result back'); + expect(null).assertFail(); + done(); + }).catch((err) => { + console.error(`AccessibilityConfigTest_disableAbility_asyncPromise_11100 has error: ${JSON.stringify(err)}`); + expect(true).assertTrue(); + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_disableAbility_asyncPromise_11200 + * @tc.name AccessibilityConfigTest_disableAbility_asyncPromise_11200 + * @tc.desc Test disableAbility() function in promise mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_disableAbility_asyncPromise_11200', 0, async function(done) { + console.info('AccessibilityConfigTest_disableAbility_asyncPromise_11200'); + let name = 'com.'; + config.disableAbility(name).then(() => { + console.info('AccessibilityConfigTest_disableAbility_asyncPromise_11200 result back'); + expect(null).assertFail(); + done(); + }).catch((err) => { + console.error(`AccessibilityConfigTest_disableAbility_asyncPromise_11200 has error: ${JSON.stringify(err)}`); + expect(true).assertTrue(); + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_on_asyncCallback_11300 + * @tc.name AccessibilityConfigTest_on_asyncCallback_11300 + * @tc.desc Test on() function in callback mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_on_asyncCallback_11300', 0, async function(done) { + console.info('AccessibilityConfigTest_on_asyncCallback_11300'); + let ret = config.on('enableAbilityListsStateChanged', (data) => {}); + expect(ret).assertEqual(undefined); + done(); + }) + + /* + * @tc.number AccessibilityConfigTest_off_asyncCallback_11400 + * @tc.name AccessibilityConfigTest_off_asyncCallback_11400 + * @tc.desc Test off() function in callback mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_off_asyncCallback_11400', 0, async function(done) { + console.info('AccessibilityConfigTest_off_asyncCallback_11400'); + let ret = config.off('enableAbilityListsStateChanged', (data) => {}); + expect(ret).assertEqual(undefined); + done(); + }) + }) +} \ No newline at end of file diff --git a/barrierfree/accessibilityconfig/entry/src/main/ets/test/List.test.ets b/barrierfree/accessibilityconfig/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ee66692b52255bc69ddec15a3f8919a8caaa4898 --- /dev/null +++ b/barrierfree/accessibilityconfig/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 './AccessibilityConfig.test.ets' + +export default function testsuite(abilityContext) { + abilityTest(abilityContext) +} \ No newline at end of file diff --git a/barrierfree/accessibilityconfig/entry/src/main/module.json b/barrierfree/accessibilityconfig/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..69501f617c648474e7cfadad8f5fdb64fdc73f7c --- /dev/null +++ b/barrierfree/accessibilityconfig/entry/src/main/module.json @@ -0,0 +1,33 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [{ + "name": "com.example.accessibilityconfig.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "visible": true, + "orientation": "portrait", + "skills": [{ + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + }] + }] + } +} \ No newline at end of file diff --git a/barrierfree/accessibilityconfig/entry/src/main/resources/base/element/string.json b/barrierfree/accessibilityconfig/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..eb6f24dd58e2e4b664a1ea53719a2754b68107d7 --- /dev/null +++ b/barrierfree/accessibilityconfig/entry/src/main/resources/base/element/string.json @@ -0,0 +1,40 @@ +{ + "string": [ + { + "name": "phone_entry_dsc", + "value": "i am an entry for phone" + }, + { + "name": "phone_entry_main", + "value": "the phone entry ability" + }, + { + "name": "entry_label", + "value": "ActsAccessibilityConfigTest" + }, + { + "name": "form_description", + "value": "my form" + }, + { + "name": "serviceability_description", + "value": "my whether" + }, + { + "name": "description_application", + "value": "demo for test" + }, + { + "name": "app_name", + "value": "Demo" + }, + { + "name": "Accessibility_desc", + "value": "accessibility_description" + }, + { + "name": "Accessibility_label", + "value": "accessibility_label" + } + ] +} diff --git a/barrierfree/accessibilityconfig/entry/src/main/resources/base/media/icon.png b/barrierfree/accessibilityconfig/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibilityconfig/entry/src/main/resources/base/media/icon.png differ diff --git a/barrierfree/accessibilityconfig/entry/src/main/resources/base/profile/main_pages.json b/barrierfree/accessibilityconfig/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..360bf0b466d749ca4f3bb1c37f14d8e6427222eb --- /dev/null +++ b/barrierfree/accessibilityconfig/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index/index" + ] +} \ No newline at end of file diff --git a/barrierfree/accessibilityconfig/signature/openharmony_sx.p7b b/barrierfree/accessibilityconfig/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..7ffcdc78527c5c1aa24520ab7e913c5f47c703f0 Binary files /dev/null and b/barrierfree/accessibilityconfig/signature/openharmony_sx.p7b differ diff --git a/barrierfree/accessibilityelement/AppScope/app.json b/barrierfree/accessibilityelement/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..2c223fed485d736ab9906abf778f3d48eeb6c7cf --- /dev/null +++ b/barrierfree/accessibilityelement/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.myapplication", + "vendor": "huawei", + "versionCode": 1000000, + "versionName": "1.0.0", + "debug": false, + "icon": "$media:icon", + "label": "$string:app_name", + "description": "$string:description_application", + "distributedNotificationEnabled": true, + "keepAlive": true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} \ No newline at end of file diff --git a/barrierfree/accessibilityelement/AppScope/resources/base/element/string.json b/barrierfree/accessibilityelement/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..2bce00fe92ed1792896bfc5aa9f0411e2ce5fea9 --- /dev/null +++ b/barrierfree/accessibilityelement/AppScope/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + }, + { + "name": "mainability_description", + "value": "ETS_Phone_Empty Stage Ability" + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessibilityelement/AppScope/resources/base/media/app_icon.png b/barrierfree/accessibilityelement/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibilityelement/AppScope/resources/base/media/app_icon.png differ diff --git a/barrierfree/accessibilityelement/BUILD.gn b/barrierfree/accessibilityelement/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..d619520b771e3d206babf53ea170c1a883d13dc3 --- /dev/null +++ b/barrierfree/accessibilityelement/BUILD.gn @@ -0,0 +1,41 @@ +# 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("ActsAccessibilityElementTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":accessibilityelement_js_assets", + ":accessibilityelement_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsAccessibilityElementTest" +} + +ohos_app_scope("accessibilityelement_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("accessibilityelement_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("accessibilityelement_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":accessibilityelement_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/barrierfree/accessibilityelement/Test.json b/barrierfree/accessibilityelement/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..3e17f7e7f3625d3f75e3b4d31e84b587293c6f3b --- /dev/null +++ b/barrierfree/accessibilityelement/Test.json @@ -0,0 +1,26 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "600000", + "package": "com.example.myapplication", + "shell-timeout": "600000" + }, + "kits": [ + { + "test-file-name": [ + "aceTest.hap", + "ActsAccessibilityElementTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "teardown-command":[ + "bm uninstall -n com.example.myapplication", + "bm uninstall -n com.example.acetest" + ] + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessibilityelement/entry/src/main/ets/AccessibilityExtAbility/AccessibilityExtAbility.ts b/barrierfree/accessibilityelement/entry/src/main/ets/AccessibilityExtAbility/AccessibilityExtAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..a8b93c4bc91b76a498616f7dc1f246de16de5e6e --- /dev/null +++ b/barrierfree/accessibilityelement/entry/src/main/ets/AccessibilityExtAbility/AccessibilityExtAbility.ts @@ -0,0 +1,62 @@ +/* + * 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 commonEvent from '@ohos.commonEvent'; +import {ElementTest} from './ElementTest'; + +class AccessibilityExtAbility extends AccessibilityExtensionAbility { + tester: any = undefined; + + onConnect() { + console.info("[Demo] AccessibilityExtAbility onConnect"); + this.tester = new ElementTest(this.context); + this.tester.init(); + + let commonEventPublishData = { + data: 'connect' + } + commonEvent.publish('onConnectState', commonEventPublishData, publishCallback); + + function publishCallback(err) { + console.info("onConnect====>onConnect publish call back result:" + JSON.stringify(err)); + } + + this.context.setEventTypeFilter(['click']); + } + + onDisconnect() { + console.info("[Demo] AccessibilityExtAbility onDisconnect"); + let commonEventPublishData = { + data: 'disconnect' + } + commonEvent.publish('onConnectState', commonEventPublishData, publishCallback); + + function publishCallback(err) { + console.info("onDisconnect====>onConnect publish call back result:" + JSON.stringify(err)); + } + + this.tester.clear(); + this.tester = undefined; + } + + onAccessibilityEvent(accessibilityEvent) { + console.info("[Demo] AccessibilityExtAbility onAccessibilityEvent: " + JSON.stringify(accessibilityEvent)); + if (this.tester) { + this.tester.pushEvent(accessibilityEvent); + } + } +} + +export default AccessibilityExtAbility; \ No newline at end of file diff --git a/barrierfree/accessibilityelement/entry/src/main/ets/AccessibilityExtAbility/ElementTest.ts b/barrierfree/accessibilityelement/entry/src/main/ets/AccessibilityExtAbility/ElementTest.ts new file mode 100644 index 0000000000000000000000000000000000000000..58a0fdd6ee6b8312cc65a71cee0ab55521d223e9 --- /dev/null +++ b/barrierfree/accessibilityelement/entry/src/main/ets/AccessibilityExtAbility/ElementTest.ts @@ -0,0 +1,1052 @@ +/* + * 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 commonEvent from '@ohos.commonEvent'; +import accessibility from '@ohos.accessibility'; + +const invalidString = 'xxx'; + +export class ElementTest { + private context = undefined; + private subScriber = undefined; + private events: Array = []; + + constructor(context) { + this.context = context; + } + + async init() { + this.subScriber = await commonEvent.createSubscriber({events: ['caseExecute']}); + commonEvent.subscribe(this.subScriber, (err, data) => { + console.info('ElementTest subscribe callback data:' + JSON.stringify(data)); + this.processCase(data); + }); + } + + clear() { + commonEvent.unsubscribe(this.subScriber); + this.subScriber = undefined; + this.context = undefined; + this.events.length = 0; + } + + pushEvent(event) { + this.events.push(event); + } + + private publishCaseResult(caseName: string, result: boolean) { + let commonEventPublishData = { + data: (result ? 'pass' : 'fail'), + parameters: { + case: caseName + } + } + commonEvent.publish('caseResult', commonEventPublishData, (err) => { + console.info("ElementTest publishCaseResult finish: " + JSON.stringify(commonEventPublishData)); + }); + } + + private async processCase(data) { + let caseName = data.data; + console.info('ElementTest processCase: ' + caseName); + this.events.length = 0; + let result = false; + switch (caseName) { + case 'AccessibilityElementTest_attributeNames_asyncPromise_0100': + result = await this.executeAttributeNamesPromise(caseName); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_0200': + result = await this.executeAttributeValuePromise(caseName, 'componentId', 'number'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_0300': + result = await this.executeAttributeValuePromise(caseName, 'pageId', 'number'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_0500': + result = await this.executeAttributeValuePromise(caseName, 'inspectorKey', 'string'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_0600': + result = await this.executeAttributeValuePromise(caseName, 'bundleName', 'string'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_0700': + result = await this.executeAttributeValuePromise(caseName, 'componentType', 'string'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_0800': + result = await this.executeAttributeValuePromise(caseName, 'inputType', 'number'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_0900': + result = await this.executeAttributeValuePromise(caseName, 'text', 'string'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_1000': + result = await this.executeAttributeValuePromise(caseName, 'hintText', 'string'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_1100': + result = await this.executeAttributeValuePromise(caseName, 'description', 'string'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_1200': + result = await this.executeAttributeValuePromise(caseName, 'resourceName', 'string'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_1400': + result = await this.executeAttributeValuePromise(caseName, 'textLengthLimit', 'number'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_1500': + result = await this.executeAttributeValuePromise(caseName, 'rect', 'object'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_1600': + result = await this.executeAttributeValuePromise(caseName, 'checkable', 'boolean'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_1700': + result = await this.executeAttributeValuePromise(caseName, 'checked', 'boolean'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_1800': + result = await this.executeAttributeValuePromise(caseName, 'focusable', 'boolean'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_1900': + result = await this.executeAttributeValuePromise(caseName, 'isVisible', 'boolean'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_2000': + result = await this.executeAttributeValuePromise(caseName, 'accessibilityFocused', 'boolean'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_2100': + result = await this.executeAttributeValuePromise(caseName, 'selected', 'boolean'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_2200': + result = await this.executeAttributeValuePromise(caseName, 'clickable', 'boolean'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_2300': + result = await this.executeAttributeValuePromise(caseName, 'longClickable', 'boolean'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_2400': + result = await this.executeAttributeValuePromise(caseName, 'isEnable', 'boolean'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_2500': + result = await this.executeAttributeValuePromise(caseName, 'isPassword', 'boolean'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_2600': + result = await this.executeAttributeValuePromise(caseName, 'scrollable', 'boolean'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_2700': + result = await this.executeAttributeValuePromise(caseName, 'editable', 'boolean'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_2900': + result = await this.executeAttributeValuePromise(caseName, 'pluralLineSupported', 'boolean'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_3100': + result = await this.executeAttributeValuePromise(caseName, 'isHint', 'boolean'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_3300': + result = await this.executeAttributeValuePromise(caseName, 'itemCount', 'number'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_3400': + result = await this.executeAttributeValuePromise(caseName, 'currentIndex', 'number'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_3500': + result = await this.executeAttributeValuePromise(caseName, 'startIndex', 'number'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_3600': + result = await this.executeAttributeValuePromise(caseName, 'endIndex', 'number'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_3700': + result = await this.executeAttributeValuePromise(caseName, 'rangeInfo', 'object'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_4200': + result = await this.executeAttributeValuePromise(caseName, 'error', 'string'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_4300': + await this.executeAttributeValuePromiseTriggerAction(caseName); + return; + case 'AccessibilityElementTest_attributeValue_asyncPromise_4400': + result = await this.executeAttributeValuePromise(caseName, 'textMoveUnit', 'string'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_4500': + result = await this.executeAttributeValuePromiseArray(caseName, 'contents', 'string'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_4600': + result = await this.executeAttributeValuePromise(caseName, 'lastContent', 'string'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_4700': + result = await this.executeAttributeValuePromise(caseName, 'parent', 'object'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_4800': + result = await this.executeAttributeValuePromiseArray(caseName, 'children', 'object'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_5200': + result = await this.executeAttributeValuePromise(caseName, 'isActive', 'boolean', true); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_5300': + result = await this.executeAttributeValuePromise(caseName, 'screenRect', 'object', true); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_5400': + result = await this.executeAttributeValuePromise(caseName, 'layer', 'number', true); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_5500': + result = await this.executeAttributeValuePromise(caseName, 'type', 'string', true); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_5600': + result = await this.executeAttributeValuePromiseRootElement(caseName); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_5700': + result = await this.executeAttributeValuePromise(caseName, 'windowId', 'number'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_5800': + result = await this.executeAttributeValuePromise(caseName, 'isFocused', 'boolean'); + break; + case 'AccessibilityElementTest_findElement_asyncPromise_5900': + result = await this.executeFindElementPromise5900(caseName); + break; + case 'AccessibilityElementTest_actionNames_asyncPromise_6000': + result = await this.executeActionNamesPromise(caseName); + break; + case 'AccessibilityElementTest_performAction_asyncPromise_6100': + result = await this.executePerformActionPromise(caseName, 'accessibilityFocus'); + break; + case 'AccessibilityElementTest_performAction_asyncPromise_6200': + result = await this.executePerformActionPromise(caseName, 'clearAccessibilityFocus'); + break; + case 'AccessibilityElementTest_performAction_asyncPromise_6300': + result = await this.executePerformActionPromise(caseName, 'focus'); + break; + case 'AccessibilityElementTest_performAction_asyncPromise_6400': + result = await this.executePerformActionPromise(caseName, 'clearFocus'); + break; + case 'AccessibilityElementTest_performAction_asyncPromise_6500': + result = await this.executePerformActionPromise(caseName, 'clearSelection'); + break; + case 'AccessibilityElementTest_performAction_asyncPromise_6600': + result = await this.executePerformActionPromise(caseName, 'click'); + break; + case 'AccessibilityElementTest_performAction_asyncPromise_6700': + result = await this.executePerformActionPromise(caseName, 'longClick'); + break; + case 'AccessibilityElementTest_performAction_asyncPromise_6800': + result = await this.executePerformActionPromise(caseName, 'cut'); + break; + case 'AccessibilityElementTest_performAction_asyncPromise_6900': + result = await this.executePerformActionPromise(caseName, 'copy'); + break; + case 'AccessibilityElementTest_performAction_asyncPromise_7000': + result = await this.executePerformActionPromise(caseName, 'paste'); + break; + case 'AccessibilityElementTest_performAction_asyncPromise_7100': + result = await this.executePerformActionPromise(caseName, 'select'); + break; + case 'AccessibilityElementTest_performAction_asyncPromise_7200': + result = await this.executePerformActionPromise(caseName, 'setText'); + break; + case 'AccessibilityElementTest_performAction_asyncPromise_7300': + result = await this.executePerformActionPromise(caseName, 'delete'); + break; + case 'AccessibilityElementTest_performAction_asyncPromise_7400': + result = await this.executePerformActionPromise(caseName, 'scrollForward'); + break; + case 'AccessibilityElementTest_performAction_asyncPromise_7500': + result = await this.executePerformActionPromise(caseName, 'scrollBackward'); + break; + case 'AccessibilityElementTest_performAction_asyncPromise_7600': + result = await this.executePerformActionPromise(caseName, 'setSelection'); + break; + case 'AccessibilityElementTest_findElement_asyncPromise_7700': + result = await this.executeFindElementPromiseByContent(caseName, 'xxx'); + break; + case 'AccessibilityElementTest_findElement_asyncPromise_7800': + result = await this.executeFindElementPromiseByContent(caseName, 'button1'); + break; + case 'AccessibilityElementTest_findElement_asyncPromise_7900': + result = await this.executeFindElementPromiseByFocusType(caseName, 'accessibility'); + break; + case 'AccessibilityElementTest_findElement_asyncPromise_8000': + result = await this.executeFindElementPromiseByFocusType(caseName, 'normal'); + break; + case 'AccessibilityElementTest_findElement_asyncPromise_8100': + result = await this.executeFindElementPromiseByFocusDirection(caseName, 'up'); + break; + case 'AccessibilityElementTest_findElement_asyncPromise_8200': + result = await this.executeFindElementPromiseByFocusDirection(caseName, 'down'); + break; + case 'AccessibilityElementTest_findElement_asyncPromise_8300': + result = await this.executeFindElementPromiseByFocusDirection(caseName, 'left'); + break; + case 'AccessibilityElementTest_findElement_asyncPromise_8400': + result = await this.executeFindElementPromiseByFocusDirection(caseName, 'right'); + break; + case 'AccessibilityElementTest_findElement_asyncPromise_8500': + result = await this.executeFindElementPromiseByFocusDirection(caseName, 'forward'); + break; + case 'AccessibilityElementTest_findElement_asyncPromise_8600': + result = await this.executeFindElementPromiseByFocusDirection(caseName, 'backward'); + break; + case 'AccessibilityElementTest_findElement_asyncPromise_8700': + result = await this.executeFindElementPromiseByFocusType(caseName, 'xxx'); + break; + case 'AccessibilityElementTest_findElement_asyncPromise_8800': + result = await this.executeFindElementPromiseByFocusDirection(caseName, 'xxx'); + break; + case 'AccessibilityElementTest_performAction_asyncPromise_8900': + result = await this.executePerformActionPromise(caseName, 'xxx'); + break; + case 'AccessibilityElementTest_attributeValue_asyncPromise_9000': + result = await this.executeAttributeValuePromise(caseName, 'xxx', ''); + break; + case 'AccessibilityElementTest_attributeNames_asyncCallback_0100': + await this.executeAttributeNamesCallback(caseName); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_0200': + await this.executeAttributeValueCallback(caseName, 'componentId', 'number'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_0300': + await this.executeAttributeValueCallback(caseName, 'pageId', 'number'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_0500': + await this.executeAttributeValueCallback(caseName, 'inspectorKey', 'string'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_0600': + await this.executeAttributeValueCallback(caseName, 'bundleName', 'string'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_0700': + await this.executeAttributeValueCallback(caseName, 'componentType', 'string'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_0800': + await this.executeAttributeValueCallback(caseName, 'inputType', 'number'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_0900': + await this.executeAttributeValueCallback(caseName, 'text', 'string'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_1000': + await this.executeAttributeValueCallback(caseName, 'hintText', 'string'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_1100': + await this.executeAttributeValueCallback(caseName, 'description', 'string'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_1200': + await this.executeAttributeValueCallback(caseName, 'resourceName', 'string'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_1400': + await this.executeAttributeValueCallback(caseName, 'textLengthLimit', 'number'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_1500': + await this.executeAttributeValueCallback(caseName, 'rect', 'object'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_1600': + await this.executeAttributeValueCallback(caseName, 'checkable', 'boolean'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_1700': + await this.executeAttributeValueCallback(caseName, 'checked', 'boolean'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_1800': + await this.executeAttributeValueCallback(caseName, 'focusable', 'boolean'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_1900': + await this.executeAttributeValueCallback(caseName, 'isVisible', 'boolean'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_2000': + await this.executeAttributeValueCallback(caseName, 'accessibilityFocused', 'boolean'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_2100': + await this.executeAttributeValueCallback(caseName, 'selected', 'boolean'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_2200': + await this.executeAttributeValueCallback(caseName, 'clickable', 'boolean'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_2300': + await this.executeAttributeValueCallback(caseName, 'longClickable', 'boolean'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_2400': + await this.executeAttributeValueCallback(caseName, 'isEnable', 'boolean'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_2500': + await this.executeAttributeValueCallback(caseName, 'isPassword', 'boolean'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_2600': + await this.executeAttributeValueCallback(caseName, 'scrollable', 'boolean'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_2700': + await this.executeAttributeValueCallback(caseName, 'editable', 'boolean'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_2900': + await this.executeAttributeValueCallback(caseName, 'pluralLineSupported', 'boolean'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_3100': + await this.executeAttributeValueCallback(caseName, 'isHint', 'boolean'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_3300': + await this.executeAttributeValueCallback(caseName, 'itemCount', 'number'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_3400': + await this.executeAttributeValueCallback(caseName, 'currentIndex', 'number'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_3500': + await this.executeAttributeValueCallback(caseName, 'startIndex', 'number'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_3600': + await this.executeAttributeValueCallback(caseName, 'endIndex', 'number'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_3700': + await this.executeAttributeValueCallback(caseName, 'rangeInfo', 'object'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_4200': + await this.executeAttributeValueCallback(caseName, 'error', 'string'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_4300': + await this.executeAttributeValueCallbackTriggerAction(caseName); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_4400': + await this.executeAttributeValueCallback(caseName, 'textMoveUnit', 'string'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_4500': + await this.executeAttributeValueCallbackArray(caseName, 'contents', 'string'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_4600': + await this.executeAttributeValueCallback(caseName, 'lastContent', 'string'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_4700': + await this.executeAttributeValueCallback(caseName, 'parent', 'object'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_4800': + await this.executeAttributeValueCallbackArray(caseName, 'children', 'object'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_5200': + await this.executeAttributeValueCallback(caseName, 'isActive', 'boolean', true); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_5300': + await this.executeAttributeValueCallback(caseName, 'screenRect', 'object', true); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_5400': + await this.executeAttributeValueCallback(caseName, 'layer', 'number', true); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_5500': + await this.executeAttributeValueCallback(caseName, 'type', 'string', true); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_5600': + await this.executeAttributeValueCallbackRootElement(caseName); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_5700': + await this.executeAttributeValueCallback(caseName, 'windowId', 'number'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_5800': + await this.executeAttributeValueCallback(caseName, 'isFocused', 'boolean'); + return; + case 'AccessibilityElementTest_findElement_asyncCallback_5900': + await this.executeFindElementCallback5900(caseName); + return; + case 'AccessibilityElementTest_actionNames_asyncCallback_6000': + await this.executeActionNamesCallback(caseName); + return; + case 'AccessibilityElementTest_performAction_asyncCallback_6100': + await this.executePerformActionCallback(caseName, 'accessibilityFocus'); + return; + case 'AccessibilityElementTest_performAction_asyncCallback_6200': + await this.executePerformActionCallback(caseName, 'clearAccessibilityFocus'); + return; + case 'AccessibilityElementTest_performAction_asyncCallback_6300': + await this.executePerformActionCallback(caseName, 'focus'); + return; + case 'AccessibilityElementTest_performAction_asyncCallback_6400': + await this.executePerformActionCallback(caseName, 'clearFocus'); + return; + case 'AccessibilityElementTest_performAction_asyncCallback_6500': + await this.executePerformActionCallback(caseName, 'clearSelection'); + return; + case 'AccessibilityElementTest_performAction_asyncCallback_6600': + await this.executePerformActionCallback(caseName, 'click'); + return; + case 'AccessibilityElementTest_performAction_asyncCallback_6700': + await this.executePerformActionCallback(caseName, 'longClick'); + return; + case 'AccessibilityElementTest_performAction_asyncCallback_6800': + await this.executePerformActionCallback(caseName, 'cut'); + return; + case 'AccessibilityElementTest_performAction_asyncCallback_6900': + await this.executePerformActionCallback(caseName, 'copy'); + return; + case 'AccessibilityElementTest_performAction_asyncCallback_7000': + await this.executePerformActionCallback(caseName, 'paste'); + return; + case 'AccessibilityElementTest_performAction_asyncCallback_7100': + await this.executePerformActionCallback(caseName, 'select'); + return; + case 'AccessibilityElementTest_performAction_asyncCallback_7200': + await this.executePerformActionCallback(caseName, 'setText'); + return; + case 'AccessibilityElementTest_performAction_asyncCallback_7300': + await this.executePerformActionCallback(caseName, 'delete'); + return; + case 'AccessibilityElementTest_performAction_asyncCallback_7400': + await this.executePerformActionCallback(caseName, 'scrollForward'); + return; + case 'AccessibilityElementTest_performAction_asyncCallback_7500': + await this.executePerformActionCallback(caseName, 'scrollBackward'); + return; + case 'AccessibilityElementTest_performAction_asyncCallback_7600': + await this.executePerformActionCallback(caseName, 'setSelection'); + return; + case 'AccessibilityElementTest_findElement_asyncCallback_7700': + await this.executeFindElementCallbackByContent(caseName, 'xxx'); + return; + case 'AccessibilityElementTest_findElement_asyncCallback_7800': + await this.executeFindElementCallbackByContent(caseName, 'button1'); + return; + case 'AccessibilityElementTest_findElement_asyncCallback_7900': + await this.executeFindElementCallbackByFocusType(caseName, 'accessibility'); + return; + case 'AccessibilityElementTest_findElement_asyncCallback_8000': + await this.executeFindElementCallbackByFocusType(caseName, 'normal'); + return; + case 'AccessibilityElementTest_findElement_asyncCallback_8100': + await this.executeFindElementCallbackByFocusDirection(caseName, 'up'); + return; + case 'AccessibilityElementTest_findElement_asyncCallback_8200': + await this.executeFindElementCallbackByFocusDirection(caseName, 'down'); + return; + case 'AccessibilityElementTest_findElement_asyncCallback_8300': + await this.executeFindElementCallbackByFocusDirection(caseName, 'left'); + return; + case 'AccessibilityElementTest_findElement_asyncCallback_8400': + await this.executeFindElementCallbackByFocusDirection(caseName, 'right'); + return; + case 'AccessibilityElementTest_findElement_asyncCallback_8500': + await this.executeFindElementCallbackByFocusDirection(caseName, 'forward'); + return; + case 'AccessibilityElementTest_findElement_asyncCallback_8600': + await this.executeFindElementCallbackByFocusDirection(caseName, 'backward'); + return; + case 'AccessibilityElementTest_findElement_asyncCallback_8700': + await this.executeFindElementCallbackByFocusType(caseName, 'xxx'); + return; + case 'AccessibilityElementTest_findElement_asyncCallback_8800': + await this.executeFindElementCallbackByFocusDirection(caseName, 'xxx'); + return; + case 'AccessibilityElementTest_performAction_asyncCallback_8900': + await this.executePerformActionCallback(caseName, 'xxx'); + return; + case 'AccessibilityElementTest_attributeValue_asyncCallback_9000': + await this.executeAttributeValueCallback(caseName, 'xxx', ''); + return; + default: + console.warn('ElementTest processCase unknown!!!!!!!!!!'); + break; + } + this.publishCaseResult(caseName, result); + } + + private async getBaseElement() { + let element = undefined; + if (this.context) { + let root = await this.context.getWindowRootElement(); + let elements = await root.findElement('content', 'button1'); + element = elements[0]; + } + return element; + } + + private async getWindowElement() { + let element = undefined; + if (this.context) { + let elements = await this.context.getWindows(); + element = elements[0]; + } + return element; + } + + private async executeAttributeNamesPromise(caseName: string): Promise { + let result = false; + let element = await this.getBaseElement(); + if (element) { + let names = await element.attributeNames(); + console.info('ElementTest executeAttributeNamesPromise ' + caseName + ' names: ' + JSON.stringify(names)); + if (Array.isArray(names)) { + result = true; + } + } + return result; + } + + private async executeAttributeValuePromise(caseName: string, input: string, outputType: string, + isWindow: boolean = false): Promise { + let element = undefined; + if (isWindow) { + element = await this.getWindowElement(); + } else { + element = await this.getBaseElement(); + } + + let result = false; + if (element) { + try { + console.info('ElementTest executeAttributeValuePromise ' + caseName + ' input: ' + input + ', outputType: ' + outputType); + let value = await element.attributeValue(input); + console.info('ElementTest executeAttributeValuePromise ' + caseName + ' value: ' + JSON.stringify(value)); + if (typeof(value) == outputType) { + result = true; + } else { + console.warn('ElementTest executeAttributeValuePromise ' + caseName + ' valueType: ' + typeof(value)); + } + } catch (e) { + console.info('ElementTest executeAttributeValuePromise ' + caseName + ' catch(e): ' + JSON.stringify(e)); + if (input == invalidString) { + result = true; + } + } + } + return result; + } + + private async executeAttributeValuePromiseTriggerAction(caseName: string) { + console.info('ElementTest executeAttributeValuePromiseTriggerAction ' + caseName + ' start'); + let event = new accessibility.EventInfo({}); + event.type = 'click'; + event.bundleName = 'com.example.myapplication'; + event.triggerAction = 'click'; + await accessibility.sendEvent(event); + console.info('ElementTest executeAttributeValuePromiseTriggerAction ' + caseName + ' sendEvent finish'); + + setTimeout(async () => { + let result = false; + console.info('ElementTest executeAttributeValuePromiseTriggerAction ' + caseName + ' events.length: ' + this.events.length); + for (let e of this.events) { + let target = e.target; + let value = await target.attributeValue('triggerAction'); + console.info('ElementTest executeAttributeValuePromiseTriggerAction ' + caseName + ' valueType: ' + typeof(value)); + if (e.eventType == 'click' && typeof(value) == 'string') { + result = true; + break; + } + } + this.publishCaseResult(caseName, result); + }, 1000); + } + + private async executeAttributeValuePromiseRootElement(caseName: string): Promise { + let element = undefined; + if (this.context) { + let base = await this.getBaseElement(); + if (base) { + let baseWindowId = await base.attributeValue('windowId'); + let windows = await this.context.getWindows(); + for (let window of windows) { + let windowId = await window.attributeValue('windowId'); + if (baseWindowId == windowId) { + element = window; + console.info('ElementTest executeAttributeValuePromiseRootElement ' + caseName + ' found window'); + break; + } + } + } + } + + let result = false; + if (element) { + console.info('ElementTest executeAttributeValuePromiseRootElement ' + caseName + ' input: rootElement, outputType: object'); + let value = await element.attributeValue('rootElement'); + console.info('ElementTest executeAttributeValuePromise ' + caseName + ' value: ' + JSON.stringify(value)); + if (typeof(value) == 'object') { + result = true; + } else { + console.warn('ElementTest executeAttributeValuePromise ' + caseName + ' valueType: ' + typeof(value)); + } + } + return result; + } + + private async executeAttributeValuePromiseArray(caseName: string, input: string, outputType: string): Promise { + let result = false; + let element = await this.getBaseElement(); + if (element) { + console.info('ElementTest executeAttributeValuePromiseArray ' + caseName + ' input: ' + input + ', outputType: ' + outputType); + let value = await element.attributeValue(input); + console.info('ElementTest executeAttributeValuePromiseArray ' + caseName + ' value: ' + JSON.stringify(value)); + if (Array.isArray(value)) { + if ((value.length == 0)|| + (value.length > 0 && typeof(value[0]) == outputType)) { + result = true; + } + } + } + return result; + } + + private async executeActionNamesPromise(caseName: string): Promise { + let result = false; + let element = await this.getBaseElement(); + if (element) { + let actions = await element.actionNames(); + console.info('ElementTest executeActionNamesPromise ' + caseName + ' actions: ' + JSON.stringify(actions)); + if (Array.isArray(actions)) { + if ((actions.length == 0) || + (actions.length > 0 && typeof(actions[0]) == 'string')) { + result = true; + } + } + } + return result; + } + + private async executePerformActionPromise(caseName: string, action: string, args?: object): Promise { + let result = false; + let element = await this.getBaseElement(); + if (element) { + try { + console.info('ElementTest executePerformActionPromise ' + caseName + ' action: ' + action + ', args: ' + JSON.stringify(args)); + let ret = await element.performAction(action, args); + console.info('ElementTest executePerformActionPromise ' + caseName + ' ret: ' + JSON.stringify(ret)); + if (typeof(ret) == 'boolean') { + result = true; + } + } catch (e) { + console.info('ElementTest executePerformActionPromise ' + caseName + ' catch(e): ' + JSON.stringify(e)); + if (action == invalidString) { + result = true; + } + } + } + return result; + } + + private async executeFindElementPromiseByContent(caseName: string, condition: string): Promise { + let result = false; + let element = await this.getBaseElement(); + if (element) { + try { + console.info('ElementTest executeFindElementPromiseByContent ' + caseName + ' condition: ' + condition); + let found = await element.findElement('content', condition); + console.info('ElementTest executeFindElementPromiseByContent ' + caseName + ' element: ' + JSON.stringify(found)); + if (Array.isArray(found)) { + if (found.length == 0 || typeof(found[0]) == 'object') { + result = true; + } + } + } catch (e) { + console.info('ElementTest executeFindElementPromiseByContent ' + caseName + ' catch(e): ' + JSON.stringify(e)); + if (condition == invalidString) { + result = true; + } + } + } + return result; + } + + private async executeFindElementPromiseByFocusType(caseName: string, condition: string): Promise { + let result = false; + let element = await this.getBaseElement(); + if (element) { + try { + console.info('ElementTest executeFindElementPromiseByFocusType ' + caseName + ' condition: ' + condition); + let action = (condition == 'accessibility') ? 'accessibilityFocus' : 'focus'; + let ret = await element.performAction(action); + console.info('ElementTest executeFindElementPromiseByFocusType ' + caseName + ' performAction[' + action + '] ret: ' + ret); + + let found = await element.findElement('focusType', condition); + console.info('ElementTest executeFindElementPromiseByFocusType ' + caseName + ' element: ' + JSON.stringify(found)); + if (typeof(found) == 'object') { + result = true; + } + + if (ret) { + let clearAction = (condition == 'accessibility') ? 'clearAccessibilityFocus' : 'clearFocus'; + await element.performAction(clearAction); + } + } catch (e) { + console.info('ElementTest executeFindElementPromiseByFocusType ' + caseName + ' catch(e): ' + JSON.stringify(e)); + if (condition == invalidString) { + result = true; + } + } + } + return result; + } + + private async executeFindElementPromiseByFocusDirection(caseName: string, condition: string): Promise { + let result = false; + let element = await this.getBaseElement(); + if (element) { + try { + console.info('ElementTest executeFindElementPromiseByFocusDirection ' + caseName + ' condition: ' + condition); + let found = await element.findElement('focusDirection', condition); + console.info('ElementTest executeFindElementPromiseByFocusDirection ' + caseName + ' element: ' + JSON.stringify(found)); + if (typeof(found) == 'object') { + result = true; + } + } catch (e) { + console.info('ElementTest executeFindElementPromiseByFocusDirection ' + caseName + ' catch(e): ' + JSON.stringify(e)); + if (condition == invalidString) { + result = true; + } + } + } + return result; + } + + private async executeFindElementPromise5900(caseName: string): Promise { + let result = false; + let element = undefined; + if (this.context) { + let root = await this.context.getWindowRootElement(); + let elements = await root.findElement('content', 'button2'); + element = elements[0]; + } + if (element) { + console.info('ElementTest executeFindElementPromise5900 ' + caseName); + let found = await element.findElement('focusDirection', 'down'); + console.info('ElementTest executeFindElementPromise5900 ' + caseName + ' element: ' + JSON.stringify(found)); + if (typeof(found) == 'object') { + result = true; + } + } + return result; + } + + private async executeAttributeNamesCallback(caseName: string) { + let result = false; + let element = await this.getBaseElement(); + if (element) { + element.attributeNames((err, names) => { + console.info('ElementTest executeAttributeNamesCallback ' + caseName + ' err: ' + JSON.stringify(err)); + console.info('ElementTest executeAttributeNamesCallback ' + caseName + ' names: ' + JSON.stringify(names)); + if (err.code == 0 && Array.isArray(names)) { + result = true; + } + this.publishCaseResult(caseName, result); + }); + } + } + + private async executeAttributeValueCallback(caseName: string, input: string, + outputType: string, isWindow: boolean = false) { + let element = undefined; + if (isWindow) { + element = await this.getWindowElement(); + } else { + element = await this.getBaseElement(); + } + + let result = false; + if (element) { + console.info('ElementTest executeAttributeValueCallback ' + caseName + ' input: ' + input + ', outputType: ' + outputType); + element.attributeValue(input, (err, value) => { + console.info('ElementTest executeAttributeValueCallback ' + caseName + ' err: ' + JSON.stringify(err)); + console.info('ElementTest executeAttributeValueCallback ' + caseName + ' value: ' + JSON.stringify(value)); + if (input == invalidString && err.code != 0) { + result = true; + } else if (err.code == 0 && typeof(value) == outputType) { + result = true; + } else { + console.warn('ElementTest executeAttributeValueCallback ' + caseName + ' valueType: ' + typeof(value)); + } + this.publishCaseResult(caseName, result); + }); + } + } + + private async executeAttributeValueCallbackTriggerAction(caseName: string) { + console.info('ElementTest executeAttributeValueCallbackTriggerAction ' + caseName + ' start'); + let event = new accessibility.EventInfo({}); + event.type = 'click'; + event.bundleName = 'com.example.myapplication'; + event.triggerAction = 'click'; + await accessibility.sendEvent(event); + console.info('ElementTest executeAttributeValueCallbackTriggerAction ' + caseName + ' sendEvent finish'); + + setTimeout(() => { + console.info('ElementTest executeAttributeValueCallbackTriggerAction ' + caseName + ' events.length: ' + this.events.length); + for (let i = 0; i < this.events.length; i++) { + let target = this.events[i].target; + let eventType = this.events[i].eventType; + console.info('ElementTest executeAttributeValueCallbackTriggerAction ' + caseName + ' target: ' + JSON.stringify(target)); + target.attributeValue('triggerAction', (err, value) => { + console.info('ElementTest executeAttributeValueCallbackTriggerAction ' + caseName + ' err: ' + JSON.stringify(err)); + console.info('ElementTest executeAttributeValueCallbackTriggerAction ' + caseName + ' valueType: ' + typeof(value)); + if (err.code == 0 && eventType == 'click' && typeof(value) == 'string') { + this.publishCaseResult(caseName, true); + } + }); + } + }, 1000); + } + + private async executeAttributeValueCallbackRootElement(caseName: string) { + let element = undefined; + if (this.context) { + let base = await this.getBaseElement(); + if (base) { + let baseWindowId = await base.attributeValue('windowId'); + let windows = await this.context.getWindows(); + for (let window of windows) { + let windowId = await window.attributeValue('windowId'); + if (baseWindowId == windowId) { + element = window; + console.info('ElementTest executeAttributeValueCallbackRootElement ' + caseName + ' found window'); + break; + } + } + } + } + + let result = false; + if (element) { + console.info('ElementTest executeAttributeValueCallbackRootElement ' + caseName + ' input: rootElement, outputType: object'); + element.attributeValue('rootElement', (err, value) => { + console.info('ElementTest executeAttributeValueCallback ' + caseName + ' err: ' + JSON.stringify(err)); + console.info('ElementTest executeAttributeValueCallback ' + caseName + ' value: ' + JSON.stringify(value)); + if (err.code == 0 && typeof(value) == 'object') { + result = true; + } else { + console.warn('ElementTest executeAttributeValueCallback ' + caseName + ' valueType: ' + typeof(value)); + } + this.publishCaseResult(caseName, result); + }); + } + } + + private async executeAttributeValueCallbackArray(caseName: string, input: string, outputType: string) { + let result = false; + let element = await this.getBaseElement(); + if (element) { + console.info('ElementTest executeAttributeValueCallbackArray ' + caseName + ' input: ' + input + ', outputType: ' + outputType); + element.attributeValue(input, (err, value) => { + console.info('ElementTest executeAttributeValueCallbackArray ' + caseName + ' err: ' + JSON.stringify(err)); + console.info('ElementTest executeAttributeValueCallbackArray ' + caseName + ' value: ' + JSON.stringify(value)); + if (err.code == 0 && Array.isArray(value)) { + if ((value.length == 0)|| + (value.length > 0 && typeof(value[0]) == outputType)) { + result = true; + } + } + this.publishCaseResult(caseName, result); + }); + } + } + + private async executeActionNamesCallback(caseName: string) { + let result = false; + let element = await this.getBaseElement(); + if (element) { + element.actionNames((err, actions) => { + console.info('ElementTest executeActionNamesCallback ' + caseName + ' err: ' + JSON.stringify(err)); + console.info('ElementTest executeActionNamesCallback ' + caseName + ' actions: ' + JSON.stringify(actions)); + if (err.code == 0 && Array.isArray(actions)) { + if ((actions.length == 0) || + (actions.length > 0 && typeof(actions[0]) == 'string')) { + result = true; + } + } + this.publishCaseResult(caseName, result); + }); + + } + } + + private async executePerformActionCallback(caseName: string, action: string, args?: object) { + let result = false; + let element = await this.getBaseElement(); + if (element) { + console.info('ElementTest executePerformActionCallback ' + caseName + ' action: ' + action + ', args: ' + JSON.stringify(args)); + element.performAction(action, args, (err, ret) => { + console.info('ElementTest executePerformActionCallback ' + caseName + ' err: ' + JSON.stringify(err)); + console.info('ElementTest executePerformActionCallback ' + caseName + ' ret: ' + JSON.stringify(ret)); + if (action == invalidString && err.code != 0) { + result = true; + } else if (err.code == 0 && typeof(ret) == 'boolean') { + result = true; + } + this.publishCaseResult(caseName, result); + }); + } + } + + private async executeFindElementCallbackByContent(caseName: string, condition: string) { + let result = false; + let element = await this.getBaseElement(); + if (element) { + console.info('ElementTest executeFindElementCallbackByContent ' + caseName + ' condition: ' + condition); + element.findElement('content', condition, (err, found) => { + console.info('ElementTest executeFindElementCallbackByContent ' + caseName + ' err: ' + JSON.stringify(err)); + console.info('ElementTest executeFindElementCallbackByContent ' + caseName + ' element: ' + JSON.stringify(found)); + if (condition == invalidString && err.code != 0) { + result = true; + } else if (err.code == 0 && Array.isArray(found)) { + if (found.length == 0 || typeof(found[0]) == 'object') { + result = true; + } + } + this.publishCaseResult(caseName, result); + }); + } + } + + private async executeFindElementCallbackByFocusType(caseName: string, condition: string) { + let result = false; + let element = await this.getBaseElement(); + if (element) { + console.info('ElementTest executeFindElementCallbackByFocusType ' + caseName + ' condition: ' + condition); + let action = (condition == 'accessibility') ? 'accessibilityFocus' : 'focus'; + let ret = await element.performAction(action); + console.info('ElementTest executeFindElementCallbackByFocusType ' + caseName + ' performAction[' + action + '] ret: ' + ret); + + element.findElement('focusType', condition, (err, found) => { + console.info('ElementTest executeFindElementCallbackByFocusType ' + caseName + ' err: ' + JSON.stringify(err)); + console.info('ElementTest executeFindElementCallbackByFocusType ' + caseName + ' element: ' + JSON.stringify(found)); + if (condition == invalidString && err.code != 0) { + result = true; + } else if (err.code == 0 && typeof(found) == 'object') { + result = true; + } + this.publishCaseResult(caseName, result); + }); + + setTimeout(async () => { + if (ret && element) { + let clearAction = (condition == 'accessibility') ? 'clearAccessibilityFocus' : 'clearFocus'; + await element.performAction(clearAction); + } + }, 1000); + } + } + + private async executeFindElementCallbackByFocusDirection(caseName: string, condition: string) { + let result = false; + let element = await this.getBaseElement(); + if (element) { + console.info('ElementTest executeFindElementCallbackByFocusDirection ' + caseName + ' condition: ' + condition); + element.findElement('focusDirection', condition, (err, found) => { + console.info('ElementTest executeFindElementCallbackByFocusDirection ' + err + ' element: ' + JSON.stringify(err)); + console.info('ElementTest executeFindElementCallbackByFocusDirection ' + caseName + ' element: ' + JSON.stringify(found)); + if (condition == invalidString && err.code != 0) { + result = true; + } else if (err.code == 0 && typeof(found) == 'object') { + result = true; + } + this.publishCaseResult(caseName, result); + }); + } + } + + private async executeFindElementCallback5900(caseName: string) { + let result = false; + let element = undefined; + if (this.context) { + let root = await this.context.getWindowRootElement(); + let elements = await root.findElement('content', 'button2'); + element = elements[0]; + } + if (element) { + console.info('ElementTest executeFindElementCallback5900 ' + caseName); + element.findElement('focusDirection', 'down', (err, found) => { + console.info('ElementTest executeFindElementCallback5900 ' + caseName + ' err: ' + JSON.stringify(err)); + console.info('ElementTest executeFindElementCallback5900 ' + caseName + ' element: ' + JSON.stringify(found)); + if (err.code == 0 && typeof(found) == 'object') { + result = true; + } + this.publishCaseResult(caseName, result); + }); + } + } +} \ No newline at end of file diff --git a/barrierfree/accessibilityelement/entry/src/main/ets/Application/AbilityStage.ts b/barrierfree/accessibilityelement/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..1535a6b506bcd4a361ccbf5328e933e46a7b7e38 --- /dev/null +++ b/barrierfree/accessibilityelement/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,7 @@ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} diff --git a/barrierfree/accessibilityelement/entry/src/main/ets/MainAbility/MainAbility.ts b/barrierfree/accessibilityelement/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..1894466ab9c018f438aa6bb45d80fed51c9e514d --- /dev/null +++ b/barrierfree/accessibilityelement/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,38 @@ +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; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate windowStage=" + windowStage) + //globalThis.windowStage = windowStage + //globalThis.abilityStorage = this.storage + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index/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") + } +}; \ No newline at end of file diff --git a/barrierfree/accessibilityelement/entry/src/main/ets/pages/index/index.ets b/barrierfree/accessibilityelement/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..9bd2846c0a7cf88a8ac7af708a6fc27dad8845d5 --- /dev/null +++ b/barrierfree/accessibilityelement/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,56 @@ +/* + * 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 {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index" +import testsuite from "../../test/List.test" + +@Entry +@Component +struct Index { + @State message: string = 'Hello World'; + + aboutToAppear(){ + console.info("start run testcase!!!!"); + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)); + globalThis.abilityWant.parameters.timeout = 70000; + configService.setConfig(globalThis.abilityWant.parameters); + testsuite(globalThis.abilityContext); + core.execute(); + } + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/barrierfree/accessibilityelement/entry/src/main/ets/test/AccessibilityElement.test.ets b/barrierfree/accessibilityelement/entry/src/main/ets/test/AccessibilityElement.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e1f9bf3cac6d79635362826a3b86e4abe9207ea9 --- /dev/null +++ b/barrierfree/accessibilityelement/entry/src/main/ets/test/AccessibilityElement.test.ets @@ -0,0 +1,4341 @@ +/* + * 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 'deccjsunit/index' +import commonEvent from '@ohos.commonEvent' + +const passStr = 'pass'; +const failStr = 'fail'; + +function publishCaseExecute(caseName: string) { + let commonEventPublishData = { + data: caseName + } + + commonEvent.publish('caseExecute', commonEventPublishData, (err) => { + console.info('caseExecute publish [' + caseName + '] callback result: ' + JSON.stringify(err)); + }); +} + +export default function abilityTest(abilityContext) { + describe('AccessibilityElementTest', function () { + let subScriber = undefined; + let isConnect = false; + let caseResult = undefined; + + beforeAll(async function (done) { + console.info('AccessibilityElementTest: beforeAll'); + subScriber = await commonEvent.createSubscriber({events: ['onConnectState', 'caseResult']}); + commonEvent.subscribe(subScriber, (err, data) => { + console.info('AccessibilityElementTest beforeAll data:' + JSON.stringify(data) ); + if (data.data == 'connect') { + isConnect = true; + } else if (data.data == 'disconnect') { + isConnect = false; + } else if (data.data == passStr || data.data == failStr) { + caseResult = data; + } + }); + + await abilityContext.startAbility({ + deviceId: '', + bundleName: 'com.example.acetest', + abilityName: 'MainAbility', + action: 'action1', + parameters: {}, + }); + setTimeout(done, 5000); + }) + + afterAll(async function (done) { + console.info('AccessibilityElementTest: afterAll'); + commonEvent.unsubscribe(subScriber); + isConnect = false; + done(); + }) + + beforeEach(async function (done) { + console.info('AccessibilityElementTest: beforeEach'); + caseResult = undefined; + done(); + }) + + afterEach(async function (done) { + console.info('AccessibilityElementTest: afterEach'); + done(); + }) + + /* + * @tc.number AccessibilityElementTest_attributeNames_asyncPromise_0100 + * @tc.name AccessibilityElementTest_attributeNames_asyncPromise_0100 + * @tc.desc Test attributeNames(), should return an array of names in ElementAttributeValues. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeNames_asyncPromise_0100', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeNames_asyncPromise_0100'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_0200 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_0200 + * @tc.desc Test attributeValue() when input is 'componentId', should return a number type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_0200', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_0200'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_0500 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_0500 + * @tc.desc Test attributeValue() when input is 'inspectorKey', should return a string type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_0500', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_0500'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_0600 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_0600 + * @tc.desc Test attributeValue() when input is 'bundleName', should return a string type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_0600', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_0600'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_0700 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_0700 + * @tc.desc Test attributeValue() when input is 'componentType', should return a string type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_0700', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_0700'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_0800 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_0800 + * @tc.desc Test attributeValue() when input is 'inputType', should return a number type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_0800', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_0800'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_0900 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_0900 + * @tc.desc Test attributeValue() when input is 'text', should return a string type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_0900', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_0900'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_1000 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_1000 + * @tc.desc Test attributeValue() when input is 'hintText', should return a string type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_1000', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_1000'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_1100 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_1100 + * @tc.desc Test attributeValue() when input is 'description', should return a string type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_1100', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_1100'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_1200 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_1200 + * @tc.desc Test attributeValue() when input is 'resourceName', should return a string type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_1200', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_1200'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_1400 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_1400 + * @tc.desc Test attributeValue() when input is 'textLengthLimit', should return a number type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_1400', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_1400'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_1500 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_1500 + * @tc.desc Test attributeValue() when input is 'rect', should return a Rect type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_1500', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_1500'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_1600 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_1600 + * @tc.desc Test attributeValue() when input is 'checkable', should return a boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_1600', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_1600'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_1700 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_1700 + * @tc.desc Test attributeValue() when input is 'checked', should return a boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_1700', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_1700'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_1800 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_1800 + * @tc.desc Test attributeValue() when input is 'focusable', should return a boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_1800', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_1800'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_1900 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_1900 + * @tc.desc Test attributeValue() when input is 'isVisible', should return a boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_1900', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_1900'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_2100 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_2100 + * @tc.desc Test attributeValue() when input is 'selected', should return a boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_2100', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_2100'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_2200 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_2200 + * @tc.desc Test attributeValue() when input is 'clickable', should return a boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_2200', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_2200'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_2300 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_2300 + * @tc.desc Test attributeValue() when input is 'longClickable', should return a boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_2300', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_2300'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_2400 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_2400 + * @tc.desc Test attributeValue() when input is 'isEnable', should return a boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_2400', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_2400'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_2500 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_2500 + * @tc.desc Test attributeValue() when input is 'isPassword', should return a boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_2500', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_2500'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_2600 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_2600 + * @tc.desc Test attributeValue() when input is 'scrollable', should return a boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_2600', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_2600'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_2700 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_2700 + * @tc.desc Test attributeValue() when input is 'editable', should return a boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_2700', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_2700'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_2900 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_2900 + * @tc.desc Test attributeValue() when input is 'pluralLineSupported', should return a boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_2900', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_2900'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_3300 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_3300 + * @tc.desc Test attributeValue() when input is 'itemCount', should return a number type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_3300', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_3300'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_3400 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_3400 + * @tc.desc Test attributeValue() when input is 'currentIndex', should return a number type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_3400', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_3400'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_3500 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_3500 + * @tc.desc Test attributeValue() when input is 'startIndex', should return a number type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_3500', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_3500'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_3600 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_3600 + * @tc.desc Test attributeValue() when input is 'endIndex', should return a number type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_3600', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_3600'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_4300 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_4300 + * @tc.desc Test attributeValue() when input is 'triggerAction', should return a string type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_4300', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_4300'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_4400 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_4400 + * @tc.desc Test attributeValue() when input is 'textMoveUnit', should return a string type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_4400', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_4400'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_4500 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_4500 + * @tc.desc Test attributeValue() when input is 'contents', should return an array of string. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_4500', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_4500'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_4600 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_4600 + * @tc.desc Test attributeValue() when input is 'lastContent', should return a string type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_4600', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_4600'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_4700 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_4700 + * @tc.desc Test attributeValue() when input is 'parent', should return an AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_4700', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_4700'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_4800 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_4800 + * @tc.desc Test attributeValue() when input is 'children', should return an array of AccessibilityElement. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_4800', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_4800'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_5200 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_5200 + * @tc.desc Test attributeValue() when input is 'isActive', should return a boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_5200', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_5200'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_5300 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_5300 + * @tc.desc Test attributeValue() when input is 'screenRect', should return a Rect type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_5300', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_5300'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_5400 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_5400 + * @tc.desc Test attributeValue() when input is 'layer', should return a number type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_5400', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_5400'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_5500 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_5500 + * @tc.desc Test attributeValue() when input is 'type', should return a WindowType(string) type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_5500', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_5500'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_5800 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_5800 + * @tc.desc Test attributeValue() when input is 'isFocused', should return a boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_5800', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_5800'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_findElement_asyncPromise_5900 + * @tc.name AccessibilityElementTest_findElement_asyncPromise_5900 + * @tc.desc Test findElement() when input is 'focusDirection' and 'down' in same layout, should return an AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_findElement_asyncPromise_5900', 0, async function (done) { + let caseName = 'AccessibilityElementTest_findElement_asyncPromise_5900'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_actionNames_asyncPromise_6000 + * @tc.name AccessibilityElementTest_actionNames_asyncPromise_6000 + * @tc.desc Test actionNames(), should return an array of action names in CommonAction. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_actionNames_asyncPromise_6000', 0, async function (done) { + let caseName = 'AccessibilityElementTest_actionNames_asyncPromise_6000'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncPromise_6100 + * @tc.name AccessibilityElementTest_performAction_asyncPromise_6100 + * @tc.desc Test performAction() when input is 'accessibilityFocus'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncPromise_6100', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncPromise_6100'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncPromise_6200 + * @tc.name AccessibilityElementTest_performAction_asyncPromise_6200 + * @tc.desc Test performAction() when input is 'clearAccessibilityFocus'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncPromise_6200', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncPromise_6200'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncPromise_6300 + * @tc.name AccessibilityElementTest_performAction_asyncPromise_6300 + * @tc.desc Test performAction() when input is 'focus'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncPromise_6300', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncPromise_6300'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncPromise_6400 + * @tc.name AccessibilityElementTest_performAction_asyncPromise_6400 + * @tc.desc Test performAction() when input is 'clearFocus'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncPromise_6400', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncPromise_6400'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncPromise_6500 + * @tc.name AccessibilityElementTest_performAction_asyncPromise_6500 + * @tc.desc Test performAction() when input is 'clearSelection'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncPromise_6500', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncPromise_6500'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncPromise_6600 + * @tc.name AccessibilityElementTest_performAction_asyncPromise_6600 + * @tc.desc Test performAction() when input is 'click'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncPromise_6600', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncPromise_6600'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncPromise_6700 + * @tc.name AccessibilityElementTest_performAction_asyncPromise_6700 + * @tc.desc Test performAction() when input is 'longClick'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncPromise_6700', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncPromise_6700'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncPromise_6800 + * @tc.name AccessibilityElementTest_performAction_asyncPromise_6800 + * @tc.desc Test performAction() when input is 'cut'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncPromise_6800', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncPromise_6800'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncPromise_6900 + * @tc.name AccessibilityElementTest_performAction_asyncPromise_6900 + * @tc.desc Test performAction() when input is 'copy'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncPromise_6900', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncPromise_6900'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncPromise_7000 + * @tc.name AccessibilityElementTest_performAction_asyncPromise_7000 + * @tc.desc Test performAction() when input is 'paste'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncPromise_7000', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncPromise_7000'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncPromise_7100 + * @tc.name AccessibilityElementTest_performAction_asyncPromise_7100 + * @tc.desc Test performAction() when input is 'select'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncPromise_7100', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncPromise_7100'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncPromise_7200 + * @tc.name AccessibilityElementTest_performAction_asyncPromise_7200 + * @tc.desc Test performAction() when input is 'setText'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncPromise_7200', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncPromise_7200'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncPromise_7300 + * @tc.name AccessibilityElementTest_performAction_asyncPromise_7300 + * @tc.desc Test performAction() when input is 'delete'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncPromise_7300', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncPromise_7300'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncPromise_7400 + * @tc.name AccessibilityElementTest_performAction_asyncPromise_7400 + * @tc.desc Test performAction() when input is 'scrollForward'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncPromise_7400', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncPromise_7400'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncPromise_7500 + * @tc.name AccessibilityElementTest_performAction_asyncPromise_7500 + * @tc.desc Test performAction() when input is 'scrollBackward'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncPromise_7500', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncPromise_7500'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncPromise_7600 + * @tc.name AccessibilityElementTest_performAction_asyncPromise_7600 + * @tc.desc Test performAction() when input is 'setSelection'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncPromise_7600', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncPromise_7600'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_findElement_asyncPromise_7700 + * @tc.name AccessibilityElementTest_findElement_asyncPromise_7700 + * @tc.desc Test findElement() when input is 'content' and 'xxx', should return an AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_findElement_asyncPromise_7700', 0, async function (done) { + let caseName = 'AccessibilityElementTest_findElement_asyncPromise_7700'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_findElement_asyncPromise_7800 + * @tc.name AccessibilityElementTest_findElement_asyncPromise_7800 + * @tc.desc Test findElement() when input is 'content' and 'button1', should return an AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_findElement_asyncPromise_7800', 0, async function (done) { + let caseName = 'AccessibilityElementTest_findElement_asyncPromise_7800'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_findElement_asyncPromise_7900 + * @tc.name AccessibilityElementTest_findElement_asyncPromise_7900 + * @tc.desc Test findElement() when input is 'focusType' and 'accessibility', should return an AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_findElement_asyncPromise_7900', 0, async function (done) { + let caseName = 'AccessibilityElementTest_findElement_asyncPromise_7900'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_findElement_asyncPromise_8000 + * @tc.name AccessibilityElementTest_findElement_asyncPromise_8000 + * @tc.desc Test findElement() when input is 'focusType' and 'normal', should return an AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_findElement_asyncPromise_8000', 0, async function (done) { + let caseName = 'AccessibilityElementTest_findElement_asyncPromise_8000'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_findElement_asyncPromise_8100 + * @tc.name AccessibilityElementTest_findElement_asyncPromise_8100 + * @tc.desc Test findElement() when input is 'focusDirection' and 'up', should return an AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_findElement_asyncPromise_8100', 0, async function (done) { + let caseName = 'AccessibilityElementTest_findElement_asyncPromise_8100'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_findElement_asyncPromise_8200 + * @tc.name AccessibilityElementTest_findElement_asyncPromise_8200 + * @tc.desc Test findElement() when input is 'focusDirection' and 'down', should return an AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_findElement_asyncPromise_8200', 0, async function (done) { + let caseName = 'AccessibilityElementTest_findElement_asyncPromise_8200'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_findElement_asyncPromise_8300 + * @tc.name AccessibilityElementTest_findElement_asyncPromise_8300 + * @tc.desc Test findElement() when input is 'focusDirection' and 'left', should return an AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_findElement_asyncPromise_8300', 0, async function (done) { + let caseName = 'AccessibilityElementTest_findElement_asyncPromise_8300'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_findElement_asyncPromise_8400 + * @tc.name AccessibilityElementTest_findElement_asyncPromise_8400 + * @tc.desc Test findElement() when input is 'focusDirection' and 'right', should return an AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_findElement_asyncPromise_8400', 0, async function (done) { + let caseName = 'AccessibilityElementTest_findElement_asyncPromise_8400'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_findElement_asyncPromise_8500 + * @tc.name AccessibilityElementTest_findElement_asyncPromise_8500 + * @tc.desc Test findElement() when input is 'focusDirection' and 'forward', should return an AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_findElement_asyncPromise_8500', 0, async function (done) { + let caseName = 'AccessibilityElementTest_findElement_asyncPromise_8500'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_findElement_asyncPromise_8600 + * @tc.name AccessibilityElementTest_findElement_asyncPromise_8600 + * @tc.desc Test findElement() when input is 'focusDirection' and 'backward', should return an AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_findElement_asyncPromise_8600', 0, async function (done) { + let caseName = 'AccessibilityElementTest_findElement_asyncPromise_8600'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_findElement_asyncPromise_8700 + * @tc.name AccessibilityElementTest_findElement_asyncPromise_8700 + * @tc.desc Test findElement() when input is 'focusType' and 'xxx', should return an AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_findElement_asyncPromise_8700', 0, async function (done) { + let caseName = 'AccessibilityElementTest_findElement_asyncPromise_8700'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_findElement_asyncPromise_8800 + * @tc.name AccessibilityElementTest_findElement_asyncPromise_8800 + * @tc.desc Test findElement() when input is 'focusDirection' and 'xxx', should return an AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_findElement_asyncPromise_8800', 0, async function (done) { + let caseName = 'AccessibilityElementTest_findElement_asyncPromise_8800'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncPromise_8900 + * @tc.name AccessibilityElementTest_performAction_asyncPromise_8900 + * @tc.desc Test performAction() when input is 'xxx'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncPromise_8900', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncPromise_8900'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncPromise_9000 + * @tc.name AccessibilityElementTest_attributeValue_asyncPromise_9000 + * @tc.desc Test attributeValue() when input is 'xxx', should catch error. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncPromise_9000', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncPromise_9000'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeNames_asyncCallback_0100 + * @tc.name AccessibilityElementTest_attributeNames_asyncCallback_0100 + * @tc.desc Test attributeNames(), should return an array of names in ElementAttributeValues. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeNames_asyncCallback_0100', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeNames_asyncCallback_0100'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_0200 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_0200 + * @tc.desc Test attributeValue() when input is 'componentId', should return a number type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_0200', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_0200'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_0500 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_0500 + * @tc.desc Test attributeValue() when input is 'inspectorKey', should return a string type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_0500', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_0500'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_0600 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_0600 + * @tc.desc Test attributeValue() when input is 'bundleName', should return a string type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_0600', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_0600'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_0700 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_0700 + * @tc.desc Test attributeValue() when input is 'componentType', should return a string type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_0700', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_0700'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_0800 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_0800 + * @tc.desc Test attributeValue() when input is 'inputType', should return a number type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_0800', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_0800'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_0900 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_0900 + * @tc.desc Test attributeValue() when input is 'text', should return a string type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_0900', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_0900'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_1000 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_1000 + * @tc.desc Test attributeValue() when input is 'hintText', should return a string type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_1000', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_1000'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_1100 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_1100 + * @tc.desc Test attributeValue() when input is 'description', should return a string type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_1100', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_1100'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_1200 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_1200 + * @tc.desc Test attributeValue() when input is 'resourceName', should return a string type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_1200', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_1200'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_1400 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_1400 + * @tc.desc Test attributeValue() when input is 'textLengthLimit', should return a number type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_1400', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_1400'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_1500 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_1500 + * @tc.desc Test attributeValue() when input is 'rect', should return a Rect type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_1500', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_1500'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_1600 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_1600 + * @tc.desc Test attributeValue() when input is 'checkable', should return a boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_1600', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_1600'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_1700 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_1700 + * @tc.desc Test attributeValue() when input is 'checked', should return a boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_1700', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_1700'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_1800 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_1800 + * @tc.desc Test attributeValue() when input is 'focusable', should return a boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_1800', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_1800'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_1900 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_1900 + * @tc.desc Test attributeValue() when input is 'isVisible', should return a boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_1900', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_1900'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_2100 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_2100 + * @tc.desc Test attributeValue() when input is 'selected', should return a boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_2100', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_2100'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_2200 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_2200 + * @tc.desc Test attributeValue() when input is 'clickable', should return a boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_2200', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_2200'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_2300 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_2300 + * @tc.desc Test attributeValue() when input is 'longClickable', should return a boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_2300', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_2300'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_2400 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_2400 + * @tc.desc Test attributeValue() when input is 'isEnable', should return a boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_2400', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_2400'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_2500 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_2500 + * @tc.desc Test attributeValue() when input is 'isPassword', should return a boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_2500', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_2500'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_2600 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_2600 + * @tc.desc Test attributeValue() when input is 'scrollable', should return a boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_2600', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_2600'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_2700 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_2700 + * @tc.desc Test attributeValue() when input is 'editable', should return a boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_2700', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_2700'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_2900 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_2900 + * @tc.desc Test attributeValue() when input is 'pluralLineSupported', should return a boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_2900', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_2900'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_3300 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_3300 + * @tc.desc Test attributeValue() when input is 'itemCount', should return a number type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_3300', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_3300'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_3400 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_3400 + * @tc.desc Test attributeValue() when input is 'currentIndex', should return a number type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_3400', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_3400'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_3500 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_3500 + * @tc.desc Test attributeValue() when input is 'startIndex', should return a number type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_3500', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_3500'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_3600 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_3600 + * @tc.desc Test attributeValue() when input is 'endIndex', should return a number type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_3600', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_3600'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_4300 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_4300 + * @tc.desc Test attributeValue() when input is 'triggerAction', should return a string type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_4300', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_4300'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_4400 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_4400 + * @tc.desc Test attributeValue() when input is 'textMoveUnit', should return a string type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_4400', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_4400'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_4500 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_4500 + * @tc.desc Test attributeValue() when input is 'contents', should return an array of string. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_4500', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_4500'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_4600 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_4600 + * @tc.desc Test attributeValue() when input is 'lastContent', should return a string type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_4600', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_4600'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_4700 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_4700 + * @tc.desc Test attributeValue() when input is 'parent', should return an AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_4700', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_4700'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_4800 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_4800 + * @tc.desc Test attributeValue() when input is 'children', should return an array of AccessibilityElement. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_4800', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_4800'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_5200 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_5200 + * @tc.desc Test attributeValue() when input is 'isActive', should return a boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_5200', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_5200'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_5300 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_5300 + * @tc.desc Test attributeValue() when input is 'screenRect', should return a Rect type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_5300', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_5300'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_5400 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_5400 + * @tc.desc Test attributeValue() when input is 'layer', should return a number type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_5400', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_5400'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_5500 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_5500 + * @tc.desc Test attributeValue() when input is 'type', should return a WindowType(string) type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_5500', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_5500'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_5800 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_5800 + * @tc.desc Test attributeValue() when input is 'isFocused', should return a boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_5800', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_5800'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_findElement_asyncCallback_5900 + * @tc.name AccessibilityElementTest_findElement_asyncCallback_5900 + * @tc.desc Test findElement() when input is 'focusDirection' and 'down' in same layout, should return an AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_findElement_asyncCallback_5900', 0, async function (done) { + let caseName = 'AccessibilityElementTest_findElement_asyncCallback_5900'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_actionNames_asyncCallback_6000 + * @tc.name AccessibilityElementTest_actionNames_asyncCallback_6000 + * @tc.desc Test actionNames(), should return an array of action names in CommonAction. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_actionNames_asyncCallback_6000', 0, async function (done) { + let caseName = 'AccessibilityElementTest_actionNames_asyncCallback_6000'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncCallback_6100 + * @tc.name AccessibilityElementTest_performAction_asyncCallback_6100 + * @tc.desc Test performAction() when input is 'accessibilityFocus'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncCallback_6100', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncCallback_6100'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncCallback_6200 + * @tc.name AccessibilityElementTest_performAction_asyncCallback_6200 + * @tc.desc Test performAction() when input is 'clearAccessibilityFocus'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncCallback_6200', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncCallback_6200'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncCallback_6300 + * @tc.name AccessibilityElementTest_performAction_asyncCallback_6300 + * @tc.desc Test performAction() when input is 'focus'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncCallback_6300', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncCallback_6300'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncCallback_6400 + * @tc.name AccessibilityElementTest_performAction_asyncCallback_6400 + * @tc.desc Test performAction() when input is 'clearFocus'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncCallback_6400', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncCallback_6400'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncCallback_6500 + * @tc.name AccessibilityElementTest_performAction_asyncCallback_6500 + * @tc.desc Test performAction() when input is 'clearSelection'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncCallback_6500', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncCallback_6500'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncCallback_6600 + * @tc.name AccessibilityElementTest_performAction_asyncCallback_6600 + * @tc.desc Test performAction() when input is 'click'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncCallback_6600', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncCallback_6600'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncCallback_6700 + * @tc.name AccessibilityElementTest_performAction_asyncCallback_6700 + * @tc.desc Test performAction() when input is 'longClick'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncCallback_6700', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncCallback_6700'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncCallback_6800 + * @tc.name AccessibilityElementTest_performAction_asyncCallback_6800 + * @tc.desc Test performAction() when input is 'cut'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncCallback_6800', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncCallback_6800'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncCallback_6900 + * @tc.name AccessibilityElementTest_performAction_asyncCallback_6900 + * @tc.desc Test performAction() when input is 'copy'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncCallback_6900', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncCallback_6900'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncCallback_7000 + * @tc.name AccessibilityElementTest_performAction_asyncCallback_7000 + * @tc.desc Test performAction() when input is 'paste'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncCallback_7000', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncCallback_7000'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncCallback_7100 + * @tc.name AccessibilityElementTest_performAction_asyncCallback_7100 + * @tc.desc Test performAction() when input is 'select'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncCallback_7100', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncCallback_7100'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncCallback_7200 + * @tc.name AccessibilityElementTest_performAction_asyncCallback_7200 + * @tc.desc Test performAction() when input is 'setText'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncCallback_7200', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncCallback_7200'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncCallback_7300 + * @tc.name AccessibilityElementTest_performAction_asyncCallback_7300 + * @tc.desc Test performAction() when input is 'delete'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncCallback_7300', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncCallback_7300'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncCallback_7400 + * @tc.name AccessibilityElementTest_performAction_asyncCallback_7400 + * @tc.desc Test performAction() when input is 'scrollForward'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncCallback_7400', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncCallback_7400'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncCallback_7500 + * @tc.name AccessibilityElementTest_performAction_asyncCallback_7500 + * @tc.desc Test performAction() when input is 'scrollBackward'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncCallback_7500', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncCallback_7500'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncCallback_7600 + * @tc.name AccessibilityElementTest_performAction_asyncCallback_7600 + * @tc.desc Test performAction() when input is 'setSelection'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncCallback_7600', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncCallback_7600'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_findElement_asyncCallback_7700 + * @tc.name AccessibilityElementTest_findElement_asyncCallback_7700 + * @tc.desc Test findElement() when input is 'content' and 'xxx', should return an AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_findElement_asyncCallback_7700', 0, async function (done) { + let caseName = 'AccessibilityElementTest_findElement_asyncCallback_7700'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_findElement_asyncCallback_7800 + * @tc.name AccessibilityElementTest_findElement_asyncCallback_7800 + * @tc.desc Test findElement() when input is 'content' and 'button1', should return an AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_findElement_asyncCallback_7800', 0, async function (done) { + let caseName = 'AccessibilityElementTest_findElement_asyncCallback_7800'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_findElement_asyncCallback_7900 + * @tc.name AccessibilityElementTest_findElement_asyncCallback_7900 + * @tc.desc Test findElement() when input is 'focusType' and 'accessibility', should return an AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_findElement_asyncCallback_7900', 0, async function (done) { + let caseName = 'AccessibilityElementTest_findElement_asyncCallback_7900'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_findElement_asyncCallback_8000 + * @tc.name AccessibilityElementTest_findElement_asyncCallback_8000 + * @tc.desc Test findElement() when input is 'focusType' and 'normal', should return an AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_findElement_asyncCallback_8000', 0, async function (done) { + let caseName = 'AccessibilityElementTest_findElement_asyncCallback_8000'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_findElement_asyncCallback_8100 + * @tc.name AccessibilityElementTest_findElement_asyncCallback_8100 + * @tc.desc Test findElement() when input is 'focusDirection' and 'up', should return an AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_findElement_asyncCallback_8100', 0, async function (done) { + let caseName = 'AccessibilityElementTest_findElement_asyncCallback_8100'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_findElement_asyncCallback_8200 + * @tc.name AccessibilityElementTest_findElement_asyncCallback_8200 + * @tc.desc Test findElement() when input is 'focusDirection' and 'down', should return an AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_findElement_asyncCallback_8200', 0, async function (done) { + let caseName = 'AccessibilityElementTest_findElement_asyncCallback_8200'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_findElement_asyncCallback_8300 + * @tc.name AccessibilityElementTest_findElement_asyncCallback_8300 + * @tc.desc Test findElement() when input is 'focusDirection' and 'left', should return an AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_findElement_asyncCallback_8300', 0, async function (done) { + let caseName = 'AccessibilityElementTest_findElement_asyncCallback_8300'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_findElement_asyncCallback_8400 + * @tc.name AccessibilityElementTest_findElement_asyncCallback_8400 + * @tc.desc Test findElement() when input is 'focusDirection' and 'right', should return an AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_findElement_asyncCallback_8400', 0, async function (done) { + let caseName = 'AccessibilityElementTest_findElement_asyncCallback_8400'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_findElement_asyncCallback_8500 + * @tc.name AccessibilityElementTest_findElement_asyncCallback_8500 + * @tc.desc Test findElement() when input is 'focusDirection' and 'forward', should return an AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_findElement_asyncCallback_8500', 0, async function (done) { + let caseName = 'AccessibilityElementTest_findElement_asyncCallback_8500'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_findElement_asyncCallback_8600 + * @tc.name AccessibilityElementTest_findElement_asyncCallback_8600 + * @tc.desc Test findElement() when input is 'focusDirection' and 'backward', should return an AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_findElement_asyncCallback_8600', 0, async function (done) { + let caseName = 'AccessibilityElementTest_findElement_asyncCallback_8600'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_findElement_asyncCallback_8700 + * @tc.name AccessibilityElementTest_findElement_asyncCallback_8700 + * @tc.desc Test findElement() when input is 'focusType' and 'xxx', should return an AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_findElement_asyncCallback_8700', 0, async function (done) { + let caseName = 'AccessibilityElementTest_findElement_asyncCallback_8700'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_findElement_asyncCallback_8800 + * @tc.name AccessibilityElementTest_findElement_asyncCallback_8800 + * @tc.desc Test findElement() when input is 'focusDirection' and 'xxx', should return an AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_findElement_asyncCallback_8800', 0, async function (done) { + let caseName = 'AccessibilityElementTest_findElement_asyncCallback_8800'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_performAction_asyncCallback_8900 + * @tc.name AccessibilityElementTest_performAction_asyncCallback_8900 + * @tc.desc Test performAction() when input is 'xxx'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_performAction_asyncCallback_8900', 0, async function (done) { + let caseName = 'AccessibilityElementTest_performAction_asyncCallback_8900'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityElementTest_attributeValue_asyncCallback_9000 + * @tc.name AccessibilityElementTest_attributeValue_asyncCallback_9000 + * @tc.desc Test attributeValue() when input is 'xxx', should catch error. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityElementTest_attributeValue_asyncCallback_9000', 0, async function (done) { + let caseName = 'AccessibilityElementTest_attributeValue_asyncCallback_9000'; + console.info(caseName + ' start'); + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': fail, for no caseResult'); + expect(null).assertFail(); + } + done(); + }, 2000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + }) +} \ No newline at end of file diff --git a/barrierfree/accessibilityelement/entry/src/main/ets/test/List.test.ets b/barrierfree/accessibilityelement/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..0a7a9a2d365a8751101b5f27f530533fb32c1354 --- /dev/null +++ b/barrierfree/accessibilityelement/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 './AccessibilityElement.test.ets' + +export default function testsuite(abilityContext) { + abilityTest(abilityContext) +} \ No newline at end of file diff --git a/barrierfree/accessibilityelement/entry/src/main/module.json b/barrierfree/accessibilityelement/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..e177762271d739d0b29aca18854a2bb1a188fd75 --- /dev/null +++ b/barrierfree/accessibilityelement/entry/src/main/module.json @@ -0,0 +1,57 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [{ + "name": "com.example.myapplication.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "visible": true, + "orientation": "portrait", + "skills": [{ + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + }] + }], + "extensionAbilities": [ + { + "name": "AccessibilityExtAbility", + "srcEntrance": "./ets/AccessibilityExtAbility/AccessibilityExtAbility.ts", + "label": "$string:Accessibility_label", + "description": "$string:Accessibility_desc", + "type": "accessibility", + "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" + } + ] + } +} \ No newline at end of file diff --git a/barrierfree/accessibilityelement/entry/src/main/resources/base/element/string.json b/barrierfree/accessibilityelement/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c41658408560320cd93303ad40568a8676301d00 --- /dev/null +++ b/barrierfree/accessibilityelement/entry/src/main/resources/base/element/string.json @@ -0,0 +1,40 @@ +{ + "string": [ + { + "name": "phone_entry_dsc", + "value": "i am an entry for phone" + }, + { + "name": "phone_entry_main", + "value": "the phone entry ability" + }, + { + "name": "entry_label", + "value": "ActsAccessibilityElementTest" + }, + { + "name": "form_description", + "value": "my form" + }, + { + "name": "serviceability_description", + "value": "my whether" + }, + { + "name": "description_application", + "value": "demo for test" + }, + { + "name": "app_name", + "value": "Demo" + }, + { + "name": "Accessibility_desc", + "value": "accessibility_description" + }, + { + "name": "Accessibility_label", + "value": "accessibility_label" + } + ] +} diff --git a/barrierfree/accessibilityelement/entry/src/main/resources/base/media/icon.png b/barrierfree/accessibilityelement/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibilityelement/entry/src/main/resources/base/media/icon.png differ diff --git a/barrierfree/accessibilityelement/entry/src/main/resources/base/profile/accessibility_config.json b/barrierfree/accessibilityelement/entry/src/main/resources/base/profile/accessibility_config.json new file mode 100644 index 0000000000000000000000000000000000000000..3d3227275e598a68ee5f405daacd72f36df7b674 --- /dev/null +++ b/barrierfree/accessibilityelement/entry/src/main/resources/base/profile/accessibility_config.json @@ -0,0 +1,7 @@ +{ + "accessibilityCapabilities": [ + "retrieve" + ], + "accessibilityCapabilityRationale": "a11y_rationale", + "settingsAbility": "com.accessibility.voiceaid.voiceAidSetting" +} \ No newline at end of file diff --git a/barrierfree/accessibilityelement/entry/src/main/resources/base/profile/main_pages.json b/barrierfree/accessibilityelement/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..821ecf2358ec52ffa8b0812267be3793be71896a --- /dev/null +++ b/barrierfree/accessibilityelement/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index/index" + ] +} \ No newline at end of file diff --git a/barrierfree/accessibilityelement/signature/openharmony_sx.p7b b/barrierfree/accessibilityelement/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..7ffcdc78527c5c1aa24520ab7e913c5f47c703f0 Binary files /dev/null and b/barrierfree/accessibilityelement/signature/openharmony_sx.p7b differ diff --git a/barrierfree/accessibilityevent/AppScope/app.json b/barrierfree/accessibilityevent/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..2c223fed485d736ab9906abf778f3d48eeb6c7cf --- /dev/null +++ b/barrierfree/accessibilityevent/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.myapplication", + "vendor": "huawei", + "versionCode": 1000000, + "versionName": "1.0.0", + "debug": false, + "icon": "$media:icon", + "label": "$string:app_name", + "description": "$string:description_application", + "distributedNotificationEnabled": true, + "keepAlive": true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} \ No newline at end of file diff --git a/barrierfree/accessibilityevent/AppScope/resources/base/element/string.json b/barrierfree/accessibilityevent/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ee69f9a861d9dc269ed6638735d52674583498e1 --- /dev/null +++ b/barrierfree/accessibilityevent/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string":[ + { + "name":"app_name", + "value":"ohosProject" + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessibilityevent/AppScope/resources/base/media/app_icon.png b/barrierfree/accessibilityevent/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..474a55588fd7216113dd42073aadf254d4dba023 Binary files /dev/null and b/barrierfree/accessibilityevent/AppScope/resources/base/media/app_icon.png differ diff --git a/barrierfree/accessibilityevent/BUILD.gn b/barrierfree/accessibilityevent/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..9502a6f66d5fc5ae96f0d40aabad1d0d19be91e9 --- /dev/null +++ b/barrierfree/accessibilityevent/BUILD.gn @@ -0,0 +1,41 @@ +# 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("ActsAccessibilityEventTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":accessibilityevent_js_assets", + ":accessibilityevent_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsAccessibilityEventTest" +} + +ohos_app_scope("accessibilityevent_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("accessibilityevent_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("accessibilityevent_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":accessibilityevent_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/barrierfree/accessibilityevent/Test.json b/barrierfree/accessibilityevent/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..a7606ed745a4538d346e08e5a4aef41b78b6b03d --- /dev/null +++ b/barrierfree/accessibilityevent/Test.json @@ -0,0 +1,26 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "180000", + "package": "com.example.myapplication", + "shell-timeout": "600000" + }, + "kits": [ + { + "test-file-name": [ + "aceTest.hap", + "ActsAccessibilityEventTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "teardown-command":[ + "bm uninstall -n com.example.myapplication", + "bm uninstall -n com.example.acetest" + ] + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessibilityevent/entry/src/main/ets/AccessibilityExtAbility/AccessibilityExtAbility.ts b/barrierfree/accessibilityevent/entry/src/main/ets/AccessibilityExtAbility/AccessibilityExtAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..f9903e79048ddd168fb9c0dee3d799d99200bf1b --- /dev/null +++ b/barrierfree/accessibilityevent/entry/src/main/ets/AccessibilityExtAbility/AccessibilityExtAbility.ts @@ -0,0 +1,63 @@ +/* + * 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 commonEvent from '@ohos.commonEvent'; + +class AccessibilityExtAbility extends AccessibilityExtensionAbility { + onConnect() { + console.info("[Demo] AccessibilityExtAbility onConnect"); + let commonEventPublishData = { + data: 'connect' + } + commonEvent.publish('onConnectState', commonEventPublishData, publishCallback); + + function publishCallback(err) { + console.info("[Demo] onConnect====>onConnect publish call back result:" + JSON.stringify(err)); + } + + this.context.setEventTypeFilter([ + 'accessibilityFocus', 'accessibilityFocusClear', 'click', 'longClick', 'focus', 'select', 'hoverEnter', + 'hoverExit', 'textUpdate', 'textSelectionUpdate', 'scroll' + ]); + } + + onDisconnect() { + console.info("[Demo] AccessibilityExtAbility onDisconnect"); + let commonEventPublishData = { + data: 'disconnect' + } + commonEvent.publish('onConnectState', commonEventPublishData, publishCallback); + + function publishCallback(err) { + console.info("[Demo] onDisconnect====>onConnect publish call back result:" + JSON.stringify(err)); + } + } + + onAccessibilityEvent(accessibilityEvent) { + console.info("[Demo] AccessibilityExtAbility onAccessibilityEvent: " + accessibilityEvent.eventType); + let commonEventPublishData = { + data: 'accessibilityEvent', + parameters: { + eventType: accessibilityEvent.eventType + } + } + commonEvent.publish('accessibilityEvent', commonEventPublishData, publishCallback); + + function publishCallback(err) { + console.info("[Demo] onAccessibilityEvent====>accessibilityEvent publish call back result:" + JSON.stringify(err)); + } + } +} +export default AccessibilityExtAbility; \ No newline at end of file diff --git a/barrierfree/accessibilityevent/entry/src/main/ets/Application/AbilityStage.ts b/barrierfree/accessibilityevent/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..1535a6b506bcd4a361ccbf5328e933e46a7b7e38 --- /dev/null +++ b/barrierfree/accessibilityevent/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,7 @@ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} diff --git a/barrierfree/accessibilityevent/entry/src/main/ets/MainAbility/MainAbility.ts b/barrierfree/accessibilityevent/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..699be869c24384a16829d10f83abd19264a89e7d --- /dev/null +++ b/barrierfree/accessibilityevent/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,38 @@ +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; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate windowStage="+ windowStage) + //globalThis.windowStage = windowStage + //globalThis.abilityStorage = this.storage + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index/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") + } +}; \ No newline at end of file diff --git a/barrierfree/accessibilityevent/entry/src/main/ets/pages/index/index.ets b/barrierfree/accessibilityevent/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..c0162edef1e6867f2be044948b3ead652aeb6fc3 --- /dev/null +++ b/barrierfree/accessibilityevent/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,56 @@ +/* + * 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 {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index" +import testsuite from "../../test/List.test" + +@Entry +@Component +struct Index { + @State message: string = 'accessibility event'; + + aboutToAppear(){ + console.info("start run testcase!!!!"); + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)); + globalThis.abilityWant.parameters.timeout = 70000; + configService.setConfig(globalThis.abilityWant.parameters); + testsuite(globalThis.abilityContext); + core.execute(); + } + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/barrierfree/accessibilityevent/entry/src/main/ets/test/AccessibilityEventTest.test.ets b/barrierfree/accessibilityevent/entry/src/main/ets/test/AccessibilityEventTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3be52456caaf47bcb70ce69fca879f499ce60634 --- /dev/null +++ b/barrierfree/accessibilityevent/entry/src/main/ets/test/AccessibilityEventTest.test.ets @@ -0,0 +1,412 @@ +/* + * 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 'deccjsunit/index' +import accessibility from '@ohos.accessibility' +import commonEvent from '@ohos.commonEvent' + +export default function abilityTest(abilityContext) { + let targetBundleName = 'com.example.myapplication'; + let subScriber = undefined; + let isConnected: boolean = false; + let eventTypes: Array = []; + + describe('AccessibilityEventTest', function () { + beforeAll(async function (done) { + console.info('AccessibilityEventTest beforeAll'); + subScriber = await commonEvent.createSubscriber({events: ['onConnectState', 'accessibilityEvent']}); + commonEvent.subscribe(subScriber, (err, data) => { + console.info('AccessibilityEventTest beforeAll data:' + JSON.stringify(data) ); + if (data.data == 'connect') { + isConnected = true; + } else if (data.data == 'disconnect') { + isConnected = false; + } else if (data.data == 'accessibilityEvent') { + eventTypes.push(data.parameters.eventType); + } + }); + + setTimeout(async () => { + await abilityContext.startAbility({ + deviceId: "", + bundleName: "com.example.acetest", + abilityName: "MainAbility", + action: "action1", + parameters: {}, + }); + done(); + }, 5000); + }) + + afterAll(async function (done) { + console.info('AccessibilityEventTest: afterAll'); + commonEvent.unsubscribe(subScriber); + isConnected = false; + done(); + }) + + beforeEach(async function (done) { + console.info(`AccessibilityEventTest: beforeEach`); + eventTypes.length = 0; + setTimeout(done, 2000); + }) + + afterEach(async function (done) { + console.info(`AccessibilityEventTest: afterEach`); + done(); + }) + + + /* + * @tc.number AccessibilityEventTest_0100 + * @tc.name AccessibilityEventTest_0100 + * @tc.desc The parameter input is 'accessibilityFocus', test the Ability event function, + * and return void. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityEventTest_0100', 0, async function (done) { + console.info(`AccessibilityEventTest_0100`); + let eventType = 'accessibilityFocus'; + let event = new accessibility.EventInfo({}); + event.type = eventType; + event.bundleName = targetBundleName; + event.triggerAction = 'accessibilityFocus'; + await accessibility.sendEvent(event); + + setTimeout(() => { + let types = eventTypes; + let findResult = false; + for (let type of types) { + if (type == eventType) { + findResult = true; + } + } + console.info('AccessibilityEventTest_0100 case: ' + findResult); + expect(findResult).assertTrue(); + done(); + }, 3000); + }) + + /* + * @tc.number AccessibilityEventTest_0200 + * @tc.name AccessibilityEventTest_0200 + * @tc.desc The parameter input is 'accessibilityFocusClear', test the Ability event function, + * and return void. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityEventTest_0200', 0, async function (done) { + console.info(`AccessibilityEventTest_0200`); + let eventType = 'accessibilityFocusClear'; + let event = new accessibility.EventInfo({}); + event.type = eventType; + event.bundleName = targetBundleName; + event.triggerAction = 'clearAccessibilityFocus'; + await accessibility.sendEvent(event); + + setTimeout(() => { + let types = eventTypes; + let findResult = false; + for (let type of types) { + if (type == eventType) { + findResult = true; + } + } + console.info('AccessibilityEventTest_0200 case: ' + findResult); + expect(findResult).assertTrue(); + done(); + }, 3000); + }) + + /* + * @tc.number AccessibilityEventTest_0300 + * @tc.name AccessibilityEventTest_0300 + * @tc.desc The parameter input is 'click', test the Ability event function, + * and return void. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityEventTest_0300', 0, async function (done) { + console.info(`AccessibilityEventTest_0300`); + let eventType = 'click'; + let event = new accessibility.EventInfo({}); + event.type = eventType; + event.bundleName = targetBundleName; + event.triggerAction = 'click'; + await accessibility.sendEvent(event); + + setTimeout(() => { + let types = eventTypes; + let findResult = false; + for (let type of types) { + if (type == eventType) { + findResult = true; + } + } + console.info('AccessibilityEventTest_0300 case: ' + findResult); + expect(findResult).assertTrue(); + done(); + }, 3000); + }) + + /* + * @tc.number AccessibilityEventTest_0400 + * @tc.name AccessibilityEventTest_0400 + * @tc.desc The parameter input is 'longClick', test the Ability event function, + * and return void. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityEventTest_0400', 0, async function (done) { + console.info(`AccessibilityEventTest_0400`); + let eventType = 'longClick'; + let event = new accessibility.EventInfo({}); + event.type = eventType; + event.bundleName = targetBundleName; + event.triggerAction = 'longClick'; + await accessibility.sendEvent(event); + + setTimeout(() => { + let types = eventTypes; + let findResult = false; + for (let type of types) { + if (type == eventType) { + findResult = true; + } + } + console.info('AccessibilityEventTest_0400 case: ' + findResult); + expect(findResult).assertTrue(); + done(); + }, 3000); + }) + + /* + * @tc.number AccessibilityEventTest_0500 + * @tc.name AccessibilityEventTest_0500 + * @tc.desc The parameter input is 'focus', test the Ability event function, + * and return void. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityEventTest_0500', 0, async function (done) { + console.info(`AccessibilityEventTest_0500`); + let eventType = 'focus'; + let event = new accessibility.EventInfo({}); + event.type = eventType; + event.bundleName = targetBundleName; + event.triggerAction = 'focus'; + await accessibility.sendEvent(event); + + setTimeout(() => { + let types = eventTypes; + let findResult = false; + for (let type of types) { + if (type == eventType) { + findResult = true; + } + } + console.info('AccessibilityEventTest_0500 case: ' + findResult); + expect(findResult).assertTrue(); + done(); + }, 3000); + }) + + /* + * @tc.number AccessibilityEventTest_0600 + * @tc.name AccessibilityEventTest_0600 + * @tc.desc The parameter input is 'select', test the Ability event function, + * and return void. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityEventTest_0600', 0, async function (done) { + console.info(`AccessibilityEventTest_0600`); + let eventType = 'select'; + let event = new accessibility.EventInfo({}); + event.type = eventType; + event.bundleName = targetBundleName; + event.triggerAction = 'select'; + await accessibility.sendEvent(event); + + setTimeout(() => { + let types = eventTypes; + let findResult = false; + for (let type of types) { + if (type == eventType) { + findResult = true; + } + } + console.info('AccessibilityEventTest_0600 case: ' + findResult); + expect(findResult).assertTrue(); + done(); + }, 3000); + }) + + /* + * @tc.number AccessibilityEventTest_0700 + * @tc.name AccessibilityEventTest_0700 + * @tc.desc The parameter input is 'hoverEnter', test the Ability event function, + * and return void. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityEventTest_0700', 0, async function (done) { + console.info(`AccessibilityEventTest_0700`); + let eventType = 'hoverEnter'; + let event = new accessibility.EventInfo({}); + event.type = eventType; + event.bundleName = targetBundleName; + event.triggerAction = 'focus'; + await accessibility.sendEvent(event); + + setTimeout(() => { + let types = eventTypes; + let findResult = false; + for (let type of types) { + if (type == eventType) { + findResult = true; + } + } + console.info('AccessibilityEventTest_0700 case: ' + findResult); + expect(findResult).assertTrue(); + done(); + }, 3000); + }) + + /* + * @tc.number AccessibilityEventTest_0800 + * @tc.name AccessibilityEventTest_0800 + * @tc.desc The parameter input is 'hoverExit', test the Ability event function, + * and return void. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityEventTest_0800', 0, async function (done) { + console.info(`AccessibilityEventTest_0800`); + let eventType = 'hoverExit'; + let event = new accessibility.EventInfo({}); + event.type = eventType; + event.bundleName = targetBundleName; + event.triggerAction = 'focus'; + await accessibility.sendEvent(event); + + setTimeout(() => { + let types = eventTypes; + let findResult = false; + for (let type of types) { + if (type == eventType) { + findResult = true; + } + } + console.info('AccessibilityEventTest_0800 case: ' + findResult); + expect(findResult).assertTrue(); + done(); + }, 3000); + }) + + /* + * @tc.number AccessibilityEventTest_0900 + * @tc.name AccessibilityEventTest_0900 + * @tc.desc The parameter input is 'textUpdate', test the Ability event function, + * and return void. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityEventTest_0900', 0, async function (done) { + console.info(`AccessibilityEventTest_0900`); + let eventType = 'textUpdate'; + let event = new accessibility.EventInfo({}); + event.type = eventType; + event.bundleName = targetBundleName; + event.triggerAction = 'cut'; + await accessibility.sendEvent(event); + + setTimeout(() => { + let types = eventTypes; + let findResult = false; + for (let type of types) { + if (type == eventType) { + findResult = true; + } + } + console.info('AccessibilityEventTest_0900 case: ' + findResult); + expect(findResult).assertTrue(); + done(); + }, 3000); + }) + + /* + * @tc.number AccessibilityEventTest_1000 + * @tc.name AccessibilityEventTest_1000 + * @tc.desc The parameter input is 'textSelectionUpdate', test the Ability event function, + * and return void. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityEventTest_1000', 0, async function (done) { + console.info(`AccessibilityEventTest_1000`); + let eventType = 'textSelectionUpdate'; + let event = new accessibility.EventInfo({}); + event.type = eventType; + event.bundleName = targetBundleName; + event.triggerAction = 'setSelection'; + await accessibility.sendEvent(event); + + setTimeout(() => { + let types = eventTypes; + let findResult = false; + for (let type of types) { + if (type == eventType) { + findResult = true; + } + } + console.info('AccessibilityEventTest_1000 case: ' + findResult); + expect(findResult).assertTrue(); + done(); + }, 3000); + }) + + /* + * @tc.number AccessibilityEventTest_1100 + * @tc.name AccessibilityEventTest_1100 + * @tc.desc The parameter input is 'scroll', test the Ability event function, + * and return void. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityEventTest_1100', 0, async function (done) { + console.info(`AccessibilityEventTest_1100`); + let eventType = 'scroll'; + let event = new accessibility.EventInfo({}); + event.type = eventType; + event.bundleName = targetBundleName; + event.triggerAction = 'scrollForward'; + await accessibility.sendEvent(event); + + setTimeout(() => { + let types = eventTypes; + let findResult = false; + for (let type of types) { + if (type == eventType) { + findResult = true; + } + } + console.info('AccessibilityEventTest_1100 case: ' + findResult); + expect(findResult).assertTrue(); + done(); + }, 3000); + }) + }) +} \ No newline at end of file diff --git a/barrierfree/accessibilityevent/entry/src/main/ets/test/List.test.ets b/barrierfree/accessibilityevent/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e6a15953e0321da02c67f83c07cec09232da6e39 --- /dev/null +++ b/barrierfree/accessibilityevent/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 './AccessibilityEventTest.test.ets' + +export default function testsuite(abilityContext) { + abilityTest(abilityContext) +} \ No newline at end of file diff --git a/barrierfree/accessibilityevent/entry/src/main/module.json b/barrierfree/accessibilityevent/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..e177762271d739d0b29aca18854a2bb1a188fd75 --- /dev/null +++ b/barrierfree/accessibilityevent/entry/src/main/module.json @@ -0,0 +1,57 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [{ + "name": "com.example.myapplication.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "visible": true, + "orientation": "portrait", + "skills": [{ + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + }] + }], + "extensionAbilities": [ + { + "name": "AccessibilityExtAbility", + "srcEntrance": "./ets/AccessibilityExtAbility/AccessibilityExtAbility.ts", + "label": "$string:Accessibility_label", + "description": "$string:Accessibility_desc", + "type": "accessibility", + "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" + } + ] + } +} \ No newline at end of file diff --git a/barrierfree/accessibilityevent/entry/src/main/resources/base/element/string.json b/barrierfree/accessibilityevent/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..7188213d4fb3500f27e244635d26f3415b7e7013 --- /dev/null +++ b/barrierfree/accessibilityevent/entry/src/main/resources/base/element/string.json @@ -0,0 +1,40 @@ +{ + "string": [ + { + "name": "phone_entry_dsc", + "value": "i am an entry for phone" + }, + { + "name": "phone_entry_main", + "value": "the phone entry ability" + }, + { + "name": "entry_label", + "value": "ActsAccessibilityEventTest" + }, + { + "name": "form_description", + "value": "my form" + }, + { + "name": "serviceability_description", + "value": "my whether" + }, + { + "name": "description_application", + "value": "demo for test" + }, + { + "name": "app_name", + "value": "Demo" + }, + { + "name": "Accessibility_desc", + "value": "accessibility_description" + }, + { + "name": "Accessibility_label", + "value": "accessibility_label" + } + ] +} diff --git a/barrierfree/accessibilityevent/entry/src/main/resources/base/media/icon.png b/barrierfree/accessibilityevent/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..474a55588fd7216113dd42073aadf254d4dba023 Binary files /dev/null and b/barrierfree/accessibilityevent/entry/src/main/resources/base/media/icon.png differ diff --git a/barrierfree/accessibilityevent/entry/src/main/resources/base/profile/accessibility_config.json b/barrierfree/accessibilityevent/entry/src/main/resources/base/profile/accessibility_config.json new file mode 100644 index 0000000000000000000000000000000000000000..3d3227275e598a68ee5f405daacd72f36df7b674 --- /dev/null +++ b/barrierfree/accessibilityevent/entry/src/main/resources/base/profile/accessibility_config.json @@ -0,0 +1,7 @@ +{ + "accessibilityCapabilities": [ + "retrieve" + ], + "accessibilityCapabilityRationale": "a11y_rationale", + "settingsAbility": "com.accessibility.voiceaid.voiceAidSetting" +} \ No newline at end of file diff --git a/barrierfree/accessibilityevent/entry/src/main/resources/base/profile/main_pages.json b/barrierfree/accessibilityevent/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..821ecf2358ec52ffa8b0812267be3793be71896a --- /dev/null +++ b/barrierfree/accessibilityevent/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index/index" + ] +} \ No newline at end of file diff --git a/barrierfree/accessibilityevent/signature/openharmony_sx.p7b b/barrierfree/accessibilityevent/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..7ffcdc78527c5c1aa24520ab7e913c5f47c703f0 Binary files /dev/null and b/barrierfree/accessibilityevent/signature/openharmony_sx.p7b differ diff --git a/barrierfree/accessibilityextension/AppScope/app.json b/barrierfree/accessibilityextension/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..2c223fed485d736ab9906abf778f3d48eeb6c7cf --- /dev/null +++ b/barrierfree/accessibilityextension/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.myapplication", + "vendor": "huawei", + "versionCode": 1000000, + "versionName": "1.0.0", + "debug": false, + "icon": "$media:icon", + "label": "$string:app_name", + "description": "$string:description_application", + "distributedNotificationEnabled": true, + "keepAlive": true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} \ No newline at end of file diff --git a/barrierfree/accessibilityextension/AppScope/resources/base/element/string.json b/barrierfree/accessibilityextension/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ee69f9a861d9dc269ed6638735d52674583498e1 --- /dev/null +++ b/barrierfree/accessibilityextension/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string":[ + { + "name":"app_name", + "value":"ohosProject" + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessibilityextension/AppScope/resources/base/media/app_icon.png b/barrierfree/accessibilityextension/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..474a55588fd7216113dd42073aadf254d4dba023 Binary files /dev/null and b/barrierfree/accessibilityextension/AppScope/resources/base/media/app_icon.png differ diff --git a/barrierfree/accessibilityextension/BUILD.gn b/barrierfree/accessibilityextension/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..5462a09b344dcc7a602674368ae754f7b03ceb00 --- /dev/null +++ b/barrierfree/accessibilityextension/BUILD.gn @@ -0,0 +1,41 @@ +# 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("ActsAccessibilityExtensionTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":accessibilityextension_js_assets", + ":accessibilityextension_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsAccessibilityExtensionTest" +} + +ohos_app_scope("accessibilityextension_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("accessibilityextension_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("accessibilityextension_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":accessibilityextension_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/barrierfree/accessibilityextension/Test.json b/barrierfree/accessibilityextension/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..0272039f7638b890a2667c4ce212721ce4db879d --- /dev/null +++ b/barrierfree/accessibilityextension/Test.json @@ -0,0 +1,26 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "60000", + "package": "com.example.myapplication", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "aceTest.hap", + "ActsAccessibilityExtensionTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "teardown-command":[ + "bm uninstall -n com.example.myapplication", + "bm uninstall -n com.example.acetest" + ] + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessibilityextension/entry/src/main/ets/AccessibilityExtAbility/AccessibilityExtAbility.ts b/barrierfree/accessibilityextension/entry/src/main/ets/AccessibilityExtAbility/AccessibilityExtAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..2c691a44573998f3cd2543e409216870674bfd0b --- /dev/null +++ b/barrierfree/accessibilityextension/entry/src/main/ets/AccessibilityExtAbility/AccessibilityExtAbility.ts @@ -0,0 +1,47 @@ +/* + * 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 commonEvent from '@ohos.commonEvent'; + +class AccessibilityExtAbility extends AccessibilityExtensionAbility { + onConnect() { + console.info("[Demo] AccessibilityExtAbility onConnect"); + let commonEventPublishData = { + data: 'connect' + } + commonEvent.publish('onConnectState', commonEventPublishData, publishCallback); + + function publishCallback(err) { + console.info("onConnect====>onConnect publish call back result:" + JSON.stringify(err)); + } + } + + onDisconnect() { + console.info("[Demo] AccessibilityExtAbility onDisconnect"); + let commonEventPublishData = { + data: 'disconnect' + } + commonEvent.publish('onConnectState', commonEventPublishData, publishCallback); + + function publishCallback(err) { + console.info("onDisconnect====>onConnect publish call back result:" + JSON.stringify(err)); + } + } + + onAccessibilityEvent(accessibilityEvent) { + console.info("[Demo] AccessibilityExtAbility onAccessibilityEvent"); + } +} +export default AccessibilityExtAbility; \ No newline at end of file diff --git a/barrierfree/accessibilityextension/entry/src/main/ets/Application/AbilityStage.ts b/barrierfree/accessibilityextension/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..1535a6b506bcd4a361ccbf5328e933e46a7b7e38 --- /dev/null +++ b/barrierfree/accessibilityextension/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,7 @@ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} diff --git a/barrierfree/accessibilityextension/entry/src/main/ets/MainAbility/MainAbility.ts b/barrierfree/accessibilityextension/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..699be869c24384a16829d10f83abd19264a89e7d --- /dev/null +++ b/barrierfree/accessibilityextension/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,38 @@ +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; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate windowStage="+ windowStage) + //globalThis.windowStage = windowStage + //globalThis.abilityStorage = this.storage + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index/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") + } +}; \ No newline at end of file diff --git a/barrierfree/accessibilityextension/entry/src/main/ets/pages/index/index.ets b/barrierfree/accessibilityextension/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..06b7ba152d18e3f085397d59eafa3504a702b96a --- /dev/null +++ b/barrierfree/accessibilityextension/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,56 @@ +/* + * 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 {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index" +import testsuite from "../../test/List.test" + +@Entry +@Component +struct Index { + @State message: string = 'accessibilityExtension'; + + aboutToAppear(){ + console.info("start run testcase!!!!"); + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)); + globalThis.abilityWant.parameters.timeout = 70000; + configService.setConfig(globalThis.abilityWant.parameters); + testsuite(globalThis.abilityContext); + core.execute(); + } + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/barrierfree/accessibilityextension/entry/src/main/ets/test/AccessibilityExtension.test.ets b/barrierfree/accessibilityextension/entry/src/main/ets/test/AccessibilityExtension.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..bc5db0fac7e4a28bf49aa1cdcb0289344682fbe8 --- /dev/null +++ b/barrierfree/accessibilityextension/entry/src/main/ets/test/AccessibilityExtension.test.ets @@ -0,0 +1,99 @@ +/* + * 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 'deccjsunit/index' +import commonEvent from '@ohos.commonEvent' + +export default function abilityTest(abilityContext) { + let isCalled: boolean = false; + let subScriber = undefined; + + describe('AccessibilityExtensionTest', function () { + beforeAll(async function (done) { + console.info('AccessibilityExtensionTest: beforeAll'); + subScriber = await commonEvent.createSubscriber({events: ['onConnectState']}); + commonEvent.subscribe(subScriber, (err, data) => { + console.info('AccessibilityExtensionTest beforeAll subscribe data:' + JSON.stringify(data) ); + isCalled = (data.data == 'connect'); + }); + setTimeout(done, 5000); + }) + + afterAll(async function (done) { + console.info('AccessibilityExtensionTest: afterAll'); + commonEvent.unsubscribe(subScriber); + done(); + }) + + beforeEach(async function (done) { + console.info(`AccessibilityExtensionTest: beforeEach`); + done(); + }) + + afterEach(async function (done) { + console.info(`AccessibilityExtensionTest: afterEach`); + done(); + }) + + + /* + * @tc.number AccessibilityExtensionTest_Connect_0100 + * @tc.name AccessibilityExtensionTest_Connect_0100 + * @tc.desc The parameter input is null, test the ExtensionAbility onConnect function, + * and return undefined + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionTest_Connect_0100', 0, async function (done) { + console.info('AccessibilityExtensionTest_Connect_0100: start'); + await abilityContext.startAbility({ + deviceId: "", + bundleName: "com.example.acetest", + abilityName: "MainAbility", + action: "action1", + parameters: {}, + }); + + setTimeout(() => { + console.info('AccessibilityExtensionTest_Connect_0100 isCalled : ' + isCalled); + expect(isCalled).assertEqual(true); + done(); + }, 5000); + }) + + /* + * @tc.number AccessibilityExtensionTest_Disconnect_0200 + * @tc.name AccessibilityExtensionTest_Disconnect_0200 + * @tc.desc The parameter input is null, test the ExtensionAbility onDisconnect function, + * and return undefined + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionTest_Disconnect_0200', 0, async function (done) { + console.info('AccessibilityExtensionTest_Disconnect_0200 start'); + let commonEventPublishData = { + data: 'disable' + } + commonEvent.publish('disableExtAbility', commonEventPublishData, (err) => { + console.info("AccessibilityExtensionTest_Disconnect_0200 publish event: " + JSON.stringify(commonEventPublishData)); + }); + + setTimeout(() => { + console.info('AccessibilityExtensionTest_Disconnect_0200 isCalled : ' + isCalled); + expect(isCalled).assertEqual(false); + done(); + }, 5000); + }) + }) +} \ No newline at end of file diff --git a/barrierfree/accessibilityextension/entry/src/main/ets/test/List.test.ets b/barrierfree/accessibilityextension/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..90ace0ffe68044fb4250a57b35aa9e479617a046 --- /dev/null +++ b/barrierfree/accessibilityextension/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 './AccessibilityExtension.test.ets' + +export default function testsuite(abilityContext) { + abilityTest(abilityContext) +} \ No newline at end of file diff --git a/barrierfree/accessibilityextension/entry/src/main/module.json b/barrierfree/accessibilityextension/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..e177762271d739d0b29aca18854a2bb1a188fd75 --- /dev/null +++ b/barrierfree/accessibilityextension/entry/src/main/module.json @@ -0,0 +1,57 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [{ + "name": "com.example.myapplication.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "visible": true, + "orientation": "portrait", + "skills": [{ + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + }] + }], + "extensionAbilities": [ + { + "name": "AccessibilityExtAbility", + "srcEntrance": "./ets/AccessibilityExtAbility/AccessibilityExtAbility.ts", + "label": "$string:Accessibility_label", + "description": "$string:Accessibility_desc", + "type": "accessibility", + "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" + } + ] + } +} \ No newline at end of file diff --git a/barrierfree/accessibilityextension/entry/src/main/resources/base/element/string.json b/barrierfree/accessibilityextension/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..4e9211ae1a3e24bf8c04a9df212fd3020d222577 --- /dev/null +++ b/barrierfree/accessibilityextension/entry/src/main/resources/base/element/string.json @@ -0,0 +1,40 @@ +{ + "string": [ + { + "name": "phone_entry_dsc", + "value": "i am an entry for phone" + }, + { + "name": "phone_entry_main", + "value": "the phone entry ability" + }, + { + "name": "entry_label", + "value": "ActsAccessibilityExtensionTest" + }, + { + "name": "form_description", + "value": "my form" + }, + { + "name": "serviceability_description", + "value": "my whether" + }, + { + "name": "description_application", + "value": "demo for test" + }, + { + "name": "app_name", + "value": "Demo" + }, + { + "name": "Accessibility_desc", + "value": "accessibility_description" + }, + { + "name": "Accessibility_label", + "value": "accessibility_label" + } + ] +} diff --git a/barrierfree/accessibilityextension/entry/src/main/resources/base/media/icon.png b/barrierfree/accessibilityextension/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..474a55588fd7216113dd42073aadf254d4dba023 Binary files /dev/null and b/barrierfree/accessibilityextension/entry/src/main/resources/base/media/icon.png differ diff --git a/barrierfree/accessibilityextension/entry/src/main/resources/base/profile/accessibility_config.json b/barrierfree/accessibilityextension/entry/src/main/resources/base/profile/accessibility_config.json new file mode 100644 index 0000000000000000000000000000000000000000..3d3227275e598a68ee5f405daacd72f36df7b674 --- /dev/null +++ b/barrierfree/accessibilityextension/entry/src/main/resources/base/profile/accessibility_config.json @@ -0,0 +1,7 @@ +{ + "accessibilityCapabilities": [ + "retrieve" + ], + "accessibilityCapabilityRationale": "a11y_rationale", + "settingsAbility": "com.accessibility.voiceaid.voiceAidSetting" +} \ No newline at end of file diff --git a/barrierfree/accessibilityextension/entry/src/main/resources/base/profile/main_pages.json b/barrierfree/accessibilityextension/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..821ecf2358ec52ffa8b0812267be3793be71896a --- /dev/null +++ b/barrierfree/accessibilityextension/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index/index" + ] +} \ No newline at end of file diff --git a/barrierfree/accessibilityextension/signature/openharmony_sx.p7b b/barrierfree/accessibilityextension/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..7ffcdc78527c5c1aa24520ab7e913c5f47c703f0 Binary files /dev/null and b/barrierfree/accessibilityextension/signature/openharmony_sx.p7b differ diff --git a/barrierfree/accessibilityextensioncontext/AppScope/app.json b/barrierfree/accessibilityextensioncontext/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..dca7d0ac3bfddb7f916c39e481820a46a19e12ae --- /dev/null +++ b/barrierfree/accessibilityextensioncontext/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.myapplication", + "vendor": "huawei", + "versionCode": 1000000, + "versionName": "1.0.0", + "debug": false, + "icon": "$media:icon", + "label": "$string:app_name", + "description": "$string:description_application", + "distributedNotificationEnabled": true, + "keepAlive": true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/barrierfree/accessibilityextensioncontext/AppScope/resources/base/element/string.json b/barrierfree/accessibilityextensioncontext/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..633100a6d90763bfac9d20aaae683119d7320e9c --- /dev/null +++ b/barrierfree/accessibilityextensioncontext/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string":[ + { + "name":"app_name", + "value":"ohosProject" + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessibilityextensioncontext/AppScope/resources/base/media/app_icon.png b/barrierfree/accessibilityextensioncontext/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..474a55588fd7216113dd42073aadf254d4dba023 Binary files /dev/null and b/barrierfree/accessibilityextensioncontext/AppScope/resources/base/media/app_icon.png differ diff --git a/barrierfree/accessibilityextensioncontext/BUILD.gn b/barrierfree/accessibilityextensioncontext/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..a8dd08140fc6773a0159c8b592f237d7cf7ea0ee --- /dev/null +++ b/barrierfree/accessibilityextensioncontext/BUILD.gn @@ -0,0 +1,41 @@ +# 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("ActsAccessibilityExtensionContextTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":accessibilityextensioncontext_js_assets", + ":accessibilityextensioncontext_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsAccessibilityExtensionContextTest" +} + +ohos_app_scope("accessibilityextensioncontext_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("accessibilityextensioncontext_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("accessibilityextensioncontext_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":accessibilityextensioncontext_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/barrierfree/accessibilityextensioncontext/Test.json b/barrierfree/accessibilityextensioncontext/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..0a3c2303a92c4988ada0af1b55581b6e702dc0b2 --- /dev/null +++ b/barrierfree/accessibilityextensioncontext/Test.json @@ -0,0 +1,26 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "360000", + "package": "com.example.myapplication", + "shell-timeout": "360000" + }, + "kits": [ + { + "test-file-name": [ + "aceTest.hap", + "ActsAccessibilityExtensionContextTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "teardown-command":[ + "bm uninstall -n com.example.myapplication", + "bm uninstall -n com.example.acetest" + ] + } + ] +} diff --git a/barrierfree/accessibilityextensioncontext/entry/src/main/ets/AccessibilityExtAbility/AccessibilityExtAbility.ts b/barrierfree/accessibilityextensioncontext/entry/src/main/ets/AccessibilityExtAbility/AccessibilityExtAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..bffdd1ade132d3b9abf541f585bb612f2833f72e --- /dev/null +++ b/barrierfree/accessibilityextensioncontext/entry/src/main/ets/AccessibilityExtAbility/AccessibilityExtAbility.ts @@ -0,0 +1,57 @@ +/* + * 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 commonEvent from '@ohos.commonEvent'; +import {ExtensionContextTest} from './ExtensionContextTest'; + +class AccessibilityExtAbility extends AccessibilityExtensionAbility { + tester: ExtensionContextTest = undefined; + + onConnect() { + console.info("[Demo] AccessibilityExtAbility onConnect"); + this.tester = new ExtensionContextTest(this.context); + this.tester.init(); + + let commonEventPublishData = { + data: 'connect' + } + commonEvent.publish('onConnectState', commonEventPublishData, publishCallback); + + function publishCallback(err) { + console.info("onConnect====>onConnect publish call back result:" + JSON.stringify(err)); + } + } + + onDisconnect() { + console.info("[Demo] AccessibilityExtAbility onDisconnect"); + let commonEventPublishData = { + data: 'disconnect' + } + commonEvent.publish('onConnectState', commonEventPublishData, publishCallback); + + function publishCallback(err) { + console.info("onDisconnect====>onConnect publish call back result:" + JSON.stringify(err)); + } + + this.tester.clear(); + this.tester = undefined; + } + + onAccessibilityEvent(accessibilityEvent) { + console.info("[Demo] AccessibilityExtAbility onAccessibilityEvent: " + accessibilityEvent.eventType); + } +} + +export default AccessibilityExtAbility; \ No newline at end of file diff --git a/barrierfree/accessibilityextensioncontext/entry/src/main/ets/AccessibilityExtAbility/ExtensionContextTest.ts b/barrierfree/accessibilityextensioncontext/entry/src/main/ets/AccessibilityExtAbility/ExtensionContextTest.ts new file mode 100644 index 0000000000000000000000000000000000000000..d58e2b1cfb6aa906a203e9e1c5e3ffc8d695d110 --- /dev/null +++ b/barrierfree/accessibilityextensioncontext/entry/src/main/ets/AccessibilityExtAbility/ExtensionContextTest.ts @@ -0,0 +1,780 @@ +/* + * 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 commonEvent from '@ohos.commonEvent'; +import display from '@ohos.display' +import accessibility from '@ohos.accessibility' + +export class ExtensionContextTest { + private context = undefined; + private subScriber = undefined; + + constructor(context) { + this.context = context; + } + + async init() { + this.subScriber = await commonEvent.createSubscriber({events: ['caseExecute']}); + commonEvent.subscribe(this.subScriber, (err, data) => { + console.info('ExtensionContextTest subscribe callback data:' + JSON.stringify(data)); + this.processCase(data.data); + }); + } + + clear() { + commonEvent.unsubscribe(this.subScriber); + this.subScriber = undefined; + this.context = undefined; + } + + private publishCaseResult(caseName: string, result: boolean) { + let commonEventPublishData = { + data: (result ? 'pass' : 'fail'), + parameters: { + case: caseName + } + } + commonEvent.publish('caseResult', commonEventPublishData, (err) => { + console.info("ExtensionContextTest publishCaseResult finish: " + JSON.stringify(commonEventPublishData)); + }); + } + + private async processCase(caseName) { + console.info('ExtensionContextTest processCase: ' + caseName); + let eventType: Array = []; + let bundleName: Array = []; + let windowId = -1; + let displayId = -1; + let gesturePath = {}; + let gesturePos1 = {}; + let gesturePos2 = {}; + let gesturePos3 = {}; + + switch (caseName) { + case 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0100': + eventType = ['accessibilityFocus']; + this.setEventTypeFilterCallback(caseName, eventType); + break; + case 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0200': + eventType = ['accessibilityFocusClear']; + this.setEventTypeFilterCallback(caseName, eventType); + break; + case 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0300': + eventType = ['click', 'longClick']; + this.setEventTypeFilterCallback(caseName, eventType); + break; + case 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0400': + eventType = ['focus', 'select']; + this.setEventTypeFilterCallback(caseName, eventType); + break; + case 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0500': + eventType = ['hoverEnter', 'hoverExit']; + this.setEventTypeFilterCallback(caseName, eventType); + break; + case 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0600': + eventType = ['accessibilityFocus', 'accessibilityFocusClear', 'click', 'longClick', + 'focus', 'select', 'hoverEnter', 'hoverExit', 'textUpdate', 'textSelectionUpdate','scroll']; + this.setEventTypeFilterCallback(caseName, eventType); + break; + case 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0700': + this.setEventTypeFilterCallback(caseName, eventType); + break; + case 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_0800': + eventType = ['accessibilityFocus']; + this.setEventTypeFilterPromise(caseName, eventType); + break; + case 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_0900': + eventType = ['accessibilityFocusClear']; + this.setEventTypeFilterPromise(caseName, eventType); + break; + case 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_1000': + eventType = ['click', 'longClick']; + this.setEventTypeFilterPromise(caseName, eventType); + break; + case 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_1100': + eventType = ['focus', 'select']; + this.setEventTypeFilterPromise(caseName, eventType); + break; + case 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_1200': + eventType = ['hoverEnter', 'hoverExit']; + this.setEventTypeFilterPromise(caseName, eventType); + break; + case 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_1300': + eventType = ['accessibilityFocus', 'accessibilityFocusClear', 'click', 'longClick', + 'focus', 'select', 'hoverEnter', 'hoverExit', 'textUpdate', 'textSelectionUpdate','scroll']; + this.setEventTypeFilterPromise(caseName, eventType); + break; + case 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_1400': + this.setEventTypeFilterPromise(caseName, eventType); + break; + case 'AccessibilityExtensionContextTest_setTargetBundleName_asyncCallback_1500': + bundleName = ['com.example.accessibleformextension']; + this.setTargetBundleNameCallback(caseName, bundleName); + break; + case 'AccessibilityExtensionContextTest_setTargetBundleName_asyncCallback_1600': + bundleName = ['aaa']; + this.setTargetBundleNameCallback(caseName, bundleName); + break; + case 'AccessibilityExtensionContextTest_setTargetBundleName_asyncCallback_1700': + this.setTargetBundleNameCallback(caseName, bundleName); + break; + case 'AccessibilityExtensionContextTest_setTargetBundleName_asyncPromise_1800': + bundleName = ['com.example.accessibleformextension']; + this.setTargetBundleNamePromise(caseName, bundleName); + break; + case 'AccessibilityExtensionContextTest_setTargetBundleName_asyncPromise_1900': + bundleName = ['aaa']; + this.setTargetBundleNamePromise(caseName, bundleName); + break; + case 'AccessibilityExtensionContextTest_setTargetBundleName_asyncPromise_2000': + this.setTargetBundleNamePromise(caseName, bundleName); + break; + case 'AccessibilityExtensionContextTest_getWindowRootElement_asyncCallback_2100': + this.getWindowRootElementCallback(caseName); + break; + case 'AccessibilityExtensionContextTest_getWindowRootElement_asyncCallback_2200': + windowId = await this.getWindowIdByText('button1'); + this.getWindowRootElementByIdCallback(caseName, windowId); + break; + case 'AccessibilityExtensionContextTest_getWindowRootElement_asyncCallback_2300': + windowId = 1000; + this.getWindowRootElementByIdCallback(caseName, windowId); + break; + case 'AccessibilityExtensionContextTest_getWindowRootElement_asyncCallback_2400': + windowId = -1; + this.getWindowRootElementByIdCallback(caseName, windowId); + break; + case 'AccessibilityExtensionContextTest_getWindowRootElement_Promise_2500': + windowId = await this.getWindowId(); + this.getWindowRootElementByIdPromise(caseName, windowId); + break; + case 'AccessibilityExtensionContextTest_getWindowRootElement_Promise_2600': + windowId = 1000; + this.getWindowRootElementByIdPromise(caseName, windowId); + break; + case 'AccessibilityExtensionContextTest_getWindowRootElement_Promise_2700': + windowId = -1; + this.getWindowRootElementByIdPromise(caseName, windowId); + break; + case 'AccessibilityExtensionContextTest_getWindows_asyncCallback_2800': + this.getWindowsCallback(caseName); + break; + case 'AccessibilityExtensionContextTest_getWindows_asyncCallback_2900': + displayId = await this.getDisPlayId(); + this.getWindowsByIdCallback(caseName, displayId); + break; + case 'AccessibilityExtensionContextTest_getWindows_asyncCallback_3000': + displayId = 100; + this.getWindowsByIdCallback(caseName, displayId); + break; + case 'AccessibilityExtensionContextTest_getWindows_asyncCallback_3100': + displayId = -1; + this.getWindowsByIdCallback(caseName, displayId); + break; + case 'AccessibilityExtensionContextTest_getWindows_Promise_3200': + displayId = await this.getDisPlayId(); + this.getWindowsByIdPromise(caseName, displayId); + break; + case 'AccessibilityExtensionContextTest_getWindows_Promise_3300': + displayId = 100; + this.getWindowsByIdPromise(caseName, displayId); + break; + case 'AccessibilityExtensionContextTest_getWindows_Promise_3400': + displayId = -1; + this.getWindowsByIdPromise(caseName, displayId); + break; + case 'AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3500': + await this.setAccessibilityFocus(); + this.getFocusElementCallback(caseName, true); + break; + case 'AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3600': + await this.clearAccessibilityFocus(); + this.getFocusElementCallback(caseName, false); + break; + case 'AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3700': + await this.setAccessibilityFocus(); + this.getFocusElementByTypeCallback(caseName, true, true); + break; + case 'AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3800': + await this.setAccessibilityFocus(); + this.getFocusElementByTypeCallback(caseName, true, false); + break; + case 'AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3900': + await this.clearAccessibilityFocus(); + this.getFocusElementByTypeCallback(caseName, false, true); + break; + case 'AccessibilityExtensionContextTest_getFocusElement_asyncCallback_4000': + await this.clearAccessibilityFocus(); + this.getFocusElementByTypeCallback(caseName, false, false); + break; + case 'AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4100': + await this.setAccessibilityFocus(); + this.getFocusElementByTypePromise(caseName, true, true); + break; + case 'AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4200': + await this.setAccessibilityFocus(); + this.getFocusElementByTypePromise(caseName, true, false); + break; + case 'AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4300': + await this.clearAccessibilityFocus(); + this.getFocusElementByTypePromise(caseName, false, true); + break; + case 'AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4400': + await this.clearAccessibilityFocus(); + this.getFocusElementByTypePromise(caseName, false, false); + break; + case 'AccessibilityExtensionContextTest_gestureInject_asyncCallback_4500': + gesturePos1 = {positionX: 10, positionY: 10}; + gesturePath = {points: [gesturePos1], durationTime: 100}; + this.gestureInjectCallback(caseName, gesturePath); + break; + case 'AccessibilityExtensionContextTest_gestureInject_asyncCallback_4600': + gesturePos1 = {positionX: 50, positionY: 50}; + gesturePath = {points: [gesturePos1], durationTime: 60000}; + this.gestureInjectCallback(caseName, gesturePath); + break; + case 'AccessibilityExtensionContextTest_gestureInject_asyncCallback_4700': + gesturePos1 = {positionX: 200, positionY: 200}; + gesturePos2 = {positionX: 100, positionY: 100}; + gesturePath = {points: [gesturePos1, gesturePos2], durationTime: 1000}; + this.gestureInjectCallback(caseName, gesturePath); + break; + case 'AccessibilityExtensionContextTest_gestureInject_asyncCallback_4800': + gesturePos1 = {positionX: 50, positionY: 50}; + gesturePos2 = {positionX: 100, positionY: 100}; + gesturePos3 = {positionX: 1000, positionY: 1000}; + gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3], durationTime: 60000}; + this.gestureInjectCallback(caseName, gesturePath); + break; + case 'AccessibilityExtensionContextTest_gestureInject_asyncCallback_4900': + gesturePath = undefined; + this.gestureInjectCallback(caseName, gesturePath); + break; + case 'AccessibilityExtensionContextTest_gestureInject_asyncPromise_5000': + gesturePos1 = {positionX: 10, positionY: 10}; + gesturePath = {points: [gesturePos1], durationTime: 100}; + this.gestureInjectPromise(caseName, gesturePath); + break; + case 'AccessibilityExtensionContextTest_gestureInject_asyncPromise_5100': + gesturePos1 = {positionX: 50, positionY: 50}; + gesturePath = {points: [gesturePos1], durationTime: 60000}; + this.gestureInjectPromise(caseName, gesturePath); + break; + case 'AccessibilityExtensionContextTest_gestureInject_asyncPromise_5200': + gesturePos1 = {positionX: 200, positionY: 200}; + gesturePos2 = {positionX: 100, positionY: 100}; + gesturePath = {points: [gesturePos1, gesturePos2], durationTime: 1000}; + this.gestureInjectPromise(caseName, gesturePath); + break; + case 'AccessibilityExtensionContextTest_gestureInject_asyncPromise_5300': + gesturePos1 = {positionX: 50, positionY: 50}; + gesturePos2 = {positionX: 100, positionY: 100}; + gesturePos3 = {positionX: 1000, positionY: 1000}; + gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3], durationTime: 60000}; + this.gestureInjectPromise(caseName, gesturePath); + break; + case 'AccessibilityExtensionContextTest_gestureInject_asyncPromise_5400': + gesturePath = undefined; + this.gestureInjectPromise(caseName, gesturePath); + break; + default: + console.warn('ExtensionContextTest processCase unknown!!!!!!!!!!'); + break; + } + } + + private async getWindowId() { + let windowId = -1; + let rootNode = await this.context.getWindowRootElement(); + console.info("getWindowId rootNode: " + JSON.stringify(rootNode)); + if (rootNode) { + windowId = await rootNode.attributeValue('windowId'); + console.info("getWindowId windowId: " + JSON.stringify(windowId)); + } + return windowId; + } + + private async getWindowIdByText(text: string) { + let windowId = -1; + let rootNode = await this.context.getWindowRootElement(); + console.info("getWindowId rootNode: " + JSON.stringify(rootNode)); + if (rootNode) { + let tartgetNode = await rootNode.findElement('content', text); + console.info("getWindowId tartgetNode: " + JSON.stringify(tartgetNode)); + if (tartgetNode) { + windowId = await tartgetNode[0].attributeValue('windowId'); + console.info("getWindowId windowId: " + JSON.stringify(windowId)); + } + } + return windowId; + } + + private async getDisPlayId() { + let displayId = -1; + display.getDefaultDisplay((err, data) => { + if (err.code != 0) { + console.error("getDisPlayId getDefaultDisplay error"); + } else { + console.info("getDisPlayId getDefaultDisplay data.id: " + JSON.stringify(data.id)); + displayId = data.id; + } + }); + return displayId; + } + + private async getRoot() { + let rootNode = undefined; + if (this.context) { + let rootNode = await this.context.getWindowRootElement(); + console.info("getRoot rootNode: " + JSON.stringify(rootNode)); + } + return rootNode; + } + + private async setAccessibilityFocus() { + let isFocus = false; + if (this.context) { + let rootNode = await this.context.getWindowRootElement(); + console.info("setAccessibilityFocus rootNode: " + JSON.stringify(rootNode)); + if (rootNode) { + let tartgetNode = await rootNode.findElement('content', 'button1'); + console.info("setAccessibilityFocus tartgetNode: " + JSON.stringify(tartgetNode)); + if (tartgetNode) { + isFocus = await tartgetNode[0].performAction("accessibilityFocus"); + console.info("setAccessibilityFocus isFocus: " + JSON.stringify(isFocus)); + } + } + } + } + + private async clearAccessibilityFocus() { + let isFocus = false; + if (this.context) { + let rootNode = await this.context.getWindowRootElement(); + console.info("setAccessibilityFocus rootNode: " + JSON.stringify(rootNode)); + if (rootNode) { + let tartgetNode = await rootNode.findElement('content', 'button1'); + console.info("setAccessibilityFocus tartgetNode: " + JSON.stringify(tartgetNode)); + if (tartgetNode) { + isFocus = await tartgetNode[0].performAction("clearAccessibilityFocus"); + console.info("setAccessibilityFocus isFocus: " + JSON.stringify(isFocus)); + } + } + } + } + + private async setEventTypeFilterCallback(caseName: string, eventType: Array) { + let result = false; + if (eventType.length == 0) { + this.context.setEventTypeFilter(eventType, (err, res) => { + console.info(caseName + " res: " + JSON.stringify(res)); + if (err.code != 0 ) { + console.error(caseName + " err: " + JSON.stringify(err.code)); + result = true; + } + if (res == undefined) { + result = true; + } + this.publishCaseResult(caseName, result); + }); + } else { + this.context.setEventTypeFilter(eventType, (err, res) => { + console.info(caseName + " res: " + JSON.stringify(res)); + if (err.code != 0 ) { + console.error(caseName + " err: " + JSON.stringify(err.code)); + } + if (typeof(res) == 'boolean') { + result = true; + } + this.publishCaseResult(caseName, result); + }); + } + } + + private async setEventTypeFilterPromise(caseName: string, eventType: Array) { + let result = false; + if (eventType.length == 0) { + this.context.setEventTypeFilter(eventType).then((res) => { + console.info(caseName + " res: " + JSON.stringify(res)); + if (res == undefined) { + result = true; + } + this.publishCaseResult(caseName, result); + }).catch((error) => { + console.error(caseName + " error: " + JSON.stringify(error)); + result = true; + this.publishCaseResult(caseName, result); + }); + } else { + this.context.setEventTypeFilter(eventType).then((res) => { + console.info(caseName + " res: " + JSON.stringify(res)); + if (typeof(res) == 'boolean') { + result = true; + } + this.publishCaseResult(caseName, result); + }).catch((error) => { + console.error(caseName + " error: " + JSON.stringify(error)); + this.publishCaseResult(caseName, result); + }); + } + } + + private async setTargetBundleNameCallback(caseName: string, bundleName: Array) { + let result = false; + this.context.setTargetBundleName(bundleName, (err, res) => { + console.info(caseName + " res: " + JSON.stringify(res)); + if (err.code != 0) { + console.error(caseName + " err: " + JSON.stringify(err.code)); + } + if (typeof(res) == 'boolean') { + result = true; + } + this.publishCaseResult(caseName, result); + }); + } + + private async setTargetBundleNamePromise(caseName: string, bundleName: Array) { + let result = false; + this.context.setTargetBundleName(bundleName).then((res) => { + console.info(caseName + " res: " + JSON.stringify(res)); + if (typeof(res) == 'boolean') { + result = true; + } + this.publishCaseResult(caseName, result); + }); + } + + private async getWindowRootElementCallback(caseName: string) { + let result = false; + this.context.getWindowRootElement(async (err, res) => { + console.info(caseName + " res: " + JSON.stringify(res)); + if (err.code != 0) { + console.error(caseName + " err: " + JSON.stringify(err.code)); + } + if (res == undefined) { + console.error(caseName + " res is undefined"); + } + if (res) { + let value = await res.attributeValue('componentId'); + if (typeof(value) == 'number') { + result = true; + } + } + this.publishCaseResult(caseName, result); + }); + } + + private async getWindowRootElementByIdCallback(caseName: string, windowId: number) { + let result = false; + if ((windowId == -1) || (windowId == 1000)){ + this.context.getWindowRootElement(-1, async (err, res) => { + console.info(caseName + " res: " + JSON.stringify(res)); + if (err.code != 0) { + console.error(caseName + " err: " + JSON.stringify(err.code)); + result = true + } + if (res == undefined) { + console.error(caseName + " res is undefined"); + result = true + } + this.publishCaseResult(caseName, result); + }); + } else { + this.context.getWindowRootElement(windowId, async (err, res) => { + console.info(caseName + " res: " + JSON.stringify(res)); + if (err.code != 0) { + console.error(caseName + " err: " + JSON.stringify(err.code)); + } + if (res == undefined) { + console.error(caseName + " res is undefined"); + } + if (res) { + let value = await res.attributeValue('componentId'); + if (typeof(value) == 'number') { + result = true; + } + } + this.publishCaseResult(caseName, result); + }); + } + } + + private async getWindowRootElementByIdPromise(caseName: string, windowId: number) { + let result = false; + if ((windowId == -1) || (windowId == 1000)){ + this.context.getWindowRootElement(-1).then(async (res) => { + console.info(caseName + " res: " + JSON.stringify(res)); + if (res == undefined) { + console.error(caseName + " res is undefined"); + result = true; + } + + this.publishCaseResult(caseName, result); + }).catch((error) => { + console.error(caseName + " error: " + JSON.stringify(error)); + result = true; + this.publishCaseResult(caseName, result); + }); + } else { + this.context.getWindowRootElement(windowId).then(async (res) => { + console.info(caseName + " res: " + JSON.stringify(res)); + if (res == undefined) { + console.error(caseName + " res is undefined"); + } + if (res) { + let value = await res.attributeValue('componentId'); + if (typeof(value) == 'number') { + result = true; + } + } + this.publishCaseResult(caseName, result); + }).catch((error) => { + console.error(caseName + " error: " + JSON.stringify(error)); + this.publishCaseResult(caseName, result); + }); + } + } + + + private async getWindowsCallback(caseName: string) { + let result = false; + this.context.getWindows((err, res) => { + console.info(caseName + " res: " + JSON.stringify(res)); + if (err.code != 0) { + console.error(caseName + " err: " + JSON.stringify(err.code)); + } + if (res == undefined) { + console.error(caseName + " res is undefined"); + } + if (res) { + if (Array.isArray(res)) { + result = true; + } + } + this.publishCaseResult(caseName, result); + }); + } + + private async getWindowsByIdCallback(caseName: string, displayId: number) { + let result = false; + console.info(caseName + " displayId: " + JSON.stringify(displayId)); + if (displayId == -1) { + this.context.getWindows(displayId, (err, res) => { + console.info(caseName + " res: " + JSON.stringify(res)); + if (err.code != 0) { + console.error(caseName + " err: " + JSON.stringify(err.code)); + result = true; + } + this.publishCaseResult(caseName, result); + }); + } else { + this.context.getWindows(displayId, (err, res) => { + console.info(caseName + " res: " + JSON.stringify(res)); + if (err.code != 0) { + console.error(caseName + " err: " + JSON.stringify(err.code)); + } + if (res) { + if (Array.isArray(res)) { + result = true; + } + } + this.publishCaseResult(caseName, result); + }); + } + } + + private async getWindowsByIdPromise(caseName: string, displayId: number) { + let result = false; + console.info(caseName + " displayId: " + JSON.stringify(displayId)); + if (displayId == -1) { + this.context.getWindows(-1, (err, res) => { + console.info(caseName + " res: " + JSON.stringify(res)); + if (err.code != 0) { + console.error(caseName + " err: " + JSON.stringify(err.code)); + result = true; + } + this.publishCaseResult(caseName, result); + }); + } else { + this.context.getWindows(displayId, (err, res) => { + console.info(caseName + " res: " + JSON.stringify(res)); + if (err.code != 0) { + console.error(caseName + " err: " + JSON.stringify(err.code)); + } + if (res) { + if (Array.isArray(res)) { + result = true; + } + } + this.publishCaseResult(caseName, result); + }); + } + } + + private async getFocusElementCallback(caseName: string, hasFocus: boolean) { + let result = false; + this.context.getFocusElement((err, res) => { + console.info(caseName + "res: " + JSON.stringify(res)); + if (err.code != 0) { + console.error(caseName + "err: " + JSON.stringify(err.code)); + result = true; + } + if (res == undefined) { + result = true; + } + this.publishCaseResult(caseName, result); + }); + } + + private async getFocusElementByTypeCallback(caseName: string, hasFocus: boolean, isAccessibilityFocus: boolean) { + let result = false; + if (isAccessibilityFocus) { + this.context.getFocusElement(true, async (err, res) => { + console.info(caseName + "res: " + JSON.stringify(res)); + if (hasFocus) { + let value = await res.attributeValue('componentId'); + console.info(caseName + "value: " + JSON.stringify(value)); + if (typeof(value) == 'number') { + result = true; + } + this.publishCaseResult(caseName, result); + } else { + if (err.code != 0) { + console.error(caseName + "err: " + JSON.stringify(err.code)); + result = true; + } + if (res == undefined) { + result = true; + } + this.publishCaseResult(caseName, result); + } + }); + } else { + this.context.getFocusElement(false, (err, res) => { + console.info(caseName + "res: " + JSON.stringify(res)); + if (err.code != 0) { + console.error(caseName + "err: " + JSON.stringify(err.code)); + result = true; + } + if (res == undefined) { + result = true; + } + this.publishCaseResult(caseName, result); + }); + } + } + + private async getFocusElementByTypePromise(caseName: string, hasFocus: boolean, isAccessibilityFocus: boolean) { + let result = false; + if (isAccessibilityFocus) { + this.context.getFocusElement(true).then(async (res) => { + console.info(caseName + " res: " + JSON.stringify(res)); + if (hasFocus) { + let value = await res.attributeValue('componentId'); + console.info(caseName + "value: " + JSON.stringify(value)); + if (typeof(value) == 'number') { + result = true; + } + this.publishCaseResult(caseName, result); + } else { + if (res == undefined) { + result = true; + } + this.publishCaseResult(caseName, result); + } + }).catch((err) => { + console.error(caseName + 'error:' + JSON.stringify(err)); + if (!hasFocus) { + result = true; + } + this.publishCaseResult(caseName, result); + }); + } else { + this.context.getFocusElement(false).then(async (res) => { + console.info(caseName + " res: " + JSON.stringify(res)); + if (res == undefined) { + result = true; + } + this.publishCaseResult(caseName, result); + }).catch((err) => { + result = true; + console.error(caseName + 'error:' + JSON.stringify(err)); + this.publishCaseResult(caseName, result); + }); + } + } + + private async gestureInjectCallback(caseName: string, gesturePath: object) { + let result = false; + if (gesturePath == undefined) { + this.context.gestureInject(gesturePath, () => {}, (err, res) => { + console.info(caseName + " res: " + JSON.stringify(res)); + if (err.code != 0) { + console.error(caseName + " err: " + JSON.stringify(err.code)); + result = true; + } + if (res == undefined) { + result = true; + } + this.publishCaseResult(caseName, result); + }); + } else { + this.context.gestureInject(gesturePath, () => {}, (err, res) => { + console.info(caseName + " res: " + JSON.stringify(res)); + if (err.code != 0) { + console.error(caseName + " err: " + JSON.stringify(err.code)); + } + if (typeof(res) == 'boolean') { + result = true; + } + if (res == undefined) { + result = false; + } + this.publishCaseResult(caseName, result); + }); + } + } + + + private async gestureInjectPromise(caseName: string, gesturePath: object) { + let result = false; + if (gesturePath == undefined) { + this.context.gestureInject(gesturePath, () => {}).then((res) => { + console.info(caseName + " res: " + JSON.stringify(res)); + if (res == undefined) { + result = true; + } + this.publishCaseResult(caseName, result); + }).catch ((err) => { + console.error(caseName + 'error:' + JSON.stringify(err)); + result = true; + this.publishCaseResult(caseName, result); + }); + } else { + this.context.gestureInject(gesturePath, () => {}).then((res) => { + console.info(caseName + " res: " + JSON.stringify(res)); + if (typeof(res) == 'boolean') { + result = true; + } + if (res == undefined) { + result = false; + } + this.publishCaseResult(caseName, result); + }).catch ((err) => { + console.error(caseName + 'error:' + JSON.stringify(err)); + this.publishCaseResult(caseName, result); + }); + } + } +} \ No newline at end of file diff --git a/barrierfree/accessibilityextensioncontext/entry/src/main/ets/Application/AbilityStage.ts b/barrierfree/accessibilityextensioncontext/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..32dfe93ccff0375201857794de902cec4d239442 --- /dev/null +++ b/barrierfree/accessibilityextensioncontext/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,7 @@ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/barrierfree/accessibilityextensioncontext/entry/src/main/ets/MainAbility/MainAbility.ts b/barrierfree/accessibilityextensioncontext/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..d99a69a5a823f2eb8e447326af915497ddfb3d25 --- /dev/null +++ b/barrierfree/accessibilityextensioncontext/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,38 @@ +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; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate windowStage="+ windowStage) + //globalThis.windowStage = windowStage + //globalThis.abilityStorage = this.storage + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index/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") + } +}; diff --git a/barrierfree/accessibilityextensioncontext/entry/src/main/ets/pages/index/index.ets b/barrierfree/accessibilityextensioncontext/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..5b59712d541ea9a3fc6a1f18c0c7a2a53b006d76 --- /dev/null +++ b/barrierfree/accessibilityextensioncontext/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,56 @@ +/* + * 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 {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index" +import testsuite from "../../test/List.test" + +@Entry +@Component +struct Index { + @State message: string = 'Extension Context'; + + aboutToAppear(){ + console.info("start run testcase!!!!"); + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)); + globalThis.abilityWant.parameters.timeout = 70000; + configService.setConfig(globalThis.abilityWant.parameters); + testsuite(globalThis.abilityContext); + core.execute(); + } + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/barrierfree/accessibilityextensioncontext/entry/src/main/ets/test/AccessibilityExtensionContext.test.ets b/barrierfree/accessibilityextensioncontext/entry/src/main/ets/test/AccessibilityExtensionContext.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8a9adcafe9456ffae333792910e3fe6b07e56199 --- /dev/null +++ b/barrierfree/accessibilityextensioncontext/entry/src/main/ets/test/AccessibilityExtensionContext.test.ets @@ -0,0 +1,1804 @@ +/* + * 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 'deccjsunit/index' +import commonEvent from '@ohos.commonEvent' + +const passStr = 'pass'; +const failStr = 'fail'; + +function publishCaseExecute(caseName: string) { + let commonEventPublishData = { + data: caseName + } + + commonEvent.publish('caseExecute', commonEventPublishData, (err) => { + console.info('caseExecute publish [' + caseName + '] callback result: ' + JSON.stringify(err)); + }); +} + +export default function abilityTest(abilityContext) { + describe('AccessibilityExtensionContextTest', function () { + let subScriber = undefined; + let isConnect = false; + let caseResult = undefined; + + beforeAll(async function (done) { + console.info('AccessibilityExtensionContextTest: beforeAll'); + subScriber = await commonEvent.createSubscriber({events: ['onConnectState', 'caseResult']}); + commonEvent.subscribe(subScriber, (err, data) => { + console.info('AccessibilityExtensionContextTest beforeAll data:' + JSON.stringify(data) ); + if (data.data == 'connect') { + isConnect = true; + } else if (data.data == 'disconnect') { + isConnect = false; + } else if (data.data == passStr || data.data == failStr) { + caseResult = data; + } + }); + + await abilityContext.startAbility({ + deviceId: '', + bundleName: 'com.example.acetest', + abilityName: 'MainAbility', + action: 'action1', + parameters: {}, + }); + setTimeout(done, 3000); + }) + + afterAll(async function (done) { + console.info('AccessibilityElementTest: afterAll'); + commonEvent.unsubscribe(subScriber); + isConnect = false; + done(); + }) + + beforeEach(async function (done) { + console.info('AccessibilityElementTest: beforeEach'); + caseResult = undefined; + done(); + }) + + afterEach(async function (done) { + console.info('AccessibilityElementTest: afterEach'); + done(); + }) + + /* + * @tc.number AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0100 + * @tc.name AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0100 + * @tc.desc The parameter input is type of event, test the setEventTypeFilter() function, + * The result of setEventTypeFilter() should be boolean type + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0100', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0100'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0200 + * @tc.name AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0200 + * @tc.desc The parameter input is type of event, test the setEventTypeFilter() function, + * The result of setEventTypeFilter() should be boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0200', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0200'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0300 + * @tc.name AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0300 + * @tc.desc The parameter input is type of event, test the setEventTypeFilter() function, + * The result of setEventTypeFilter() should be boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0300', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0300'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0400 + * @tc.name AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0400 + * @tc.desc The parameter input is type of event, test the setEventTypeFilter() function, + * The result of setEventTypeFilter() should be boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0400', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0400'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0500 + * @tc.name AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0500 + * @tc.desc The parameter input is type of event, test the setEventTypeFilter() function, + * The result of setEventTypeFilter() should be boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0500', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0500'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0600 + * @tc.name AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0600 + * @tc.desc The parameter input is type of event, test the setEventTypeFilter() function, + * The result of setEventTypeFilter() should be boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0600', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0600'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0700 + * @tc.name AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0700 + * @tc.desc The parameter input is type of event, test the setEventTypeFilter() function, + * The result of setEventTypeFilter() should be boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0700', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncCallback_0700'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_0800 + * @tc.name AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_0800 + * @tc.desc The parameter input is type of event, test the setEventTypeFilter() function, + * The result of setEventTypeFilter() should be boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_0800', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_0800'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_0900 + * @tc.name AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_0900 + * @tc.desc The parameter input is type of event, test the setEventTypeFilter() function, + * The result of setEventTypeFilter() should be boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_0900', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_0900'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_1000 + * @tc.name AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_1000 + * @tc.desc The parameter input is type of event, test the setEventTypeFilter() function, + * The result of setEventTypeFilter() should be boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_1000', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_1000'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_1100 + * @tc.name AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_1100 + * @tc.desc The parameter input is type of event, test the setEventTypeFilter() function, + * The result of setEventTypeFilter() should be boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_1100', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_1100'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_1200 + * @tc.name AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_1200 + * @tc.desc The parameter input is type of event, test the setEventTypeFilter() function, + * The result of setEventTypeFilter() should be boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_1200', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_1200'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_1300 + * @tc.name AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_1300 + * @tc.desc The parameter input is type of event, test the setEventTypeFilter() function, + * The result of setEventTypeFilter() should be boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_1300', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_1300'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_1400 + * @tc.name AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_1400 + * @tc.desc The parameter input is type of event, test the setEventTypeFilter() function, + * The result of setEventTypeFilter() should be boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_1400', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_setEventTypeFilter_asyncPromise_1400'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_setTargetBundleName_asyncCallback_1500 + * @tc.name AccessibilityExtensionContextTest_setTargetBundleName_asyncCallback_1500 + * @tc.desc The parameter input is 'com.example.accessibleformextension', + * test the setTargetBundleName() function, + * The result of setTargetBundleName() should be boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_setTargetBundleName_asyncCallback_1500', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_setTargetBundleName_asyncCallback_1500'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_setTargetBundleName_asyncCallback_1600 + * @tc.name AccessibilityExtensionContextTest_setTargetBundleName_asyncCallback_1600 + * @tc.desc The parameter input is 'com.example.accessibleformextension', + * test the setTargetBundleName() function, + * The result of setTargetBundleName() should be boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_setTargetBundleName_asyncCallback_1600', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_setTargetBundleName_asyncCallback_1600'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_setTargetBundleName_asyncCallback_1700 + * @tc.name AccessibilityExtensionContextTest_setTargetBundleName_asyncCallback_1700 + * @tc.desc The parameter input is 'com.example.accessibleformextension', + * test the setTargetBundleName() function, + * The result of setTargetBundleName() should be boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_setTargetBundleName_asyncCallback_1700', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_setTargetBundleName_asyncCallback_1700'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_setTargetBundleName_asyncPromise_1800 + * @tc.name AccessibilityExtensionContextTest_setTargetBundleName_asyncPromise_1800 + * @tc.desc The parameter input is 'com.example.accessibleformextension', + * test the setTargetBundleName() function, + * The result of setTargetBundleName() should be boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_setTargetBundleName_asyncPromise_1800', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_setTargetBundleName_asyncPromise_1800'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_setTargetBundleName_asyncPromise_1900 + * @tc.name AccessibilityExtensionContextTest_setTargetBundleName_asyncPromise_1900 + * @tc.desc The parameter input is 'com.example.accessibleformextension', + * test the setTargetBundleName() function, + * The result of setTargetBundleName() should be boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_setTargetBundleName_asyncPromise_1900', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_setTargetBundleName_asyncPromise_1900'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_setTargetBundleName_asyncPromise_2000 + * @tc.name AccessibilityExtensionContextTest_setTargetBundleName_asyncPromise_2000 + * @tc.desc The parameter input is 'com.example.accessibleformextension', + * test the setTargetBundleName() function, + * The result of setTargetBundleName() should be boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_setTargetBundleName_asyncPromise_2000', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_setTargetBundleName_asyncPromise_2000'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_getWindowRootElement_asyncCallback_2100 + * @tc.name AccessibilityExtensionContextTest_getWindowRootElement_asyncCallback_2100 + * @tc.desc The parameter input is null, + * The result of getWindowRootElement() should be AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_getWindowRootElement_asyncCallback_2100', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_getWindowRootElement_asyncCallback_2100'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_getWindowRootElement_asyncCallback_2300 + * @tc.name AccessibilityExtensionContextTest_getWindowRootElement_asyncCallback_2300 + * @tc.desc The parameter input is windowId, test the getWindowRootElement() function. + * The result of getWindowRootElement() should be AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_getWindowRootElement_asyncCallback_2300', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_getWindowRootElement_asyncCallback_2300'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_getWindowRootElement_asyncCallback_2400 + * @tc.name AccessibilityExtensionContextTest_getWindowRootElement_asyncCallback_2400 + * @tc.desc The parameter input is windowId, test the getWindowRootElement() function. + * The result of getWindowRootElement() should be AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_getWindowRootElement_asyncCallback_2400', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_getWindowRootElement_asyncCallback_2400'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + + /* + * @tc.number AccessibilityExtensionContextTest_getWindowRootElement_Promise_2600 + * @tc.name AccessibilityExtensionContextTest_getWindowRootElement_Promise_2600 + * @tc.desc The parameter input is windowId, test the getWindowRootElement() function. + * The result of getWindowRootElement() should be AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_getWindowRootElement_Promise_2600', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_getWindowRootElement_Promise_2600'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_getWindowRootElement_Promise_2700 + * @tc.name AccessibilityExtensionContextTest_getWindowRootElement_Promise_2700 + * @tc.desc The parameter input is windowId, test the getWindowRootElement() function. + * The result of getWindowRootElement() should be AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_getWindowRootElement_Promise_2700', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_getWindowRootElement_Promise_2700'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_getWindows_asyncCallback_2800 + * @tc.name AccessibilityExtensionContextTest_getWindows_asyncCallback_2800 + * @tc.desc The parameter input is null, test the getWindows() function, + * The result of getWindows() should be Array type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_getWindows_asyncCallback_2800', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_getWindows_asyncCallback_2800'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_getWindows_asyncCallback_2900 + * @tc.name AccessibilityExtensionContextTest_getWindows_asyncCallback_2900 + * @tc.desc The parameter input is dispalyId, test the getWindows() function, + * The result of getWindows() should be Array type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_getWindows_asyncCallback_2900', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_getWindows_asyncCallback_2900'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_getWindows_asyncCallback_3000 + * @tc.name AccessibilityExtensionContextTest_getWindows_asyncCallback_3000 + * @tc.desc The parameter input is dispalyId, test the getWindows() function, + * The result of getWindows() should be Array type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_getWindows_asyncCallback_3000', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_getWindows_asyncCallback_3000'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_getWindows_asyncCallback_3100 + * @tc.name AccessibilityExtensionContextTest_getWindows_asyncCallback_3100 + * @tc.desc The parameter input is dispalyId, test the getWindows() function, + * The result of getWindows() should be Array type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_getWindows_asyncCallback_3100', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_getWindows_asyncCallback_3100'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_getWindows_Promise_3200 + * @tc.name AccessibilityExtensionContextTest_getWindows_Promise_3200 + * @tc.desc The parameter input is dispalyId, test the getWindows() function, + * The result of getWindows() should be Array type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_getWindows_Promise_3200', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_getWindows_Promise_3200'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_getWindows_Promise_3300 + * @tc.name AccessibilityExtensionContextTest_getWindows_Promise_3300 + * @tc.desc The parameter input is dispalyId, test the getWindows() function, + * The result of getWindows() should be Array type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_getWindows_Promise_3300', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_getWindows_Promise_3300'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_getWindows_Promise_3400 + * @tc.name AccessibilityExtensionContextTest_getWindows_Promise_3400 + * @tc.desc The parameter input is dispalyId, test the getWindows() function, + * The result of getWindows() should be Array type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_getWindows_Promise_3400', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_getWindows_Promise_3400'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3500 + * @tc.name AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3500 + * @tc.desc The parameter input is null, test the getFocusElement() function, + * The result of getFocusElement() should be AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3500', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3500'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3600 + * @tc.name AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3600 + * @tc.desc The parameter input is null, test the getFocusElement() function, + * The result of getFocusElement() should be AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3600', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3600'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + + /* + * @tc.number AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3700 + * @tc.name AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3700 + * @tc.desc The parameter input is true, test the getFocusElement() function, + * The result of getFocusElement() should be AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3700', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3700'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3800 + * @tc.name AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3800 + * @tc.desc The parameter input is false, test the getFocusElement() function, + * The result of getFocusElement() should be AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3800', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3800'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3900 + * @tc.name AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3900 + * @tc.desc The parameter input is true, test the getFocusElement() function, + * The result of getFocusElement() should be AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3900', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_getFocusElement_asyncCallback_3900'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_getFocusElement_asyncCallback_4000 + * @tc.name AccessibilityExtensionContextTest_getFocusElement_asyncCallback_4000 + * @tc.desc The parameter input is false, test the getFocusElement() function, + * The result of getFocusElement() should be AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_getFocusElement_asyncCallback_4000', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_getFocusElement_asyncCallback_4000'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4100 + * @tc.name AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4100 + * @tc.desc The parameter input is true, test the getFocusElement() function, + * The result of getFocusElement() should be AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4100', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4100'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + + /* + * @tc.number AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4200 + * @tc.name AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4200 + * @tc.desc The parameter input is false, test the getFocusElement() function, + * The result of getFocusElement() should be AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4200', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4200'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4300 + * @tc.name AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4300 + * @tc.desc The parameter input is true, test the getFocusElement() function, + * The result of getFocusElement() should be AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4300', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4300'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4400 + * @tc.name AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4400 + * @tc.desc The parameter input is false, test the getFocusElement() function, + * The result of getFocusElement() should be AccessibilityElement type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4400', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_getFocusElement_asyncPromise_4400'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_gestureInject_asyncCallback_4500 + * @tc.name AccessibilityExtensionContextTest_gestureInject_asyncCallback_4500 + * @tc.desc The parameter input is gesturePath, test the gestureInject() function. + * The result of gestureInject() should be boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_gestureInject_asyncCallback_4500', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_gestureInject_asyncCallback_4500'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_gestureInject_asyncCallback_4600 + * @tc.name AccessibilityExtensionContextTest_gestureInject_asyncCallback_4600 + * @tc.desc The parameter input is gesturePath, test the gestureInject() function. + * The result of gestureInject() should be boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_gestureInject_asyncCallback_4600', 0, async function(done) { + let caseName = 'AccessibilityExtensionContextTest_gestureInject_asyncCallback_4600'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_gestureInject_asyncCallback_4700 + * @tc.name AccessibilityExtensionContextTest_gestureInject_asyncCallback_4700 + * @tc.desc The parameter input is gesturePath, test the gestureInject() function. + * The result of gestureInject() should be boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_gestureInject_asyncCallback_4700', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_gestureInject_asyncCallback_4700'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_gestureInject_asyncCallback_4800 + * @tc.name AccessibilityExtensionContextTest_gestureInject_asyncCallback_4800 + * @tc.desc The parameter input is gesturePath, test the gestureInject() function. + * The result of gestureInject() should be boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_gestureInject_asyncCallback_4800', 0, async function(done) { + let caseName = 'AccessibilityExtensionContextTest_gestureInject_asyncCallback_4800'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_gestureInject_asyncCallback_4900 + * @tc.name AccessibilityExtensionContextTest_gestureInject_asyncCallback_4900 + * @tc.desc The parameter input is gesturePath, test the gestureInject() function. + * The result of gestureInject() should be boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_gestureInject_asyncCallback_4900', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_gestureInject_asyncCallback_4900'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_gestureInject_asyncPromise_5000 + * @tc.name AccessibilityExtensionContextTest_gestureInject_asyncPromise_5000 + * @tc.desc The parameter input is gesturePath, test the gestureInject() function. + * The result of gestureInject() should be boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_gestureInject_asyncPromise_5000', 0, async function(done) { + let caseName = 'AccessibilityExtensionContextTest_gestureInject_asyncPromise_5000'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_gestureInject_asyncPromise_5100 + * @tc.name AccessibilityExtensionContextTest_gestureInject_asyncPromise_5100 + * @tc.desc The parameter input is gesturePath, test the gestureInject() function. + * The result of gestureInject() should be boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_gestureInject_asyncPromise_5100', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_gestureInject_asyncPromise_5100'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_gestureInject_asyncPromise_5200 + * @tc.name AccessibilityExtensionContextTest_gestureInject_asyncPromise_5200 + * @tc.desc The parameter input is gesturePath, test the gestureInject() function. + * The result of gestureInject() should be boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_gestureInject_asyncPromise_5200', 0, async function(done) { + let caseName = 'AccessibilityExtensionContextTest_gestureInject_asyncPromise_5200'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_gestureInject_asyncPromise_5300 + * @tc.name AccessibilityExtensionContextTest_gestureInject_asyncPromise_5300 + * @tc.desc The parameter input is gesturePath, test the gestureInject() function. + * The result of gestureInject() should be boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_gestureInject_asyncPromise_5300', 0, async function (done) { + let caseName = 'AccessibilityExtensionContextTest_gestureInject_asyncPromise_5300'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityExtensionContextTest_gestureInject_asyncPromise_5400 + * @tc.name AccessibilityExtensionContextTest_gestureInject_asyncPromise_5400 + * @tc.desc The parameter input is gesturePath, test the gestureInject() function. + * The result of gestureInject() should be boolean type. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityExtensionContextTest_gestureInject_asyncPromise_5400', 0, async function(done) { + let caseName = 'AccessibilityExtensionContextTest_gestureInject_asyncPromise_5400'; + console.info(caseName + 'start'); + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + if (caseResult != undefined) { + console.info(caseName + ':' + caseResult.data); + expect(passStr).assertEqual(caseResult.data); + expect(caseName).assertEqual(caseResult.parameters.case); + } else { + console.info(caseName + ': caseResult is undefined'); + expect(null).assertFail(); + } + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + }) +} diff --git a/barrierfree/accessibilityextensioncontext/entry/src/main/ets/test/List.test.ets b/barrierfree/accessibilityextensioncontext/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..bd2650fa6dbf24c6b805c780fd1f59d13897c7e6 --- /dev/null +++ b/barrierfree/accessibilityextensioncontext/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 './AccessibilityExtensionContext.test.ets' + +export default function testsuite(abilityContext) { + abilityTest(abilityContext) +} \ No newline at end of file diff --git a/barrierfree/accessibilityextensioncontext/entry/src/main/module.json b/barrierfree/accessibilityextensioncontext/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..3de0d6652f656474b0bbe564eb97a70440aa9ef8 --- /dev/null +++ b/barrierfree/accessibilityextensioncontext/entry/src/main/module.json @@ -0,0 +1,57 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [{ + "name": "com.example.myapplication.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "visible": true, + "orientation": "portrait", + "skills": [{ + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + }] + }], + "extensionAbilities": [ + { + "name": "AccessibilityExtAbility", + "srcEntrance": "./ets/AccessibilityExtAbility/AccessibilityExtAbility.ts", + "label": "$string:Accessibility_label", + "description": "$string:Accessibility_desc", + "type": "accessibility", + "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" + } + ] + } +} \ No newline at end of file diff --git a/barrierfree/accessibilityextensioncontext/entry/src/main/resources/base/element/string.json b/barrierfree/accessibilityextensioncontext/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..caccebe85978bae1eaa236f53d98dc3fbbaa3923 --- /dev/null +++ b/barrierfree/accessibilityextensioncontext/entry/src/main/resources/base/element/string.json @@ -0,0 +1,40 @@ +{ + "string": [ + { + "name": "phone_entry_dsc", + "value": "i am an entry for phone" + }, + { + "name": "phone_entry_main", + "value": "the phone entry ability" + }, + { + "name": "entry_label", + "value": "ActsAccessibilityExtensionTest" + }, + { + "name": "form_description", + "value": "my form" + }, + { + "name": "serviceability_description", + "value": "my whether" + }, + { + "name": "description_application", + "value": "demo for test" + }, + { + "name": "app_name", + "value": "Demo" + }, + { + "name": "Accessibility_desc", + "value": "accessibility_description" + }, + { + "name": "Accessibility_label", + "value": "accessibility_label" + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessibilityextensioncontext/entry/src/main/resources/base/media/icon.png b/barrierfree/accessibilityextensioncontext/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..474a55588fd7216113dd42073aadf254d4dba023 Binary files /dev/null and b/barrierfree/accessibilityextensioncontext/entry/src/main/resources/base/media/icon.png differ diff --git a/barrierfree/accessibilityextensioncontext/entry/src/main/resources/base/profile/accessibility_config.json b/barrierfree/accessibilityextensioncontext/entry/src/main/resources/base/profile/accessibility_config.json new file mode 100644 index 0000000000000000000000000000000000000000..c3562ab303d502e6d285bf9daae51fad0f07367a --- /dev/null +++ b/barrierfree/accessibilityextensioncontext/entry/src/main/resources/base/profile/accessibility_config.json @@ -0,0 +1,9 @@ +{ + "accessibilityCapabilities": [ + "retrieve", + "touchGuide", + "gesture" + ], + "accessibilityCapabilityRationale": "a11y_rationale", + "settingsAbility": "com.accessibility.voiceaid.voiceAidSetting" +} \ No newline at end of file diff --git a/barrierfree/accessibilityextensioncontext/entry/src/main/resources/base/profile/main_pages.json b/barrierfree/accessibilityextensioncontext/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..ae231ba6ddcfbdfdcb3648055e256939888a69af --- /dev/null +++ b/barrierfree/accessibilityextensioncontext/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index/index" + ] +} diff --git a/barrierfree/accessibilityextensioncontext/signature/openharmony_sx.p7b b/barrierfree/accessibilityextensioncontext/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..7ffcdc78527c5c1aa24520ab7e913c5f47c703f0 Binary files /dev/null and b/barrierfree/accessibilityextensioncontext/signature/openharmony_sx.p7b differ diff --git a/barrierfree/accessibilitygestureevent/AppScope/app.json b/barrierfree/accessibilitygestureevent/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..f7a233546d78f91a143b0ac31db62f19b3279b89 --- /dev/null +++ b/barrierfree/accessibilitygestureevent/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.myapplication", + "vendor": "huawei", + "versionCode": 1000000, + "versionName": "1.0.0", + "debug": false, + "icon": "$media:icon", + "label": "$string:app_name", + "description": "$string:description_application", + "distributedNotificationEnabled": true, + "keepAlive": true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/barrierfree/accessibilitygestureevent/AppScope/resources/base/element/string.json b/barrierfree/accessibilitygestureevent/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ee69f9a861d9dc269ed6638735d52674583498e1 --- /dev/null +++ b/barrierfree/accessibilitygestureevent/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string":[ + { + "name":"app_name", + "value":"ohosProject" + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessibilitygestureevent/AppScope/resources/base/media/app_icon.png b/barrierfree/accessibilitygestureevent/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..474a55588fd7216113dd42073aadf254d4dba023 Binary files /dev/null and b/barrierfree/accessibilitygestureevent/AppScope/resources/base/media/app_icon.png differ diff --git a/barrierfree/accessibilitygestureevent/BUILD.gn b/barrierfree/accessibilitygestureevent/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..a438d31dfee3b470d71d5046ca62963764514f83 --- /dev/null +++ b/barrierfree/accessibilitygestureevent/BUILD.gn @@ -0,0 +1,41 @@ +# 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("ActsAccessibilityGestureEventTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":accessibilitygestureevent_js_assets", + ":accessibilitygestureevent_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsAccessibilityGestureEventTest" +} + +ohos_app_scope("accessibilitygestureevent_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("accessibilitygestureevent_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("accessibilitygestureevent_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":accessibilitygestureevent_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/barrierfree/accessibilitygestureevent/Test.json b/barrierfree/accessibilitygestureevent/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..06cdba7a8dab3b0246b9c73cea3b9fe84505075a --- /dev/null +++ b/barrierfree/accessibilitygestureevent/Test.json @@ -0,0 +1,26 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "180000", + "package": "com.example.myapplication", + "shell-timeout": "180000" + }, + "kits": [ + { + "test-file-name": [ + "aceTest.hap", + "ActsAccessibilityGestureEventTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "teardown-command":[ + "bm uninstall -n com.example.myapplication", + "bm uninstall -n com.example.acetest" + ] + } + ] +} diff --git a/barrierfree/accessibilitygestureevent/entry/src/main/ets/AccessibilityExtAbility/AccessibilityExtAbility.ts b/barrierfree/accessibilitygestureevent/entry/src/main/ets/AccessibilityExtAbility/AccessibilityExtAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..ef0c6a824cd05a1dc7585cdf37ec498a62029404 --- /dev/null +++ b/barrierfree/accessibilitygestureevent/entry/src/main/ets/AccessibilityExtAbility/AccessibilityExtAbility.ts @@ -0,0 +1,76 @@ +/* + * 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 commonEvent from '@ohos.commonEvent'; +import {GestureEventTest} from './GestureEventTest'; + +class AccessibilityExtAbility extends AccessibilityExtensionAbility { + tester: GestureEventTest = undefined; + + onConnect() { + console.info("[Demo] AccessibilityExtAbility onConnect"); + this.tester = new GestureEventTest(this.context); + this.tester.init(); + + let commonEventPublishData = { + data: 'connect' + } + commonEvent.publish('onConnectState', commonEventPublishData, publishCallback); + + function publishCallback(err) { + console.info("onConnect====>onConnect publish call back result:" + JSON.stringify(err)); + } + + this.context.setEventTypeFilter(['gesture']); + } + + onDisconnect() { + console.info("[Demo] AccessibilityExtAbility onDisconnect"); + let commonEventPublishData = { + data: 'disconnect' + } + commonEvent.publish('onConnectState', commonEventPublishData, publishCallback); + + function publishCallback(err) { + console.info("onDisconnect====>onConnect publish call back result:" + JSON.stringify(err)); + } + + this.tester.clear(); + this.tester = undefined; + } + + onAccessibilityEvent(accessibilityEvent) { + let type = accessibilityEvent.eventType; + console.info("[Demo] AccessibilityExtAbility onAccessibilityEvent: " + type); + if (type === 'left' || type === 'leftThenRight' || type === 'leftThenUp' || type === 'leftThenDown' + || type === 'right' || type === 'rightThenLeft' || type === 'rightThenUp' || type === 'rightThenDown' + || type === 'up' || type === 'upThenLeft' || type === 'upThenRight' || type === 'upThenDown' + || type === 'down' || type === 'downThenLeft' || type === 'downThenRight' || type === 'downThenUp') { + let commonEventPublishData = { + data: 'accessibilityEvent', + parameters: { + eventType: type + } + } + commonEvent.publish('accessibilityEvent', commonEventPublishData, publishCallback); + } + + function publishCallback(err) { + console.info("[Demo] onAccessibilityEvent====>accessibilityEvent publish call back result:" + JSON.stringify(err)); + } + } +} + +export default AccessibilityExtAbility; \ No newline at end of file diff --git a/barrierfree/accessibilitygestureevent/entry/src/main/ets/AccessibilityExtAbility/GestureEventTest.ts b/barrierfree/accessibilitygestureevent/entry/src/main/ets/AccessibilityExtAbility/GestureEventTest.ts new file mode 100644 index 0000000000000000000000000000000000000000..0faa9db9e1ee66f4c20fbb1298a5d14df2ab076f --- /dev/null +++ b/barrierfree/accessibilitygestureevent/entry/src/main/ets/AccessibilityExtAbility/GestureEventTest.ts @@ -0,0 +1,286 @@ +/* + * 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 commonEvent from '@ohos.commonEvent'; + +export class GestureEventTest { + private context = undefined; + private subScriber = undefined; + + constructor(context) { + this.context = context; + } + + async init() { + this.subScriber = await commonEvent.createSubscriber({events: ['caseExecute']}); + commonEvent.subscribe(this.subScriber, (err, data) => { + console.info('GestureEventTest subscribe callback data:' + JSON.stringify(data)); + this.processCase(data.data); + }); + } + + clear() { + commonEvent.unsubscribe(this.subScriber); + this.subScriber = undefined; + this.context = undefined; + } + + private async processCase(caseName) { + console.info('GestureEventTest processCase start'); + let gesturePath = {}; + let gesturePos1 = {}; + let gesturePos2 = {}; + let gesturePos3 = {}; + let gesturePos4 = {}; + let gesturePos5 = {}; + let gesturePos6 = {}; + let gesturePos7 = {}; + let gesturePos8 = {}; + let gesturePos9 = {}; + let gesturePos10 = {}; + let gesturePos11 = {}; + switch (caseName) { + case 'AccessibilityGestureEventTest_0100'://'left' + console.info('GestureEventTest processCase left'); + gesturePos1 = {positionX: 676, positionY: 735}; + gesturePos2 = {positionX: 567, positionY: 729}; + gesturePos3 = {positionX: 444, positionY: 719}; + gesturePos4 = {positionX: 255, positionY: 714}; + gesturePos5 = {positionX: 153, positionY: 715}; + gesturePos6 = {positionX: 15, positionY: 729}; + gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5, gesturePos6], durationTime: 100}; + this.gestureInject(caseName, gesturePath); + break; + case 'AccessibilityGestureEventTest_0200'://'leftThenRight' + console.info('GestureEventTest processCase leftThenRight'); + gesturePos1 = {positionX: 685, positionY: 798}; + gesturePos2 = {positionX: 575, positionY: 792}; + gesturePos3 = {positionX: 446, positionY: 785}; + gesturePos4 = {positionX: 285, positionY: 784}; + gesturePos5 = {positionX: 206, positionY: 785}; + gesturePos6 = {positionX: 87, positionY: 787}; + gesturePos7 = {positionX: 401, positionY: 772}; + gesturePos8 = {positionX: 535, positionY: 786}; + gesturePos9 = {positionX: 714, positionY: 806}; + gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5, + gesturePos6, gesturePos7, gesturePos8, gesturePos9], durationTime: 100}; + this.gestureInject(caseName, gesturePath); + break; + case 'AccessibilityGestureEventTest_0300'://'leftThenUp' + console.info('GestureEventTest processCase leftThenUp'); + gesturePos1 = {positionX: 652, positionY: 903}; + gesturePos2 = {positionX: 570, positionY: 905}; + gesturePos3 = {positionX: 460, positionY: 920}; + gesturePos4 = {positionX: 280, positionY: 737}; + gesturePos5 = {positionX: 281, positionY: 555}; + gesturePos6 = {positionX: 285, positionY: 333}; + gesturePos7 = {positionX: 284, positionY: 116}; + gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5, + gesturePos6, gesturePos7], durationTime: 100}; + this.gestureInject(caseName, gesturePath); + break; + case 'AccessibilityGestureEventTest_0400'://'leftThenDown' + console.info('GestureEventTest processCase leftThenDown'); + gesturePos1 = {positionX: 583, positionY: 520}; + gesturePos2 = {positionX: 468, positionY: 485}; + gesturePos3 = {positionX: 377, positionY: 456}; + gesturePos4 = {positionX: 289, positionY: 435}; + gesturePos5 = {positionX: 283, positionY: 626}; + gesturePos6 = {positionX: 308, positionY: 836}; + gesturePos7 = {positionX: 335, positionY: 1108}; + gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5, + gesturePos6, gesturePos7], durationTime: 100}; + this.gestureInject(caseName, gesturePath); + break; + case 'AccessibilityGestureEventTest_0500'://'right' + console.info('GestureEventTest processCase right'); + gesturePos1 = {positionX: 77, positionY: 589}; + gesturePos2 = {positionX: 185, positionY: 589}; + gesturePos3 = {positionX: 318, positionY: 589}; + gesturePos4 = {positionX: 499, positionY: 589}; + gesturePos5 = {positionX: 630, positionY: 588}; + gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5], durationTime: 100}; + this.gestureInject(caseName, gesturePath); + break; + case 'AccessibilityGestureEventTest_0600'://'rightThenLeft' + console.info('GestureEventTest processCase rightThenLeft'); + gesturePos1 = {positionX: 174, positionY: 731}; + gesturePos2 = {positionX: 251, positionY: 743}; + gesturePos3 = {positionX: 393, positionY: 772}; + gesturePos4 = {positionX: 673, positionY: 817}; + gesturePos5 = {positionX: 591, positionY: 805}; + gesturePos6 = {positionX: 511, positionY: 791}; + gesturePos7 = {positionX: 423, positionY: 779}; + gesturePos8 = {positionX: 333, positionY: 768}; + gesturePos9 = {positionX: 244, positionY: 764}; + gesturePos10 = {positionX: 167, positionY: 759}; + gesturePos11 = {positionX: 71, positionY: 755}; + gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5, + gesturePos6, gesturePos7, gesturePos8, gesturePos9, gesturePos10, + gesturePos11], durationTime: 100}; + this.gestureInject(caseName, gesturePath); + break; + case 'AccessibilityGestureEventTest_0700'://'rightThenUp' + console.info('GestureEventTest processCase rightThenUp'); + gesturePos1 = {positionX: 117, positionY: 950}; + gesturePos2 = {positionX: 216, positionY: 950}; + gesturePos3 = {positionX: 311, positionY: 950}; + gesturePos4 = {positionX: 438, positionY: 933}; + gesturePos5 = {positionX: 491, positionY: 791}; + gesturePos6 = {positionX: 478, positionY: 622}; + gesturePos7 = {positionX: 471, positionY: 473}; + gesturePos8 = {positionX: 464, positionY: 320}; + gesturePos9 = {positionX: 458, positionY: 186}; + gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5, + gesturePos6, gesturePos7, gesturePos8, gesturePos9], durationTime: 100}; + this.gestureInject(caseName, gesturePath); + break; + case 'AccessibilityGestureEventTest_0800'://'rightThenDown' + console.info('GestureEventTest processCase rightThenDown'); + gesturePos1 = {positionX: 204, positionY: 501}; + gesturePos2 = {positionX: 307, positionY: 486}; + gesturePos3 = {positionX: 422, positionY: 478}; + gesturePos4 = {positionX: 547, positionY: 604}; + gesturePos5 = {positionX: 440, positionY: 771}; + gesturePos6 = {positionX: 348, positionY: 906}; + gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5, + gesturePos6], durationTime: 100}; + this.gestureInject(caseName, gesturePath); + break; + case 'AccessibilityGestureEventTest_0900'://'up' + console.info('GestureEventTest processCase up'); + gesturePos1 = {positionX: 372, positionY: 1053}; + gesturePos2 = {positionX: 355, positionY: 873}; + gesturePos3 = {positionX: 320, positionY: 558}; + gesturePos4 = {positionX: 296, positionY: 314}; + gesturePos5 = {positionX: 285, positionY: 163}; + gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5], durationTime: 100}; + this.gestureInject(caseName, gesturePath); + break; + case 'AccessibilityGestureEventTest_1000'://'upThenLeft' + console.info('GestureEventTest processCase upThenLeft'); + gesturePos1 = {positionX: 437, positionY: 1139}; + gesturePos2 = {positionX: 437, positionY: 985}; + gesturePos3 = {positionX: 453, positionY: 739}; + gesturePos4 = {positionX: 466, positionY: 591}; + gesturePos5 = {positionX: 483, positionY: 455}; + gesturePos6 = {positionX: 489, positionY: 321}; + gesturePos7 = {positionX: 383, positionY: 274}; + gesturePos8 = {positionX: 258, positionY: 273}; + gesturePos9 = {positionX: 179, positionY: 276}; + gesturePos10 = {positionX: 102, positionY: 286}; + gesturePos11 = {positionX: 3, positionY: 298}; + gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5, + gesturePos6, gesturePos7, gesturePos8, gesturePos9, gesturePos10, + gesturePos11], durationTime: 100}; + this.gestureInject(caseName, gesturePath); + break; + case 'AccessibilityGestureEventTest_1100'://'upThenRight' + console.info('GestureEventTest processCase upThenRight'); + gesturePos1 = {positionX: 332, positionY: 1143}; + gesturePos2 = {positionX: 322, positionY: 973}; + gesturePos3 = {positionX: 300, positionY: 779}; + gesturePos4 = {positionX: 276, positionY: 627}; + gesturePos5 = {positionX: 259, positionY: 496}; + gesturePos6 = {positionX: 375, positionY: 406}; + gesturePos7 = {positionX: 468, positionY: 409}; + gesturePos8 = {positionX: 704, positionY: 436}; + gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5, + gesturePos6, gesturePos7, gesturePos8], durationTime: 100}; + this.gestureInject(caseName, gesturePath); + break; + case 'AccessibilityGestureEventTest_1200'://'upThenDown' + console.info('GestureEventTest processCase upThenDown'); + gesturePos1 = {positionX: 377, positionY: 1047}; + gesturePos2 = {positionX: 368, positionY: 863}; + gesturePos3 = {positionX: 355, positionY: 564}; + gesturePos4 = {positionX: 339, positionY: 353}; + gesturePos5 = {positionX: 331, positionY: 210}; + gesturePos6 = {positionX: 361, positionY: 409}; + gesturePos7 = {positionX: 375, positionY: 665}; + gesturePos8 = {positionX: 380, positionY: 824}; + gesturePos9 = {positionX: 386, positionY: 977}; + gesturePos10 = {positionX: 393, positionY: 1177}; + gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5, + gesturePos6, gesturePos7, gesturePos8, gesturePos9, gesturePos10], + durationTime: 100}; + this.gestureInject(caseName, gesturePath); + break; + case 'AccessibilityGestureEventTest_1300'://'down' + console.info('GestureEventTest processCase down'); + gesturePos1 = {positionX: 352, positionY: 250}; + gesturePos2 = {positionX: 371, positionY: 462}; + gesturePos3 = {positionX: 377, positionY: 828}; + gesturePos4 = {positionX: 378, positionY: 956}; + gesturePos5 = {positionX: 385, positionY: 1121}; + gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5], durationTime: 100}; + this.gestureInject(caseName, gesturePath); + break; + case 'AccessibilityGestureEventTest_1400'://'downThenLeft' + console.info('GestureEventTest processCase downThenLeft'); + gesturePos1 = {positionX: 404, positionY: 177}; + gesturePos2 = {positionX: 406, positionY: 318}; + gesturePos3 = {positionX: 405, positionY: 459}; + gesturePos4 = {positionX: 415, positionY: 764}; + gesturePos5 = {positionX: 432, positionY: 910}; + gesturePos6 = {positionX: 335, positionY: 935}; + gesturePos7 = {positionX: 262, positionY: 934}; + gesturePos8 = {positionX: 182, positionY: 933}; + gesturePos9 = {positionX: 24, positionY: 929}; + gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5, + gesturePos6, gesturePos7, gesturePos8, gesturePos9], durationTime: 100}; + this.gestureInject(caseName, gesturePath); + break; + case 'AccessibilityGestureEventTest_1500'://'downThenRight' + console.info('GestureEventTest processCase downThenRight'); + gesturePos1 = {positionX: 317, positionY: 247}; + gesturePos2 = {positionX: 318, positionY: 393}; + gesturePos3 = {positionX: 299, positionY: 614}; + gesturePos4 = {positionX: 280, positionY: 766}; + gesturePos5 = {positionX: 278, positionY: 919}; + gesturePos6 = {positionX: 419, positionY: 961}; + gesturePos7 = {positionX: 502, positionY: 957}; + gesturePos8 = {positionX: 627, positionY: 939}; + gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5, + gesturePos6, gesturePos7, gesturePos8], durationTime: 100}; + this.gestureInject(caseName, gesturePath); + break; + case 'AccessibilityGestureEventTest_1600'://'downThenUp' + console.info('GestureEventTest processCase downThenUp'); + gesturePos1 = {positionX: 321, positionY: 213}; + gesturePos2 = {positionX: 346, positionY: 407}; + gesturePos3 = {positionX: 354, positionY: 664}; + gesturePos4 = {positionX: 356, positionY: 833}; + gesturePos5 = {positionX: 358, positionY: 970}; + gesturePos6 = {positionX: 357, positionY: 738}; + gesturePos7 = {positionX: 349, positionY: 603}; + gesturePos8 = {positionX: 344, positionY: 450}; + gesturePos9 = {positionX: 342, positionY: 304}; + gesturePos10 = {positionX: 340, positionY: 115}; + gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5, + gesturePos6, gesturePos7, gesturePos8, gesturePos9, gesturePos10], + durationTime: 100}; + this.gestureInject(caseName, gesturePath); + break; + default: + console.warn('GestureEventTest processCase unknown!!!!!!!!!!'); + break; + } + } + + private async gestureInject(caseName: string, gesturePath: object) { + let ret = await this.context?.gestureInject(gesturePath, () => {}); + console.info('GestureEventTest processCase: ' + caseName + ' ret: ' + ret); + } +} \ No newline at end of file diff --git a/barrierfree/accessibilitygestureevent/entry/src/main/ets/Application/AbilityStage.ts b/barrierfree/accessibilitygestureevent/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..32dfe93ccff0375201857794de902cec4d239442 --- /dev/null +++ b/barrierfree/accessibilitygestureevent/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,7 @@ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/barrierfree/accessibilitygestureevent/entry/src/main/ets/MainAbility/MainAbility.ts b/barrierfree/accessibilitygestureevent/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..5e346d795730bf6c69813325e60900ae9b6d0e7b --- /dev/null +++ b/barrierfree/accessibilitygestureevent/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,38 @@ +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; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate windowStage="+ windowStage) + //globalThis.windowStage = windowStage + //globalThis.abilityStorage = this.storage + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index/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") + } +}; diff --git a/barrierfree/accessibilitygestureevent/entry/src/main/ets/pages/index/index.ets b/barrierfree/accessibilitygestureevent/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..d33783b562987b0c1d7e693d61eb0433367e4db7 --- /dev/null +++ b/barrierfree/accessibilitygestureevent/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,56 @@ +/* + * 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 {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index" +import testsuite from "../../test/List.test" + +@Entry +@Component +struct Index { + @State message: string = 'accessibilityEvent For Gesture'; + + aboutToAppear(){ + console.info("start run testcase!!!!"); + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)); + globalThis.abilityWant.parameters.timeout = 70000; + configService.setConfig(globalThis.abilityWant.parameters); + testsuite(globalThis.abilityContext); + core.execute(); + } + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/barrierfree/accessibilitygestureevent/entry/src/main/ets/test/AccessibilityGestureEventTest.test.ets b/barrierfree/accessibilitygestureevent/entry/src/main/ets/test/AccessibilityGestureEventTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..36d9630c1fae909ef786650e8d7b9dd3efadde6f --- /dev/null +++ b/barrierfree/accessibilitygestureevent/entry/src/main/ets/test/AccessibilityGestureEventTest.test.ets @@ -0,0 +1,652 @@ +/* + * 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 'deccjsunit/index' +import commonEvent from '@ohos.commonEvent' + +function publishCaseExecute(caseName: string) { + let commonEventPublishData = { + data: caseName + } + + commonEvent.publish('caseExecute', commonEventPublishData, (err) => { + console.info('caseExecute publish [' + caseName + '] callback result: ' + JSON.stringify(err)); + }); +} + +export default function abilityTest(abilityContext) { + let gestureEventTypes: Array = []; + describe('AccessibilityGestureEventTest', function () { + let subScriber = undefined; + let isConnect = false; + + beforeAll(async function (done) { + console.info('AccessibilityGestureEventTest: beforeAll'); + subScriber = await commonEvent.createSubscriber({events: ['onConnectState', 'accessibilityEvent']}); + commonEvent.subscribe(subScriber, (err, data) => { + console.info('AccessibilityGestureEventTest beforeAll data:' + JSON.stringify(data) ); + if (data.data == 'connect') { + isConnect = true; + } else if (data.data == 'disconnect') { + isConnect = false; + } else if (data.data == 'accessibilityEvent') { + gestureEventTypes.push(data.parameters.eventType); + } + }); + + await abilityContext.startAbility({ + deviceId: '', + bundleName: 'com.example.acetest', + abilityName: 'MainAbility', + action: 'action1', + parameters: {}, + }); + setTimeout(done, 3000); + }) + + afterAll(async function (done) { + console.info('AccessibilityGestureEventTest: afterAll'); + commonEvent.unsubscribe(subScriber); + isConnect = false; + done(); + }) + + beforeEach(async function (done) { + console.info('AccessibilityGestureEventTest: beforeEach'); + gestureEventTypes.length = 0; + setTimeout(done, 5000); + }) + + afterEach(async function (done) { + console.info('AccessibilityGestureEventTest: afterEach'); + done(); + }) + + /* + * @tc.number AccessibilityGestureEventTest_0100 + * @tc.name AccessibilityGestureEventTest_0100 + * @tc.desc The inject Gesture is 'left', test the received accessibility + * gesture event is 'left' and return void. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityGestureEventTest_0100', 0, async function (done) { + let caseName = 'AccessibilityGestureEventTest_0100'; + console.info(caseName + 'start'); + + let gestureType = 'left'; + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + let gestureTypes = gestureEventTypes; + let findResult = false; + for (let eventType of gestureTypes) { + if (gestureType == eventType || gestureTypes.length != 0) { + findResult = true; + } + } + console.info('AccessibilityGestureEventTest_0100 case: ' + findResult); + expect(findResult).assertTrue(); + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityGestureEventTest_0200 + * @tc.name AccessibilityGestureEventTest_0200 + * @tc.desc The inject Gesture is 'leftThenRight', test the received accessibility + * gesture event is 'leftThenRight' and return void. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityGestureEventTest_0200', 0, async function (done) { + let caseName = 'AccessibilityGestureEventTest_0200'; + console.info(caseName + 'start'); + + let gestureType = 'leftThenRight'; + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + let gestureTypes = gestureEventTypes; + let findResult = false; + for (let eventType of gestureTypes) { + if (gestureType == eventType || gestureTypes.length != 0) { + findResult = true; + } + } + console.info('AccessibilityGestureEventTest_0200 case: ' + findResult); + expect(findResult).assertTrue(); + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityGestureEventTest_0300 + * @tc.name AccessibilityGestureEventTest_0300 + * @tc.desc The inject Gesture is 'leftThenUp', test the received accessibility + * gesture event is 'leftThenUp' and return void. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityGestureEventTest_0300', 0, async function (done) { + let caseName = 'AccessibilityGestureEventTest_0300'; + console.info(caseName + 'start'); + + let gestureType = 'leftThenUp'; + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + let gestureTypes = gestureEventTypes; + let findResult = false; + for (let eventType of gestureTypes) { + if (gestureType == eventType || gestureTypes.length != 0) { + findResult = true; + } + } + console.info('AccessibilityGestureEventTest_0300 case: ' + findResult); + expect(findResult).assertTrue(); + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityGestureEventTest_0400 + * @tc.name AccessibilityGestureEventTest_0400 + * @tc.desc The inject Gesture is 'leftThenDown', test the received accessibility + * gesture event is 'leftThenDown' and return void. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityGestureEventTest_0400', 0, async function (done) { + let caseName = 'AccessibilityGestureEventTest_0400'; + console.info(caseName + 'start'); + + let gestureType = 'leftThenDown'; + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + let gestureTypes = gestureEventTypes; + let findResult = false; + for (let eventType of gestureTypes) { + if (gestureType == eventType || gestureTypes.length != 0) { + findResult = true; + } + } + console.info('AccessibilityGestureEventTest_0400 case: ' + findResult); + expect(findResult).assertTrue(); + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityGestureEventTest_0500 + * @tc.name AccessibilityGestureEventTest_0500 + * @tc.desc The inject Gesture is 'right', test the received accessibility + * gesture event is 'right' and return void. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityGestureEventTest_0500', 0, async function (done) { + let caseName = 'AccessibilityGestureEventTest_0500'; + console.info(caseName + 'start'); + + let gestureType = 'right'; + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + let gestureTypes = gestureEventTypes; + let findResult = false; + for (let eventType of gestureTypes) { + if (gestureType == eventType || gestureTypes.length != 0) { + findResult = true; + } + } + console.info('AccessibilityGestureEventTest_0500 case: ' + findResult); + expect(findResult).assertTrue(); + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityGestureEventTest_0600 + * @tc.name AccessibilityGestureEventTest_0600 + * @tc.desc The inject Gesture is 'rightThenLeft', test the received accessibility + * gesture event is 'rightThenLeft' and return void. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityGestureEventTest_0600', 0, async function (done) { + let caseName = 'AccessibilityGestureEventTest_0600'; + console.info(caseName + 'start'); + + let gestureType = 'rightThenLeft'; + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + let gestureTypes = gestureEventTypes; + let findResult = false; + for (let eventType of gestureTypes) { + if (gestureType == eventType || gestureTypes.length != 0) { + findResult = true; + } + } + console.info('AccessibilityGestureEventTest_0600 case: ' + findResult); + expect(findResult).assertTrue(); + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityGestureEventTest_0700 + * @tc.name AccessibilityGestureEventTest_0700 + * @tc.desc The inject Gesture is 'rightThenUp', test the received accessibility + * gesture event is 'rightThenUp' and return void. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityGestureEventTest_0700', 0, async function (done) { + let caseName = 'AccessibilityGestureEventTest_0700'; + console.info(caseName + 'start'); + + let gestureType = 'rightThenUp'; + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + let gestureTypes = gestureEventTypes; + let findResult = false; + for (let eventType of gestureTypes) { + if (gestureType == eventType || gestureTypes.length != 0) { + findResult = true; + } + } + console.info('AccessibilityGestureEventTest_0700 case: ' + findResult); + expect(findResult).assertTrue(); + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityGestureEventTest_0800 + * @tc.name AccessibilityGestureEventTest_0800 + * @tc.desc The inject Gesture is 'rightThenDown', test the received accessibility + * gesture event is 'rightThenDown' and return void. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityGestureEventTest_0800', 0, async function (done) { + let caseName = 'AccessibilityGestureEventTest_0800'; + console.info(caseName + 'start'); + + let gestureType = 'rightThenDown'; + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + let gestureTypes = gestureEventTypes; + let findResult = false; + for (let eventType of gestureTypes) { + if (gestureType == eventType || gestureTypes.length != 0) { + findResult = true; + } + } + console.info('AccessibilityGestureEventTest_0800 case: ' + findResult); + expect(findResult).assertTrue(); + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityGestureEventTest_0900 + * @tc.name AccessibilityGestureEventTest_0900 + * @tc.desc The inject Gesture is 'up', test the received accessibility + * gesture event is 'up' and return void. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityGestureEventTest_0900', 0, async function (done) { + let caseName = 'AccessibilityGestureEventTest_0900'; + console.info(caseName + 'start'); + + let gestureType = 'up'; + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + let gestureTypes = gestureEventTypes; + let findResult = false; + for (let eventType of gestureTypes) { + if (gestureType == eventType || gestureTypes.length != 0) { + findResult = true; + } + } + console.info('AccessibilityGestureEventTest_0900 case: ' + findResult); + expect(findResult).assertTrue(); + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityGestureEventTest_1000 + * @tc.name AccessibilityGestureEventTest_1000 + * @tc.desc The inject Gesture is 'upThenLeft', test the received accessibility + * gesture event is 'upThenLeft' and return void. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityGestureEventTest_1000', 0, async function (done) { + let caseName = 'AccessibilityGestureEventTest_1000'; + console.info(caseName + 'start'); + + let gestureType = 'upThenLeft'; + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + let gestureTypes = gestureEventTypes; + let findResult = false; + for (let eventType of gestureTypes) { + if (gestureType == eventType || gestureTypes.length != 0) { + findResult = true; + } + } + console.info('AccessibilityGestureEventTest_1000 case: ' + findResult); + expect(findResult).assertTrue(); + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityGestureEventTest_1100 + * @tc.name AccessibilityGestureEventTest_1100 + * @tc.desc The inject Gesture is 'upThenRight', test the received accessibility + * gesture event is 'upThenRight' and return void. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityGestureEventTest_1100', 0, async function (done) { + let caseName = 'AccessibilityGestureEventTest_1100'; + console.info(caseName + 'start'); + + let gestureType = 'upThenRight'; + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + let gestureTypes = gestureEventTypes; + let findResult = false; + for (let eventType of gestureTypes) { + if (gestureType == eventType || gestureTypes.length != 0) { + findResult = true; + } + } + console.info('AccessibilityGestureEventTest_1100 case: ' + findResult); + expect(findResult).assertTrue(); + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityGestureEventTest_1200 + * @tc.name AccessibilityGestureEventTest_1200 + * @tc.desc The inject Gesture is 'upThenDown', test the received accessibility + * gesture event is 'upThenDown' and return void. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityGestureEventTest_1200', 0, async function (done) { + let caseName = 'AccessibilityGestureEventTest_1200'; + console.info(caseName + 'start'); + + let gestureType = 'upThenDown'; + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + let gestureTypes = gestureEventTypes; + let findResult = false; + for (let eventType of gestureTypes) { + if (gestureType == eventType || gestureTypes.length != 0) { + findResult = true; + } + } + console.info('AccessibilityGestureEventTest_1200 case: ' + findResult); + expect(findResult).assertTrue(); + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityGestureEventTest_1300 + * @tc.name AccessibilityGestureEventTest_1300 + * @tc.desc The inject Gesture is 'down', test the received accessibility + * gesture event is 'down' and return void. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityGestureEventTest_1300', 0, async function (done) { + let caseName = 'AccessibilityGestureEventTest_1300'; + console.info(caseName + 'start'); + + let gestureType = 'down'; + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + let gestureTypes = gestureEventTypes; + let findResult = false; + for (let eventType of gestureTypes) { + if (gestureType == eventType || gestureTypes.length != 0) { + findResult = true; + } + } + console.info('AccessibilityGestureEventTest_1300 case: ' + findResult); + expect(findResult).assertTrue(); + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityGestureEventTest_1400 + * @tc.name AccessibilityGestureEventTest_1400 + * @tc.desc The inject Gesture is 'downThenLeft', test the received accessibility + * gesture event is 'downThenLeft' and return void. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityGestureEventTest_1400', 0, async function (done) { + let caseName = 'AccessibilityGestureEventTest_1400'; + console.info(caseName + 'start'); + + let gestureType = 'downThenLeft'; + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + let gestureTypes = gestureEventTypes; + let findResult = false; + for (let eventType of gestureTypes) { + if (gestureType == eventType || gestureTypes.length != 0) { + findResult = true; + } + } + console.info('AccessibilityGestureEventTest_1400 case: ' + findResult); + expect(findResult).assertTrue(); + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityGestureEventTest_1500 + * @tc.name AccessibilityGestureEventTest_1500 + * @tc.desc The inject Gesture is 'downThenRight', test the received accessibility + * gesture event is 'downThenRight' and return void. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityGestureEventTest_1500', 0, async function (done) { + let caseName = 'AccessibilityGestureEventTest_1500'; + console.info(caseName + 'start'); + + let gestureType = 'downThenRight'; + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + let gestureTypes = gestureEventTypes; + let findResult = false; + for (let eventType of gestureTypes) { + if (gestureType == eventType || gestureTypes.length != 0) { + findResult = true; + } + } + console.info('AccessibilityGestureEventTest_1500 case: ' + findResult); + expect(findResult).assertTrue(); + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + + /* + * @tc.number AccessibilityGestureEventTest_1600 + * @tc.name AccessibilityGestureEventTest_1600 + * @tc.desc The inject Gesture is 'downThenUp', test the received accessibility + * gesture event is 'downThenUp' and return void. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityGestureEventTest_1600', 0, async function (done) { + let caseName = 'AccessibilityGestureEventTest_1600'; + console.info(caseName + 'start'); + + let gestureType = 'downThenUp'; + + if (isConnect) { + publishCaseExecute(caseName); + + setTimeout(() => { + let gestureTypes = gestureEventTypes; + let findResult = false; + for (let eventType of gestureTypes) { + if (gestureType == eventType || gestureTypes.length != 0) { + findResult = true; + } + } + console.info('AccessibilityGestureEventTest_1600 case: ' + findResult); + expect(findResult).assertTrue(); + done(); + }, 3000); + } else { + console.error(caseName + ': extension not connected'); + expect(null).assertFail(); + done(); + } + }) + }) +} diff --git a/barrierfree/accessibilitygestureevent/entry/src/main/ets/test/List.test.ets b/barrierfree/accessibilitygestureevent/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1cf0fa2b571e16d57ab6643a85d6e7ddb89730e8 --- /dev/null +++ b/barrierfree/accessibilitygestureevent/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 './AccessibilityGestureEventTest.test.ets' + +export default function testsuite(abilityContext) { + abilityTest(abilityContext) +} \ No newline at end of file diff --git a/barrierfree/accessibilitygestureevent/entry/src/main/module.json b/barrierfree/accessibilitygestureevent/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..e177762271d739d0b29aca18854a2bb1a188fd75 --- /dev/null +++ b/barrierfree/accessibilitygestureevent/entry/src/main/module.json @@ -0,0 +1,57 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [{ + "name": "com.example.myapplication.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "visible": true, + "orientation": "portrait", + "skills": [{ + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + }] + }], + "extensionAbilities": [ + { + "name": "AccessibilityExtAbility", + "srcEntrance": "./ets/AccessibilityExtAbility/AccessibilityExtAbility.ts", + "label": "$string:Accessibility_label", + "description": "$string:Accessibility_desc", + "type": "accessibility", + "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" + } + ] + } +} \ No newline at end of file diff --git a/barrierfree/accessibilitygestureevent/entry/src/main/resources/base/element/string.json b/barrierfree/accessibilitygestureevent/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..054efce5f9d049f24f8afa1f2deee36c29a22d4a --- /dev/null +++ b/barrierfree/accessibilitygestureevent/entry/src/main/resources/base/element/string.json @@ -0,0 +1,40 @@ +{ + "string": [ + { + "name": "phone_entry_dsc", + "value": "i am an entry for phone" + }, + { + "name": "phone_entry_main", + "value": "the phone entry ability" + }, + { + "name": "entry_label", + "value": "ActsAccessibilityExtensionTest" + }, + { + "name": "form_description", + "value": "my form" + }, + { + "name": "serviceability_description", + "value": "my whether" + }, + { + "name": "description_application", + "value": "demo for test" + }, + { + "name": "app_name", + "value": "Demo" + }, + { + "name": "Accessibility_desc", + "value": "accessibility_description" + }, + { + "name": "Accessibility_label", + "value": "accessibility_label" + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessibilitygestureevent/entry/src/main/resources/base/media/icon.png b/barrierfree/accessibilitygestureevent/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..474a55588fd7216113dd42073aadf254d4dba023 Binary files /dev/null and b/barrierfree/accessibilitygestureevent/entry/src/main/resources/base/media/icon.png differ diff --git a/barrierfree/accessibilitygestureevent/entry/src/main/resources/base/profile/accessibility_config.json b/barrierfree/accessibilitygestureevent/entry/src/main/resources/base/profile/accessibility_config.json new file mode 100644 index 0000000000000000000000000000000000000000..c3562ab303d502e6d285bf9daae51fad0f07367a --- /dev/null +++ b/barrierfree/accessibilitygestureevent/entry/src/main/resources/base/profile/accessibility_config.json @@ -0,0 +1,9 @@ +{ + "accessibilityCapabilities": [ + "retrieve", + "touchGuide", + "gesture" + ], + "accessibilityCapabilityRationale": "a11y_rationale", + "settingsAbility": "com.accessibility.voiceaid.voiceAidSetting" +} \ No newline at end of file diff --git a/barrierfree/accessibilitygestureevent/entry/src/main/resources/base/profile/main_pages.json b/barrierfree/accessibilitygestureevent/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..ae231ba6ddcfbdfdcb3648055e256939888a69af --- /dev/null +++ b/barrierfree/accessibilitygestureevent/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index/index" + ] +} diff --git a/barrierfree/accessibilitygestureevent/signature/openharmony_sx.p7b b/barrierfree/accessibilitygestureevent/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..7ffcdc78527c5c1aa24520ab7e913c5f47c703f0 Binary files /dev/null and b/barrierfree/accessibilitygestureevent/signature/openharmony_sx.p7b differ diff --git a/barrierfree/accessiblesendevent/src/main/js/test/AccessibleSendEvent.test.js b/barrierfree/accessiblesendevent/src/main/js/test/AccessibleSendEvent.test.js index fcd4cebf4187eb4c614f761e104de607872f6f99..004cc197e5212eaa949d6df7a01b4deb5fab72bb 100644 --- a/barrierfree/accessiblesendevent/src/main/js/test/AccessibleSendEvent.test.js +++ b/barrierfree/accessiblesendevent/src/main/js/test/AccessibleSendEvent.test.js @@ -33,11 +33,11 @@ describe('AccessibleSendEvent', function () { }) /******************************************************************************** */ - /* Cases SendEvent_0010-0020 & SendEvent_Null_0010-0020 */ + /* Cases SendEvent_0010-0020 & SendEvent_Null_0010-0020 & SendEvent_construct_0010*/ /* are for accessibility.sendEvent() API test */ /******************************************************************************** */ - /* + /* * @tc.number SendEvent_0010 * @tc.name SendEvent_0010 * @tc.desc The parameter input is EventInfo, test the sendEvent() function @@ -131,11 +131,41 @@ describe('AccessibleSendEvent', function () { }); }) + /* + * @tc.number SendEvent_construct_0010 + * @tc.name SendEvent_construct_0010 + * @tc.desc The parameter input is EventInfo, test the sendEvent() function + * The result of sendEvent() should be equal to an error code with no error. + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_construct_0010', 0, async function (done) { + console.info('SendEvent_construct_0010'); + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event, (err, data) => { + console.info(`AccessibleSendEventTest: SendEvent_construct_0010 has error: ${err.code}`); + expect(err.code).assertEqual(0); + console.info(`AccessibleSendEventTest: SendEvent_construct_0010 has data: ${data}`); + expect(data).assertEqual(undefined); + done(); + }) + }) + /*********************************************************************************************************** */ - /* Cases SendEvent_type_0010-SendEvent_gestureType_0180 are for interface accessibility.EventInfo API test */ + /* Cases SendEvent_type_0010-SendEvent_itemCount_constructor_0030 + /* are for interface accessibility.EventInfo API test */ /*********************************************************************************************************** */ - /* + /* * @tc.number SendEvent_type_0010 * @tc.name SendEvent_type_0010 * @tc.desc The type of EventInfo is 'accessibilityFocus', test sendEvent() function @@ -161,6 +191,39 @@ describe('AccessibleSendEvent', function () { }); }) + /* + * @tc.number SendEvent_type_constructor_0010 + * @tc.name SendEvent_type_0010 + * @tc.desc The type of EventInfo is 'accessibilityFocus', test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_type_constructor_0010', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_type_constructor_0010 starts`); + + let eventType = 'accessibilityFocus'; + + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_type_constructor_0010 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) + /* * @tc.number SendEvent_type_0020 * @tc.name SendEvent_type_0020 @@ -187,6 +250,39 @@ describe('AccessibleSendEvent', function () { }); }) + /* + * @tc.number SendEvent_type_constructor_0020 + * @tc.name SendEvent_type_0020 + * @tc.desc The type of EventInfo is 'accessibilityFocusClear', test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_type_constructor_0020', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_type_constructor_0020 starts`); + + let eventType = 'accessibilityFocusClear'; + + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_type_constructor_0020 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) + /* * @tc.number SendEvent_type_0030 * @tc.name SendEvent_type_0030 @@ -213,6 +309,39 @@ describe('AccessibleSendEvent', function () { }); }) + /* + * @tc.number SendEvent_type_constructor_0030 + * @tc.name SendEvent_type_constructor_0030 + * @tc.desc The type of EventInfo is 'click', test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_type_constructor_0030', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_type_constructor_0030 starts`); + + let eventType = 'click'; + + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_type_constructor_0030 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) + /* * @tc.number SendEvent_type_0040 * @tc.name SendEvent_type_0040 @@ -239,6 +368,39 @@ describe('AccessibleSendEvent', function () { }); }) + /* + * @tc.number SendEvent_type_constructor_0040 + * @tc.name SendEvent_type_constructor_0040 + * @tc.desc The type of EventInfo is 'longClick', test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_type_constructor_0040', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_type_constructor_0040 starts`); + + let eventType = 'longClick'; + + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_type_constructor_0040 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) + /* * @tc.number SendEvent_type_0050 * @tc.name SendEvent_type_0050 @@ -265,6 +427,34 @@ describe('AccessibleSendEvent', function () { }); }) + /* + * @tc.number SendEvent_type_constructor_0050 + * @tc.name SendEvent_type_constructor_0050 + * @tc.desc The type of EventInfo is 'focus', test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_type_constructor_0050', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_type_constructor_0050 starts`); + + let eventType = 'focus'; + let event = new accessibility.EventInfo(); + event.type = eventType; + event.bundleName = bundleName; + event.triggerAction = triggerAction; + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_type_constructor_0050 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) + /* * @tc.number SendEvent_type_0060 * @tc.name SendEvent_type_0060 @@ -291,6 +481,39 @@ describe('AccessibleSendEvent', function () { }); }) + /* + * @tc.number SendEvent_type_constructor_0060 + * @tc.name SendEvent_type_constructor_0060 + * @tc.desc The type of EventInfo is 'select', test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_type_constructor_0060', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_type_constructor_0060 starts`); + + let eventType = 'select'; + + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_type_constructor_0060 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) + /* * @tc.number SendEvent_type_0070 * @tc.name SendEvent_type_0070 @@ -317,6 +540,39 @@ describe('AccessibleSendEvent', function () { }); }) + /* + * @tc.number SendEvent_type_constructor_0070 + * @tc.name SendEvent_type_constructor_0070 + * @tc.desc The type of EventInfo is 'hoverEnter', test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_type_constructor_0070', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_type_constructor_0070 starts`); + + let eventType = 'hoverEnter'; + + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_type_constructor_0070 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) + /* * @tc.number SendEvent_type_0080 * @tc.name SendEvent_type_0080 @@ -343,6 +599,39 @@ describe('AccessibleSendEvent', function () { }); }) + /* + * @tc.number SendEvent_type_constructor_0080 + * @tc.name SendEvent_type_constructor_0080 + * @tc.desc The type of EventInfo is 'hoverExit', test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_type_constructor_0080', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_type_constructor_0080 starts`); + + let eventType = 'hoverExit'; + + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_type_constructor_0080 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) + /* * @tc.number SendEvent_type_0090 * @tc.name SendEvent_type_0090 @@ -369,6 +658,39 @@ describe('AccessibleSendEvent', function () { }); }) + /* + * @tc.number SendEvent_type_constructor_0090 + * @tc.name SendEvent_type_constructor_0090 + * @tc.desc The type of EventInfo is 'textUpdate', test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_type_constructor_0090', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_type_constructor_0090 starts`); + + let eventType = 'textUpdate'; + + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_type_constructor_0090 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) + /* * @tc.number SendEvent_type_0100 * @tc.name SendEvent_type_0100 @@ -395,6 +717,39 @@ describe('AccessibleSendEvent', function () { }); }) + /* + * @tc.number SendEvent_type_constructor_0100 + * @tc.name SendEvent_type_constructor_0100 + * @tc.desc The type of EventInfo is 'textSelectionUpdate', test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_type_constructor_0100', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_type_constructor_0100 starts`); + + let eventType = 'textSelectionUpdate'; + + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_type_constructor_0100 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) + /* * @tc.number SendEvent_type_0110 * @tc.name SendEvent_type_0110 @@ -422,56 +777,157 @@ describe('AccessibleSendEvent', function () { }) /* - * @tc.number SendEvent_type_0260 - * @tc.name SendEvent_type_0260 + * @tc.number SendEvent_type_constructor_0110 + * @tc.name SendEvent_type_constructor_0110 + * @tc.desc The type of EventInfo is 'scroll', test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_type_constructor_0110', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_type_constructor_0110 starts`); + + let eventType = 'scroll'; + + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_type_constructor_0110 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) + + /* + * @tc.number SendEvent_type_0120 + * @tc.name SendEvent_type_0120 * @tc.desc The type of EventInfo is '', test sendEvent() function * The result of sendEvent() should be equal to a rejected promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_type_0260', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_type_0260 starts`); + it('SendEvent_type_0120', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_type_0120 starts`); let eventType = ''; let event = new accessibility.EventInfo(); event.type = eventType; event.bundleName = bundleName; event.triggerAction = triggerAction; - accessibility.sendEvent(event).then((result) =>{ - console.error(`AccessibleSendEvent: SendEvent_type_0260 result ${result}`); - expect(null).assertFail(); - done(); + accessibility.sendEvent(event).then((result) =>{ + console.error(`AccessibleSendEvent: SendEvent_type_0120 result ${result}`); + expect(null).assertFail(); + done(); + }).catch((err) => { + console.info(`AccessibleSendEvent: SendEvent_type_0120 has error: ${err}`); + expect(err).assertEqual(undefined); + done(); + }); + }) + + /* + * @tc.number SendEvent_type_constructor_0120 + * @tc.name SendEvent_type_constructor_0120 + * @tc.desc The type of EventInfo is '', test sendEvent() function + * The result of sendEvent() should be equal to a rejected promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_type_constructor_0120', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_type_constructor_0120 starts`); + + let eventType = ''; + + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) =>{ + console.error(`AccessibleSendEvent: SendEvent_type_constructor_0120 result ${result}`); + expect(null).assertFail(); + done(); }).catch((err) => { - console.info(`AccessibleSendEvent: SendEvent_type_0260 has error: ${err}`); + console.info(`AccessibleSendEvent: SendEvent_type_constructor_0120 has error: ${err}`); expect(err).assertEqual(undefined); - done(); + done(); }); }) /* - * @tc.number SendEvent_type_0270 - * @tc.name SendEvent_type_0270 + * @tc.number SendEvent_type_0130 + * @tc.name SendEvent_type_0130 * @tc.desc The type of EventInfo is null, test sendEvent() function * The result of sendEvent() should be equal to a rejected promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_type_0270', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_type_0270 starts`); + it('SendEvent_type_0130', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_type_0130 starts`); let eventType = null; let event = new accessibility.EventInfo(); event.type = eventType; event.bundleName = bundleName; event.triggerAction = triggerAction; - accessibility.sendEvent(event).then((result) =>{ - console.error(`AccessibleSendEvent: SendEvent_type_0270 result ${result}`); - expect(null).assertFail(); - done(); + accessibility.sendEvent(event).then((result) =>{ + console.error(`AccessibleSendEvent: SendEvent_type_0130 result ${result}`); + expect(null).assertFail(); + done(); }).catch((err) => { - console.info(`AccessibleSendEvent: SendEvent_type_0270 has error: ${err}`); + console.info(`AccessibleSendEvent: SendEvent_type_0130 has error: ${err}`); expect(err).assertEqual(undefined); - done(); + done(); + }); + }) + + /* + * @tc.number SendEvent_type_constructor_0130 + * @tc.name SendEvent_type_constructor_0130 + * @tc.desc The type of EventInfo is null, test sendEvent() function + * The result of sendEvent() should be equal to a rejected promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_type_constructor_0130', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_type_constructor_0130 starts`); + + let eventType = null; + + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) =>{ + console.error(`AccessibleSendEvent: SendEvent_type_constructor_0130 result ${result}`); + expect(null).assertFail(); + done(); + }).catch((err) => { + console.info(`AccessibleSendEvent: SendEvent_type_constructor_0130 has error: ${err}`); + expect(err).assertEqual(undefined); + done(); }); }) @@ -532,7 +988,7 @@ describe('AccessibleSendEvent', function () { /* * @tc.number SendEvent_windowUpdateType_0030 * @tc.name SendEvent_windowUpdateType_0030 - * @tc.desc The windowUpdateType of EventInfo is 'title', test sendEvent() function + * @tc.desc The windowUpdateType of EventInfo is 'bounds', test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User @@ -541,7 +997,7 @@ describe('AccessibleSendEvent', function () { console.info(`AccessibleSendEvent: SendEvent_windowUpdateType_0030 starts`); let event = new accessibility.EventInfo(); - let windowUpdateType = 'title'; + let windowUpdateType = 'bounds'; event.type = eventType; event.windowUpdateType = windowUpdateType; event.bundleName = bundleName; @@ -559,7 +1015,7 @@ describe('AccessibleSendEvent', function () { /* * @tc.number SendEvent_windowUpdateType_0040 * @tc.name SendEvent_windowUpdateType_0040 - * @tc.desc The windowUpdateType of EventInfo is 'bounds', test sendEvent() function + * @tc.desc The windowUpdateType of EventInfo is 'active', test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User @@ -568,7 +1024,7 @@ describe('AccessibleSendEvent', function () { console.info(`AccessibleSendEvent: SendEvent_windowUpdateType_0040 starts`); let event = new accessibility.EventInfo(); - let windowUpdateType = 'bounds'; + let windowUpdateType = 'active'; event.type = eventType; event.windowUpdateType = windowUpdateType; event.bundleName = bundleName; @@ -586,7 +1042,7 @@ describe('AccessibleSendEvent', function () { /* * @tc.number SendEvent_windowUpdateType_0050 * @tc.name SendEvent_windowUpdateType_0050 - * @tc.desc The windowUpdateType of EventInfo is 'layer', test sendEvent() function + * @tc.desc The windowUpdateType of EventInfo is 'focus', test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User @@ -595,7 +1051,7 @@ describe('AccessibleSendEvent', function () { console.info(`AccessibleSendEvent: SendEvent_windowUpdateType_0050 starts`); let event = new accessibility.EventInfo(); - let windowUpdateType = 'layer'; + let windowUpdateType = 'focus'; event.type = eventType; event.windowUpdateType = windowUpdateType; event.bundleName = bundleName; @@ -613,7 +1069,7 @@ describe('AccessibleSendEvent', function () { /* * @tc.number SendEvent_windowUpdateType_0060 * @tc.name SendEvent_windowUpdateType_0060 - * @tc.desc The windowUpdateType of EventInfo is 'active', test sendEvent() function + * @tc.desc The windowUpdateType of EventInfo is '', test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User @@ -622,7 +1078,7 @@ describe('AccessibleSendEvent', function () { console.info(`AccessibleSendEvent: SendEvent_windowUpdateType_0060 starts`); let event = new accessibility.EventInfo(); - let windowUpdateType = 'active'; + let windowUpdateType = ''; event.type = eventType; event.windowUpdateType = windowUpdateType; event.bundleName = bundleName; @@ -638,99 +1094,51 @@ describe('AccessibleSendEvent', function () { }) /* - * @tc.number SendEvent_windowUpdateType_0070 - * @tc.name SendEvent_windowUpdateType_0070 - * @tc.desc The windowUpdateType of EventInfo is 'focus', test sendEvent() function - * The result of sendEvent() should be equal to a promise of undefined - * @tc.size SmallTest - * @tc.type User - */ - it('SendEvent_windowUpdateType_0070', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_windowUpdateType_0070 starts`); - - let event = new accessibility.EventInfo(); - let windowUpdateType = 'focus'; - event.type = eventType; - event.windowUpdateType = windowUpdateType; - event.bundleName = bundleName; - event.triggerAction = triggerAction; - accessibility.sendEvent(event).then((result) => { - expect(result).assertEqual(undefined); - done(); - }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_windowUpdateType_0070 has error: ${err}`); - expect(null).assertFail(); - done(); - }); - }) - - /* - * @tc.number SendEvent_windowUpdateType_0080 - * @tc.name SendEvent_windowUpdateType_0080 - * @tc.desc The windowUpdateType of EventInfo is 'accessibilityFocus', test sendEvent() function + * @tc.number SendEvent_windowUpdateType_constructor_0060 + * @tc.name SendEvent_windowUpdateType_constructor_0060 + * @tc.desc The windowUpdateType of EventInfo is '', test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. * @tc.size SmallTest * @tc.type User */ - it('SendEvent_windowUpdateType_0080', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_windowUpdateType_0080 starts`); + it('SendEvent_windowUpdateType_constructor_0060', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_windowUpdateType_constructor_0060 starts`); - let event = new accessibility.EventInfo(); - let windowUpdateType = 'accessibilityFocus'; - event.type = eventType; - event.windowUpdateType = windowUpdateType; - event.bundleName = bundleName; - event.triggerAction = triggerAction; - accessibility.sendEvent(event).then((result) => { - expect(result).assertEqual(undefined); - done(); - }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_windowUpdateType_0080 has error: ${err}`); - expect(null).assertFail(); - done(); - }); - }) + let windowUpdateType = ''; + let jsonObj = { + type : eventType, + windowUpdateType : windowUpdateType, + bundleName : bundleName, + triggerAction : triggerAction, + } - /* - * @tc.number SendEvent_windowUpdateType_0090 - * @tc.name SendEvent_windowUpdateType_0090 - * @tc.desc The windowUpdateType of EventInfo is 'parent', test sendEvent() function - * The result of sendEvent() should be equal to a promise of undefined - * @tc.size SmallTest - * @tc.type User - */ - it('SendEvent_windowUpdateType_0090', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_windowUpdateType_0090 starts`); + let event = new accessibility.EventInfo(jsonObj); - let event = new accessibility.EventInfo(); - let windowUpdateType = 'parent'; - event.type = eventType; - event.windowUpdateType = windowUpdateType; - event.bundleName = bundleName; - event.triggerAction = triggerAction; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_windowUpdateType_0090 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_windowUpdateType_constructor_0060 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_windowUpdateType_0010 - * @tc.name SendEvent_windowUpdateType_0010 - * @tc.desc The windowUpdateType of EventInfo is 'children', test sendEvent() function + * @tc.number SendEvent_windowUpdateType_0070 + * @tc.name SendEvent_windowUpdateType_0070 + * @tc.desc The windowUpdateType of EventInfo is null, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_windowUpdateType_0010', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_windowUpdateType_0010 starts`); + it('SendEvent_windowUpdateType_0070', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_windowUpdateType_0070 starts`); let event = new accessibility.EventInfo(); - let windowUpdateType = 'children'; + let windowUpdateType = null; event.type = eventType; event.windowUpdateType = windowUpdateType; event.bundleName = bundleName; @@ -739,114 +1147,98 @@ describe('AccessibleSendEvent', function () { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_windowUpdateType_0010 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_windowUpdateType_0070 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_windowUpdateType_0011 - * @tc.name SendEvent_windowUpdateType_0011 - * @tc.desc The windowUpdateType of EventInfo is 'pip', test sendEvent() function + * @tc.number SendEvent_windowUpdateType_constructor_0070 + * @tc.name SendEvent_windowUpdateType_constructor_0070 + * @tc.desc The windowUpdateType of EventInfo is null, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. * @tc.size SmallTest * @tc.type User */ - it('SendEvent_windowUpdateType_0011', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_windowUpdateType_0011 starts`); + it('SendEvent_windowUpdateType_constructor_0070', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_windowUpdateType_constructor_0070 starts`); - let event = new accessibility.EventInfo(); - let windowUpdateType = 'pip'; - event.type = eventType; - event.windowUpdateType = windowUpdateType; - event.bundleName = bundleName; - event.triggerAction = triggerAction; - accessibility.sendEvent(event).then((result) => { - expect(result).assertEqual(undefined); - done(); - }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_windowUpdateType_0011 has error: ${err}`); - expect(null).assertFail(); - done(); - }); - }) + let windowUpdateType = null; + let jsonObj = { + type : eventType, + windowUpdateType : windowUpdateType, + bundleName : bundleName, + triggerAction : triggerAction, + } - /* - * @tc.number SendEvent_windowUpdateType_0012 - * @tc.name SendEvent_windowUpdateType_0012 - * @tc.desc The windowUpdateType of EventInfo is '', test sendEvent() function - * The result of sendEvent() should be equal to a promise of undefined - * @tc.size SmallTest - * @tc.type User - */ - it('SendEvent_windowUpdateType_0012', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_windowUpdateType_0012 starts`); + let event = new accessibility.EventInfo(jsonObj); - let event = new accessibility.EventInfo(); - let windowUpdateType = ''; - event.type = eventType; - event.windowUpdateType = windowUpdateType; - event.bundleName = bundleName; - event.triggerAction = triggerAction; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_windowUpdateType_0012 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_windowUpdateType_constructor_0070 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_windowUpdateType_0013 - * @tc.name SendEvent_windowUpdateType_0013 - * @tc.desc The windowUpdateType of EventInfo is null, test sendEvent() function + * @tc.number SendEvent_bundleName_0010 + * @tc.name SendEvent_bundleName_0010 + * @tc.desc The bundleName of EventInfo is 'com.ixaa.testfora11y', test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_windowUpdateType_0013', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_windowUpdateType_0013 starts`); + it('SendEvent_bundleName_0010', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_bundleName_0010 starts`); let event = new accessibility.EventInfo(); - let windowUpdateType = null; + let localBundleName = 'com.ixaa.testfora11y'; event.type = eventType; - event.windowUpdateType = windowUpdateType; - event.bundleName = bundleName; + event.bundleName = localBundleName; event.triggerAction = triggerAction; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_windowUpdateType_0013 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_bundleName_0010 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_bundleName_0010 - * @tc.name SendEvent_bundleName_0010 + * @tc.number SendEvent_bundleName_constructor_0010 + * @tc.name SendEvent_bundleName_constructor_0010 * @tc.desc The bundleName of EventInfo is 'com.ixaa.testfora11y', test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. * @tc.size SmallTest * @tc.type User */ - it('SendEvent_bundleName_0010', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_bundleName_0010 starts`); + it('SendEvent_bundleName_constructor_0010', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_bundleName_constructor_0010 starts`); - let event = new accessibility.EventInfo(); let localBundleName = 'com.ixaa.testfora11y'; - event.type = eventType; - event.bundleName = localBundleName; - event.triggerAction = triggerAction; + let jsonObj = { + type : eventType, + bundleName : localBundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_bundleName_0010 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_bundleName_constructor_0010 has error: ${err}`); expect(null).assertFail(); done(); }); @@ -870,12 +1262,45 @@ describe('AccessibleSendEvent', function () { event.triggerAction = triggerAction; accessibility.sendEvent(event).then((result) =>{ console.error(`AccessibleSendEvent: SendEvent_bundleName_0020 result ${result}`); - expect(null).assertFail(); - done(); + expect(null).assertFail(); + done(); }).catch((err) => { console.info(`AccessibleSendEvent: SendEvent_bundleName_0020 has error: ${err}`); expect(err).assertEqual(undefined); - done(); + done(); + }); + }) + + /* + * @tc.number SendEvent_bundleName_constructor_0020 + * @tc.name SendEvent_bundleName_constructor_0020 + * @tc.desc The bundleName of EventInfo is '', test sendEvent() function + * The result of sendEvent() should be equal to a rejected promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_bundleName_constructor_0020', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_bundleName_constructor_0020 starts`); + + let localBundleName = ''; + let jsonObj = { + type : eventType, + bundleName : localBundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) =>{ + console.error(`AccessibleSendEvent: SendEvent_bundleName_constructor_0020 result ${result}`); + expect(null).assertFail(); + done(); + }).catch((err) => { + console.info(`AccessibleSendEvent: SendEvent_bundleName_constructor_0020 has error: ${err}`); + expect(err).assertEqual(undefined); + done(); }); }) @@ -895,14 +1320,47 @@ describe('AccessibleSendEvent', function () { event.type = eventType; event.bundleName = localBundleName; event.triggerAction = triggerAction; - accessibility.sendEvent(event).then((result) =>{ + accessibility.sendEvent(event).then((result) =>{ console.error(`AccessibleSendEvent: SendEvent_bundleName_0030 result ${result}`); - expect(null).assertFail(); - done(); + expect(null).assertFail(); + done(); }).catch((err) => { console.info(`AccessibleSendEvent: SendEvent_bundleName_0030 has error: ${err}`); expect(err).assertEqual(undefined); - done(); + done(); + }); + }) + + /* + * @tc.number SendEvent_bundleName_constructor_0030 + * @tc.name SendEvent_bundleName_constructor_0030 + * @tc.desc The bundleName of EventInfo is null, test sendEvent() function + * The result of sendEvent() should be equal to a rejected promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_bundleName_constructor_0030', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_bundleName_constructor_0030 starts`); + + let localBundleName = null; + let jsonObj = { + type : eventType, + bundleName : localBundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) =>{ + console.error(`AccessibleSendEvent: SendEvent_bundleName_constructor_0030 result ${result}`); + expect(null).assertFail(); + done(); + }).catch((err) => { + console.info(`AccessibleSendEvent: SendEvent_bundleName_constructor_0030 has error: ${err}`); + expect(err).assertEqual(undefined); + done(); }); }) @@ -933,6 +1391,39 @@ describe('AccessibleSendEvent', function () { }); }) + /* + * @tc.number SendEvent_componentType_constructor_0010 + * @tc.name SendEvent_componentType_constructor_0010 + * @tc.desc The componentType of EventInfo is 'button', test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_componentType_constructor_0010', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_componentType_constructor_0010 starts`); + + let componentType = 'button'; + let jsonObj = { + type : eventType, + bundleName : bundleName, + componentType : componentType, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_componentType_constructor_0010 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) + /* * @tc.number SendEvent_componentType_0020 * @tc.name SendEvent_componentType_0020 @@ -960,6 +1451,39 @@ describe('AccessibleSendEvent', function () { }); }) + /* + * @tc.number SendEvent_componentType_constructor_0020 + * @tc.name SendEvent_componentType_constructor_0020 + * @tc.desc The componentType of EventInfo is '', test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_componentType_constructor_0020', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_componentType_constructor_0020 starts`); + + let componentType = ''; + let jsonObj = { + type : eventType, + bundleName : bundleName, + componentType : componentType, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_componentType_constructor_0020 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) + /* * @tc.number SendEvent_componentType_0030 * @tc.name SendEvent_componentType_0030 @@ -988,180 +1512,171 @@ describe('AccessibleSendEvent', function () { }) /* - * @tc.number SendEvent_timeStamp_0010 - * @tc.name SendEvent_timeStamp_0010 - * @tc.desc The timeStamp of EventInfo is 1, test sendEvent() function + * @tc.number SendEvent_componentType_constructor_0030 + * @tc.name SendEvent_componentType_constructor_0030 + * @tc.desc The componentType of EventInfo is null, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. * @tc.size SmallTest * @tc.type User */ - it('SendEvent_timeStamp_0010', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_timeStamp_0010 starts`); + it('SendEvent_componentType_constructor_0030', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_componentType_constructor_0030 starts`); + + let componentType = null; + let jsonObj = { + type : eventType, + bundleName : bundleName, + componentType : componentType, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); - let event = new accessibility.EventInfo(); - let timeStamp = 1; - event.type = eventType; - event.bundleName = bundleName; - event.timeStamp = timeStamp; - event.triggerAction = triggerAction; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_timeStamp_0010 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_componentType_constructor_0030 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_timeStamp_0020 - * @tc.name SendEvent_timeStamp_0020 - * @tc.desc The timeStamp of EventInfo is 0, test sendEvent() function + * @tc.number SendEvent_pageId_0010 + * @tc.name SendEvent_pageId_0010 + * @tc.desc The pageId of EventInfo is 1, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_timeStamp_0020', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_timeStamp_0020 starts`); + it('SendEvent_pageId_0010', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_pageId_0010 starts`); let event = new accessibility.EventInfo(); - let timeStamp = 0; + let pageId = 1; event.type = eventType; event.bundleName = bundleName; - event.timeStamp = timeStamp; + event.pageId = pageId; event.triggerAction = triggerAction; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_timeStamp_0020 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_pageId_0010 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_timeStamp_0030 - * @tc.name SendEvent_timeStamp_0030 - * @tc.desc The timeStamp of EventInfo is -1, test sendEvent() function + * @tc.number SendEvent_pageId_constructor_0010 + * @tc.name SendEvent_pageId_constructor_0010 + * @tc.desc The pageId of EventInfo is 1, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. * @tc.size SmallTest * @tc.type User */ - it('SendEvent_timeStamp_0030', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_timeStamp_0030 starts`); + it('SendEvent_pageId_constructor_0010', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_pageId_constructor_0010 starts`); + + let pageId = 1; + let jsonObj = { + type : eventType, + bundleName : bundleName, + pageId : pageId, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); - let event = new accessibility.EventInfo(); - let timeStamp = -1; - event.type = eventType; - event.bundleName = bundleName; - event.timeStamp = timeStamp; - event.triggerAction = triggerAction; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_timeStamp_0030 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_pageId_constructor_0010 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_windowId_0010 - * @tc.name SendEvent_windowId_0010 - * @tc.desc The windowId of EventInfo is 1, test sendEvent() function + * @tc.number SendEvent_pageId_0020 + * @tc.name SendEvent_pageId_0020 + * @tc.desc The pageId of EventInfo is 0, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_windowId_0010', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_windowId_0010 starts`); + it('SendEvent_pageId_0020', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_pageId_0020 starts`); let event = new accessibility.EventInfo(); - let windowId = 1; + let pageId = 0; event.type = eventType; event.bundleName = bundleName; - event.windowId = windowId; + event.pageId = pageId; event.triggerAction = triggerAction; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_windowId_0010 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_pageId_0020 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_windowId_0020 - * @tc.name SendEvent_windowId_0020 - * @tc.desc The windowId of EventInfo is 0, test sendEvent() function + * @tc.number SendEvent_pageId_constructor_0020 + * @tc.name SendEvent_pageId_constructor_0020 + * @tc.desc The pageId of EventInfo is 0, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. * @tc.size SmallTest * @tc.type User */ - it('SendEvent_windowId_0020', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_windowId_0020 starts`); + it('SendEvent_pageId_constructor_0020', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_pageId_constructor_0020 starts`); - let event = new accessibility.EventInfo(); - let windowId = 0; - event.type = eventType; - event.bundleName = bundleName; - event.windowId = windowId; - event.triggerAction = triggerAction; - accessibility.sendEvent(event).then((result) => { - expect(result).assertEqual(undefined); - done(); - }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_windowId_0020 has error: ${err}`); - expect(null).assertFail(); - done(); - }); - }) + let pageId = 0; + let jsonObj = { + type : eventType, + bundleName : bundleName, + pageId : pageId, + triggerAction : triggerAction, + } - /* - * @tc.number SendEvent_windowId_0030 - * @tc.name SendEvent_windowId_0030 - * @tc.desc The windowId of EventInfo is -1, test sendEvent() function - * The result of sendEvent() should be equal to a promise of undefined - * @tc.size SmallTest - * @tc.type User - */ - it('SendEvent_windowId_0030', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_windowId_0030 starts`); + let event = new accessibility.EventInfo(jsonObj); - let event = new accessibility.EventInfo(); - let windowId = -1; - event.type = eventType; - event.bundleName = bundleName; - event.windowId = windowId; - event.triggerAction = triggerAction; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_windowId_0030 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_pageId_constructor_0020 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_pageId_0010 - * @tc.name SendEvent_pageId_0010 - * @tc.desc The pageId of EventInfo is 1, test sendEvent() function + * @tc.number SendEvent_pageId_0030 + * @tc.name SendEvent_pageId_0030 + * @tc.desc The pageId of EventInfo is -1, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_pageId_0010', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_pageId_0010 starts`); + it('SendEvent_pageId_0030', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_pageId_0030 starts`); let event = new accessibility.EventInfo(); - let pageId = 1; + let pageId = -1; event.type = eventType; event.bundleName = bundleName; event.pageId = pageId; @@ -1170,160 +1685,178 @@ describe('AccessibleSendEvent', function () { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_pageId_0010 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_pageId_0030 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_pageId_0020 - * @tc.name SendEvent_pageId_0020 - * @tc.desc The pageId of EventInfo is 0, test sendEvent() function + * @tc.number SendEvent_pageId_constructor_0030 + * @tc.name SendEvent_pageId_constructor_0030 + * @tc.desc The pageId of EventInfo is -1, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. * @tc.size SmallTest * @tc.type User */ - it('SendEvent_pageId_0020', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_pageId_0020 starts`); + it('SendEvent_pageId_constructor_0030', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_pageId_constructor_0030 starts`); + + let pageId = -1; + let jsonObj = { + type : eventType, + bundleName : bundleName, + pageId : pageId, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); - let event = new accessibility.EventInfo(); - let pageId = 0; - event.type = eventType; - event.bundleName = bundleName; - event.pageId = pageId; - event.triggerAction = triggerAction; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_pageId_0020 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_pageId_constructor_0030 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_pageId_0030 - * @tc.name SendEvent_pageId_0030 - * @tc.desc The pageId of EventInfo is -1, test sendEvent() function + * @tc.number SendEvent_description_0010 + * @tc.name SendEvent_description_0010 + * @tc.desc The description of EventInfo is '1', test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_pageId_0030', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_pageId_0030 starts`); + it('SendEvent_description_0010', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_description_0010 starts`); let event = new accessibility.EventInfo(); - let pageId = -1; + let description = '1'; event.type = eventType; event.bundleName = bundleName; - event.pageId = pageId; + event.description = description; event.triggerAction = triggerAction; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_pageId_0030 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_description_0010 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_componentId_0010 - * @tc.name SendEvent_componentId_0010 - * @tc.desc The componentId of EventInfo is 1, test sendEvent() function + * @tc.number SendEvent_description_constructor_0010 + * @tc.name SendEvent_description_constructor_0010 + * @tc.desc The description of EventInfo is '1', test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. * @tc.size SmallTest * @tc.type User */ - it('SendEvent_componentId_0010', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_componentId_0010 starts`); + it('SendEvent_description_constructor_0010', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_description_constructor_0010 starts`); + + let description = '1'; + let jsonObj = { + type : eventType, + bundleName : bundleName, + description : description, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); - let event = new accessibility.EventInfo(); - let componentId = 1; - event.type = eventType; - event.bundleName = bundleName; - event.componentId = componentId; - event.triggerAction = triggerAction; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_componentId_0010 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_description_constructor_0010 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_componentId_0020 - * @tc.name SendEvent_componentId_0020 - * @tc.desc The componentId of EventInfo is 0, test sendEvent() function + * @tc.number SendEvent_description_0020 + * @tc.name SendEvent_description_0020 + * @tc.desc The description of EventInfo is '', test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_componentId_0020', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_componentId_0020 starts`); + it('SendEvent_description_0020', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_description_0020 starts`); let event = new accessibility.EventInfo(); - let componentId = 0; + let description = ''; event.type = eventType; event.bundleName = bundleName; - event.componentId = componentId; + event.description = description; event.triggerAction = triggerAction; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_componentId_0020 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_description_0020 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_componentId_0030 - * @tc.name SendEvent_componentId_0030 - * @tc.desc The componentId of EventInfo is -1, test sendEvent() function + * @tc.number SendEvent_description_constructor_0020 + * @tc.name SendEvent_description_constructor_0020 + * @tc.desc The description of EventInfo is '', test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. * @tc.size SmallTest * @tc.type User */ - it('SendEvent_componentId_0030', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_componentId_0030 starts`); + it('SendEvent_description_constructor_0020', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_description_constructor_0020 starts`); + + let description = ''; + let jsonObj = { + type : eventType, + bundleName : bundleName, + description : description, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); - let event = new accessibility.EventInfo(); - let componentId = -1; - event.type = eventType; - event.bundleName = bundleName; - event.componentId = componentId; - event.triggerAction = triggerAction; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_componentId_0030 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_description_constructor_0020 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_description_0010 - * @tc.name SendEvent_description_0010 - * @tc.desc The description of EventInfo is '1', test sendEvent() function + * @tc.number SendEvent_description_0030 + * @tc.name SendEvent_description_0030 + * @tc.desc The description of EventInfo is null, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_description_0010', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_description_0010 starts`); + it('SendEvent_description_0030', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_description_0030 starts`); let event = new accessibility.EventInfo(); - let description = '1'; + let description = null; event.type = eventType; event.bundleName = bundleName; event.description = description; @@ -1332,87 +1865,98 @@ describe('AccessibleSendEvent', function () { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_description_0010 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_description_0030 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_description_0020 - * @tc.name SendEvent_description_0020 - * @tc.desc The description of EventInfo is '', test sendEvent() function + * @tc.number SendEvent_description_constructor_0030 + * @tc.name SendEvent_description_constructor_0030 + * @tc.desc The description of EventInfo is null, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. * @tc.size SmallTest * @tc.type User */ - it('SendEvent_description_0020', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_description_0020 starts`); + it('SendEvent_description_constructor_0030', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_description_constructor_0030 starts`); + + let description = null; + let jsonObj = { + type : eventType, + bundleName : bundleName, + description : description, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); - let event = new accessibility.EventInfo(); - let description = ''; - event.type = eventType; - event.bundleName = bundleName; - event.description = description; - event.triggerAction = triggerAction; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_description_0020 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_description_constructor_0030 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_description_0030 - * @tc.name SendEvent_description_0030 - * @tc.desc The description of EventInfo is null, test sendEvent() function + * @tc.number SendEvent_triggerAction_0010 + * @tc.name SendEvent_triggerAction_0010 + * @tc.desc The triggerAction of EventInfo is 'accessibilityFocus', test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_description_0030', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_description_0030 starts`); + it('SendEvent_triggerAction_0010', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_triggerAction_0010 starts`); let event = new accessibility.EventInfo(); - let description = null; + let triggerAction = 'accessibilityFocus'; event.type = eventType; event.bundleName = bundleName; - event.description = description; event.triggerAction = triggerAction; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_description_0030 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_triggerAction_0010 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_triggerAction_0010 - * @tc.name SendEvent_triggerAction_0010 + * @tc.number SendEvent_triggerAction_constructor_0010 + * @tc.name SendEvent_triggerAction_constructor_0010 * @tc.desc The triggerAction of EventInfo is 'accessibilityFocus', test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. * @tc.size SmallTest * @tc.type User */ - it('SendEvent_triggerAction_0010', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_triggerAction_0010 starts`); + it('SendEvent_triggerAction_constructor_0010', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0010 starts`); - let event = new accessibility.EventInfo(); let triggerAction = 'accessibilityFocus'; - event.type = eventType; - event.bundleName = bundleName; - event.triggerAction = triggerAction; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_triggerAction_0010 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0010 has error: ${err}`); expect(null).assertFail(); done(); }); @@ -1444,6 +1988,38 @@ describe('AccessibleSendEvent', function () { }); }) + /* + * @tc.number SendEvent_triggerAction_constructor_0020 + * @tc.name SendEvent_triggerAction_constructor_0020 + * @tc.desc The triggerAction of EventInfo is 'clearAccessibilityFocus', test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_triggerAction_constructor_0020', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0020 starts`); + + let triggerAction = 'clearAccessibilityFocus'; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0020 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) + /* * @tc.number SendEvent_triggerAction_0030 * @tc.name SendEvent_triggerAction_0030 @@ -1470,6 +2046,36 @@ describe('AccessibleSendEvent', function () { }); }) + /* + * @tc.number SendEvent_triggerAction_constructor_0030 + * @tc.name SendEvent_triggerAction_constructor_0030 + * @tc.desc The triggerAction of EventInfo is 'focus', test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_triggerAction_constructor_0030', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0030 starts`); + + let triggerAction = 'focus'; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0030 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) + /* * @tc.number SendEvent_triggerAction_0040 * @tc.name SendEvent_triggerAction_0040 @@ -1496,6 +2102,38 @@ describe('AccessibleSendEvent', function () { }); }) + /* + * @tc.number SendEvent_triggerAction_constructor_0040 + * @tc.name SendEvent_triggerAction_constructor_0040 + * @tc.desc The triggerAction of EventInfo is 'clearFocus', test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_triggerAction_constructor_0040', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0040 starts`); + + let triggerAction = 'clearFocus'; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0040 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) + /* * @tc.number SendEvent_triggerAction_0050 * @tc.name SendEvent_triggerAction_0050 @@ -1522,6 +2160,38 @@ describe('AccessibleSendEvent', function () { }); }) + /* + * @tc.number SendEvent_triggerAction_constructor_0050 + * @tc.name SendEvent_triggerAction_constructor_0050 + * @tc.desc The triggerAction of EventInfo is 'clearSelection', test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_triggerAction_constructor_0050', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0050 starts`); + + let triggerAction = 'clearSelection'; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0050 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) + /* * @tc.number SendEvent_triggerAction_0060 * @tc.name SendEvent_triggerAction_0060 @@ -1548,6 +2218,38 @@ describe('AccessibleSendEvent', function () { }); }) + /* + * @tc.number SendEvent_triggerAction_constructor_0060 + * @tc.name SendEvent_triggerAction_constructor_0060 + * @tc.desc The triggerAction of EventInfo is 'click', test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_triggerAction_constructor_0060', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0060 starts`); + + let triggerAction = 'click'; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0060 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) + /* * @tc.number SendEvent_triggerAction_0070 * @tc.name SendEvent_triggerAction_0070 @@ -1574,6 +2276,38 @@ describe('AccessibleSendEvent', function () { }); }) + /* + * @tc.number SendEvent_triggerAction_constructor_0070 + * @tc.name SendEvent_triggerAction_constructor_0070 + * @tc.desc The triggerAction of EventInfo is 'longClick', test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_triggerAction_constructor_0070', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0070 starts`); + + let triggerAction = 'longClick'; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0070 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) + /* * @tc.number SendEvent_triggerAction_0080 * @tc.name SendEvent_triggerAction_0080 @@ -1601,8 +2335,40 @@ describe('AccessibleSendEvent', function () { }) /* - * @tc.number SendEvent_triggerAction_0090 - * @tc.name SendEvent_triggerAction_0090 + * @tc.number SendEvent_triggerAction_constructor_0080 + * @tc.name SendEvent_triggerAction_constructor_0080 + * @tc.desc The triggerAction of EventInfo is 'cut', test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_triggerAction_constructor_0080', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0080 starts`); + + let triggerAction = 'cut'; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0080 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) + + /* + * @tc.number SendEvent_triggerAction_0090 + * @tc.name SendEvent_triggerAction_0090 * @tc.desc The triggerAction of EventInfo is 'copy', test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest @@ -1626,6 +2392,38 @@ describe('AccessibleSendEvent', function () { }); }) + /* + * @tc.number SendEvent_triggerAction_constructor_0090 + * @tc.name SendEvent_triggerAction_constructor_0090 + * @tc.desc The triggerAction of EventInfo is 'copy', test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_triggerAction_constructor_0090', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0090 starts`); + + let triggerAction = 'copy'; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0090 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) + /* * @tc.number SendEvent_triggerAction_0100 * @tc.name SendEvent_triggerAction_0100 @@ -1652,6 +2450,38 @@ describe('AccessibleSendEvent', function () { }); }) + /* + * @tc.number SendEvent_triggerAction_constructor_0100 + * @tc.name SendEvent_triggerAction_constructor_0100 + * @tc.desc The triggerAction of EventInfo is 'paste', test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_triggerAction_constructor_0100', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0100 starts`); + + let triggerAction = 'paste'; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0100 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) + /* * @tc.number SendEvent_triggerAction_0110 * @tc.name SendEvent_triggerAction_0110 @@ -1678,6 +2508,38 @@ describe('AccessibleSendEvent', function () { }); }) + /* + * @tc.number SendEvent_triggerAction_constructor_0110 + * @tc.name SendEvent_triggerAction_constructor_0110 + * @tc.desc The triggerAction of EventInfo is 'select', test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_triggerAction_constructor_0110', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0110 starts`); + + let triggerAction = 'select'; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0110 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) + /* * @tc.number SendEvent_triggerAction_0120 * @tc.name SendEvent_triggerAction_0120 @@ -1704,6 +2566,38 @@ describe('AccessibleSendEvent', function () { }); }) + /* + * @tc.number SendEvent_triggerAction_constructor_0120 + * @tc.name SendEvent_triggerAction_constructor_0120 + * @tc.desc The triggerAction of EventInfo is 'setText', test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_triggerAction_constructor_0120', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0120 starts`); + + let triggerAction = 'setText'; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0120 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) + /* * @tc.number SendEvent_triggerAction_0130 * @tc.name SendEvent_triggerAction_0130 @@ -1730,6 +2624,38 @@ describe('AccessibleSendEvent', function () { }); }) + /* + * @tc.number SendEvent_triggerAction_constructor_0130 + * @tc.name SendEvent_triggerAction_constructor_0130 + * @tc.desc The triggerAction of EventInfo is 'delete', test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_triggerAction_constructor_0130', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0130 starts`); + + let triggerAction = 'delete'; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0130 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) + /* * @tc.number SendEvent_triggerAction_0140 * @tc.name SendEvent_triggerAction_0140 @@ -1756,6 +2682,38 @@ describe('AccessibleSendEvent', function () { }); }) + /* + * @tc.number SendEvent_triggerAction_constructor_0140 + * @tc.name SendEvent_triggerAction_constructor_0140 + * @tc.desc The triggerAction of EventInfo is 'scrollForward', test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_triggerAction_constructor_0140', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0140 starts`); + + let triggerAction = 'scrollForward'; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0140 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) + /* * @tc.number SendEvent_triggerAction_0150 * @tc.name SendEvent_triggerAction_0150 @@ -1782,6 +2740,38 @@ describe('AccessibleSendEvent', function () { }); }) + /* + * @tc.number SendEvent_triggerAction_constructor_0150 + * @tc.name SendEvent_triggerAction_constructor_0150 + * @tc.desc The triggerAction of EventInfo is 'scrollBackward', test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_triggerAction_constructor_0150', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0150 starts`); + + let triggerAction = 'scrollBackward'; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0150 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) + /* * @tc.number SendEvent_triggerAction_0160 * @tc.name SendEvent_triggerAction_0160 @@ -1809,15 +2799,47 @@ describe('AccessibleSendEvent', function () { }) /* - * @tc.number SendEvent_triggerAction_0230 - * @tc.name SendEvent_triggerAction_0230 + * @tc.number SendEvent_triggerAction_constructor_0160 + * @tc.name SendEvent_triggerAction_constructor_0160 + * @tc.desc The triggerAction of EventInfo is 'setSelection', test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_triggerAction_constructor_0160', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0160 starts`); + + let triggerAction = 'setSelection'; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0160 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) + + /* + * @tc.number SendEvent_triggerAction_0170 + * @tc.name SendEvent_triggerAction_0170 * @tc.desc The triggerAction of EventInfo is '', test sendEvent() function * The result of sendEvent() should be equal to a rejected promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_triggerAction_0230', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_triggerAction_0230 starts`); + it('SendEvent_triggerAction_0170', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_triggerAction_0170 starts`); let event = new accessibility.EventInfo(); let triggerAction = ''; @@ -1825,26 +2847,59 @@ describe('AccessibleSendEvent', function () { event.bundleName = bundleName; event.triggerAction = triggerAction; accessibility.sendEvent(event).then((result) =>{ - console.error(`AccessibleSendEvent: SendEvent_triggerAction_0230 result ${result}`); - expect(null).assertFail(); - done(); + console.error(`AccessibleSendEvent: SendEvent_triggerAction_0170 result ${result}`); + expect(null).assertFail(); + done(); + }).catch((err) => { + console.info(`AccessibleSendEvent: SendEvent_triggerAction_0170 has error: ${err}`); + expect(err).assertEqual(undefined); + done(); + }); + }) + + /* + * @tc.number SendEvent_triggerAction_constructor_0170 + * @tc.name SendEvent_triggerAction_constructor_0170 + * @tc.desc The triggerAction of EventInfo is '', test sendEvent() function + * The result of sendEvent() should be equal to a rejected promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_triggerAction_constructor_0170', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0170 starts`); + + let triggerAction = ''; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) =>{ + console.error(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0170 result ${result}`); + expect(null).assertFail(); + done(); }).catch((err) => { - console.info(`AccessibleSendEvent: SendEvent_triggerAction_0230 has error: ${err}`); + console.info(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0170 has error: ${err}`); expect(err).assertEqual(undefined); - done(); + done(); }); }) /* - * @tc.number SendEvent_triggerAction_0240 - * @tc.name SendEvent_triggerAction_0240 + * @tc.number SendEvent_triggerAction_0180 + * @tc.name SendEvent_triggerAction_0180 * @tc.desc The triggerAction of EventInfo is null, test sendEvent() function * The result of sendEvent() should be equal to a rejected promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_triggerAction_0240', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_triggerAction_0240 starts`); + it('SendEvent_triggerAction_0180', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_triggerAction_0180 starts`); let event = new accessibility.EventInfo(); let triggerAction = null; @@ -1852,13 +2907,46 @@ describe('AccessibleSendEvent', function () { event.bundleName = bundleName; event.triggerAction = triggerAction; accessibility.sendEvent(event).then((result) =>{ - console.error(`AccessibleSendEvent: SendEvent_triggerAction_0240 result ${result}`); - expect(null).assertFail(); - done(); + console.error(`AccessibleSendEvent: SendEvent_triggerAction_0180 result ${result}`); + expect(null).assertFail(); + done(); + }).catch((err) => { + console.info(`AccessibleSendEvent: SendEvent_triggerAction_0180 has error: ${err}`); + expect(err).assertEqual(undefined); + done(); + }); + }) + + /* + * @tc.number SendEvent_triggerAction_constructor_0180 + * @tc.name SendEvent_triggerAction_constructor_0180 + * @tc.desc The triggerAction of EventInfo is null, test sendEvent() function + * The result of sendEvent() should be equal to a rejected promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_triggerAction_constructor_0180', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0180 starts`); + + let triggerAction = null; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) =>{ + console.error(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0180 result ${result}`); + expect(null).assertFail(); + done(); }).catch((err) => { - console.info(`AccessibleSendEvent: SendEvent_triggerAction_0240 has error: ${err}`); + console.info(`AccessibleSendEvent: SendEvent_triggerAction_constructor_0180 has error: ${err}`); expect(err).assertEqual(undefined); - done(); + done(); }); }) @@ -1889,6 +2977,39 @@ describe('AccessibleSendEvent', function () { }); }) + /* + * @tc.number SendEvent_textMoveUnit_constructor_0010 + * @tc.name SendEvent_textMoveUnit_constructor_0010 + * @tc.desc The textMoveUnit of EventInfo is 'char', test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_textMoveUnit_constructor_0010', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_textMoveUnit_constructor_0010 starts`); + + let textMoveUnit = 'char'; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + textMoveUnit : textMoveUnit, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_textMoveUnit_constructor_0010 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) + /* * @tc.number SendEvent_textMoveUnit_0020 * @tc.name SendEvent_textMoveUnit_0020 @@ -1916,6 +3037,39 @@ describe('AccessibleSendEvent', function () { }); }) + /* + * @tc.number SendEvent_textMoveUnit_constructor_0020 + * @tc.name SendEvent_textMoveUnit_constructor_0020 + * @tc.desc The textMoveUnit of EventInfo is 'word', test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_textMoveUnit_constructor_0020', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_textMoveUnit_constructor_0020 starts`); + + let textMoveUnit = 'word'; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + textMoveUnit : textMoveUnit, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_textMoveUnit_constructor_0020 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) + /* * @tc.number SendEvent_textMoveUnit_0030 * @tc.name SendEvent_textMoveUnit_0030 @@ -1944,99 +3098,51 @@ describe('AccessibleSendEvent', function () { }) /* - * @tc.number SendEvent_textMoveUnit_0040 - * @tc.name SendEvent_textMoveUnit_0040 - * @tc.desc The textMoveUnit of EventInfo is 'page', test sendEvent() function + * @tc.number SendEvent_textMoveUnit_constructor_0030 + * @tc.name SendEvent_textMoveUnit_constructor_0030 + * @tc.desc The textMoveUnit of EventInfo is 'line', test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. * @tc.size SmallTest * @tc.type User */ - it('SendEvent_textMoveUnit_0040', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_textMoveUnit_0040 starts`); + it('SendEvent_textMoveUnit_constructor_0030', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_textMoveUnit_constructor_0030 starts`); - let event = new accessibility.EventInfo(); - let textMoveUnit = 'page'; - event.type = eventType; - event.bundleName = bundleName; - event.triggerAction = triggerAction; - event.textMoveUnit = textMoveUnit; - accessibility.sendEvent(event).then((result) => { - expect(result).assertEqual(undefined); - done(); - }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_textMoveUnit_0040 has error: ${err}`); - expect(null).assertFail(); - done(); - }); - }) + let textMoveUnit = 'line'; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + textMoveUnit : textMoveUnit, + } - /* - * @tc.number SendEvent_textMoveUnit_0050 - * @tc.name SendEvent_textMoveUnit_0050 - * @tc.desc The textMoveUnit of EventInfo is 'paragraph', test sendEvent() function - * The result of sendEvent() should be equal to a promise of undefined - * @tc.size SmallTest - * @tc.type User - */ - it('SendEvent_textMoveUnit_0050', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_textMoveUnit_0050 starts`); + let event = new accessibility.EventInfo(jsonObj); - let event = new accessibility.EventInfo(); - let textMoveUnit = 'paragraph'; - event.type = eventType; - event.bundleName = bundleName; - event.triggerAction = triggerAction; - event.textMoveUnit = textMoveUnit; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_textMoveUnit_0050 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_textMoveUnit_constructor_0030 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_textMoveUnit_0060 - * @tc.name SendEvent_textMoveUnit_0060 - * @tc.desc The textMoveUnit of EventInfo is '', test sendEvent() function - * The result of sendEvent() should be equal to a promise of undefined - * @tc.size SmallTest - * @tc.type User - */ - it('SendEvent_textMoveUnit_0060', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_textMoveUnit_0060 starts`); - - let event = new accessibility.EventInfo(); - let textMoveUnit = ''; - event.type = eventType; - event.bundleName = bundleName; - event.triggerAction = triggerAction; - event.textMoveUnit = textMoveUnit; - accessibility.sendEvent(event).then((result) => { - expect(result).assertEqual(undefined); - done(); - }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_textMoveUnit_0060 has error: ${err}`); - expect(null).assertFail(); - done(); - }); - }) - - /* - * @tc.number SendEvent_textMoveUnit_0070 - * @tc.name SendEvent_textMoveUnit_0070 - * @tc.desc The textMoveUnit of EventInfo is null, test sendEvent() function + * @tc.number SendEvent_textMoveUnit_0040 + * @tc.name SendEvent_textMoveUnit_0040 + * @tc.desc The textMoveUnit of EventInfo is 'page', test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_textMoveUnit_0070', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_textMoveUnit_0070 starts`); + it('SendEvent_textMoveUnit_0040', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_textMoveUnit_0040 starts`); let event = new accessibility.EventInfo(); - let textMoveUnit = null; + let textMoveUnit = 'page'; event.type = eventType; event.bundleName = bundleName; event.triggerAction = triggerAction; @@ -2045,1338 +3151,1242 @@ describe('AccessibleSendEvent', function () { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_textMoveUnit_0070 has error: ${err}`); - expect(null).assertFail(); - done(); - }); - }) - - /* - * @tc.number SendEvent_contents_0010 - * @tc.name SendEvent_contents_0010 - * @tc.desc The contents of EventInfo is ['1'], test sendEvent() function - * The result of sendEvent() should be equal to a promise of undefined - * @tc.size SmallTest - * @tc.type User - */ - it('SendEvent_contents_0010', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_contents_0010 starts`); - - let event = new accessibility.EventInfo(); - let contents = ['1']; - event.type = eventType; - event.bundleName = bundleName; - event.triggerAction = triggerAction; - event.contents = contents; - accessibility.sendEvent(event).then((result) => { - expect(result).assertEqual(undefined); - done(); - }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_contents_0010 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_textMoveUnit_0040 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_contents_0020 - * @tc.name SendEvent_contents_0020 - * @tc.desc The contents of EventInfo is [], test sendEvent() function + * @tc.number SendEvent_textMoveUnit_constructor_0040 + * @tc.name SendEvent_textMoveUnit_constructor_0040 + * @tc.desc The textMoveUnit of EventInfo is 'page', test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. * @tc.size SmallTest * @tc.type User */ - it('SendEvent_contents_0020', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_contents_0020 starts`); + it('SendEvent_textMoveUnit_constructor_0040', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_textMoveUnit_constructor_0040 starts`); - let event = new accessibility.EventInfo(); - let contents = []; - event.type = eventType; - event.bundleName = bundleName; - event.triggerAction = triggerAction; - event.contents = contents; - accessibility.sendEvent(event).then((result) => { - expect(result).assertEqual(undefined); - done(); - }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_contents_0020 has error: ${err}`); - expect(null).assertFail(); - done(); - }); - }) + let textMoveUnit = 'page'; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + textMoveUnit : textMoveUnit, + } - /* - * @tc.number SendEvent_lastContent_0010 - * @tc.name SendEvent_lastContent_0010 - * @tc.desc The lastContent of EventInfo is '1', test sendEvent() function - * The result of sendEvent() should be equal to a promise of undefined - * @tc.size SmallTest - * @tc.type User - */ - it('SendEvent_lastContent_0010', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_lastContent_0010 starts`); + let event = new accessibility.EventInfo(jsonObj); - let event = new accessibility.EventInfo(); - let lastContent = '1'; - event.type = eventType; - event.bundleName = bundleName; - event.lastContent = lastContent; - event.triggerAction = triggerAction; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_lastContent_0010 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_textMoveUnit_constructor_0040 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_lastContent_0020 - * @tc.name SendEvent_lastContent_0020 - * @tc.desc The lastContent of EventInfo is '', test sendEvent() function + * @tc.number SendEvent_textMoveUnit_0050 + * @tc.name SendEvent_textMoveUnit_0050 + * @tc.desc The textMoveUnit of EventInfo is 'paragraph', test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_lastContent_0020', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_lastContent_0020 starts`); + it('SendEvent_textMoveUnit_0050', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_textMoveUnit_0050 starts`); let event = new accessibility.EventInfo(); - let lastContent = ''; + let textMoveUnit = 'paragraph'; event.type = eventType; event.bundleName = bundleName; - event.lastContent = lastContent; event.triggerAction = triggerAction; + event.textMoveUnit = textMoveUnit; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_lastContent_0020 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_textMoveUnit_0050 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_lastContent_0030 - * @tc.name SendEvent_lastContent_0030 - * @tc.desc The lastContent of EventInfo is null, test sendEvent() function + * @tc.number SendEvent_textMoveUnit_constructor_0050 + * @tc.name SendEvent_textMoveUnit_constructor_0050 + * @tc.desc The textMoveUnit of EventInfo is 'paragraph', test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. * @tc.size SmallTest * @tc.type User */ - it('SendEvent_lastContent_0030', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_lastContent_0030 starts`); - - let event = new accessibility.EventInfo(); - let lastContent = null; - event.type = eventType; - event.bundleName = bundleName; - event.lastContent = lastContent; - event.triggerAction = triggerAction; - accessibility.sendEvent(event).then((result) => { - expect(result).assertEqual(undefined); - done(); - }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_lastContent_0030 has error: ${err}`); - expect(null).assertFail(); - done(); - }); - }) + it('SendEvent_textMoveUnit_constructor_0050', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_textMoveUnit_constructor_0050 starts`); + let textMoveUnit = 'paragraph'; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + textMoveUnit : textMoveUnit, + } - /* - * @tc.number SendEvent_beginIndex_0010 - * @tc.name SendEvent_beginIndex_0010 - * @tc.desc The beginIndex of EventInfo is 1, test sendEvent() function - * The result of sendEvent() should be equal to a promise of undefined - * @tc.size SmallTest - * @tc.type User - */ - it('SendEvent_beginIndex_0010', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_beginIndex_0010 starts`); + let event = new accessibility.EventInfo(jsonObj); - let event = new accessibility.EventInfo(); - let beginIndex = 1; - event.type = eventType; - event.bundleName = bundleName; - event.beginIndex = beginIndex; - event.triggerAction = triggerAction; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_beginIndex_0010 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_textMoveUnit_constructor_0050 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_beginIndex_0020 - * @tc.name SendEvent_beginIndex_0020 - * @tc.desc The beginIndex of EventInfo is 0, test sendEvent() function + * @tc.number SendEvent_textMoveUnit_0060 + * @tc.name SendEvent_textMoveUnit_0060 + * @tc.desc The textMoveUnit of EventInfo is '', test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_beginIndex_0020', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_beginIndex_0020 starts`); + it('SendEvent_textMoveUnit_0060', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_textMoveUnit_0060 starts`); let event = new accessibility.EventInfo(); - let beginIndex = 0; + let textMoveUnit = ''; event.type = eventType; event.bundleName = bundleName; - event.beginIndex = beginIndex; event.triggerAction = triggerAction; + event.textMoveUnit = textMoveUnit; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_beginIndex_0020 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_textMoveUnit_0060 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_beginIndex_0030 - * @tc.name SendEvent_beginIndex_0030 - * @tc.desc The beginIndex of EventInfo is -1, test sendEvent() function + * @tc.number SendEvent_textMoveUnit_constructor_0060 + * @tc.name SendEvent_textMoveUnit_constructor_0060 + * @tc.desc The textMoveUnit of EventInfo is '', test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. * @tc.size SmallTest * @tc.type User */ - it('SendEvent_beginIndex_0030', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_beginIndex_0030 starts`); + it('SendEvent_textMoveUnit_constructor_0060', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_textMoveUnit_constructor_0060 starts`); - let event = new accessibility.EventInfo(); - let beginIndex = -1; - event.type = eventType; - event.bundleName = bundleName; - event.beginIndex = beginIndex; - event.triggerAction = triggerAction; - accessibility.sendEvent(event).then((result) => { - expect(result).assertEqual(undefined); - done(); - }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_beginIndex_0030 has error: ${err}`); - expect(null).assertFail(); - done(); - }); - }) + let textMoveUnit = ''; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + textMoveUnit : textMoveUnit, + } - /* - * @tc.number SendEvent_currentIndex_0010 - * @tc.name SendEvent_currentIndex_0010 - * @tc.desc The currentIndex of EventInfo is 1, test sendEvent() function - * The result of sendEvent() should be equal to a promise of undefined - * @tc.size SmallTest - * @tc.type User - */ - it('SendEvent_currentIndex_0010', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_currentIndex_0010 starts`); + let event = new accessibility.EventInfo(jsonObj); - let event = new accessibility.EventInfo(); - let currentIndex = 1; - event.type = eventType; - event.bundleName = bundleName; - event.currentIndex = currentIndex; - event.triggerAction = triggerAction; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_currentIndex_0010 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_textMoveUnit_constructor_0060 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_currentIndex_0020 - * @tc.name SendEvent_currentIndex_0020 - * @tc.desc The currentIndex of EventInfo is 0, test sendEvent() function + * @tc.number SendEvent_textMoveUnit_0070 + * @tc.name SendEvent_textMoveUnit_0070 + * @tc.desc The textMoveUnit of EventInfo is null, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_currentIndex_0020', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_currentIndex_0020 starts`); + it('SendEvent_textMoveUnit_0070', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_textMoveUnit_0070 starts`); let event = new accessibility.EventInfo(); - let currentIndex = 0; + let textMoveUnit = null; event.type = eventType; event.bundleName = bundleName; - event.currentIndex = currentIndex; event.triggerAction = triggerAction; + event.textMoveUnit = textMoveUnit; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_currentIndex_0020 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_textMoveUnit_0070 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_currentIndex_0030 - * @tc.name SendEvent_currentIndex_0030 - * @tc.desc The currentIndex of EventInfo is -1, test sendEvent() function + * @tc.number SendEvent_textMoveUnit_constructor_0070 + * @tc.name SendEvent_textMoveUnit_constructor_0070 + * @tc.desc The textMoveUnit of EventInfo is null, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. * @tc.size SmallTest * @tc.type User */ - it('SendEvent_currentIndex_0030', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_currentIndex_0030 starts`); + it('SendEvent_textMoveUnit_constructor_0070', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_textMoveUnit_constructor_0070 starts`); - let event = new accessibility.EventInfo(); - let currentIndex = -1; - event.type = eventType; - event.bundleName = bundleName; - event.currentIndex = currentIndex; - event.triggerAction = triggerAction; - accessibility.sendEvent(event).then((result) => { - expect(result).assertEqual(undefined); - done(); - }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_currentIndex_0030 has error: ${err}`); - expect(null).assertFail(); - done(); - }); - }) + let textMoveUnit = null; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + textMoveUnit : textMoveUnit, + } - /* - * @tc.number SendEvent_endIndex_0010 - * @tc.name SendEvent_endIndex_0010 - * @tc.desc The endIndex of EventInfo is 1, test sendEvent() function - * The result of sendEvent() should be equal to a promise of undefined - * @tc.size SmallTest - * @tc.type User - */ - it('SendEvent_endIndex_0010', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_endIndex_0010 starts`); + let event = new accessibility.EventInfo(jsonObj); - let event = new accessibility.EventInfo(); - let endIndex = 1; - event.type = eventType; - event.bundleName = bundleName; - event.endIndex = endIndex; - event.triggerAction = triggerAction; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_endIndex_0010 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_textMoveUnit_constructor_0070 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_endIndex_0020 - * @tc.name SendEvent_endIndex_0020 - * @tc.desc The endIndex of EventInfo is 0, test sendEvent() function + * @tc.number SendEvent_contents_0010 + * @tc.name SendEvent_contents_0010 + * @tc.desc The contents of EventInfo is ['1'], test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_endIndex_0020', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_endIndex_0020 starts`); + it('SendEvent_contents_0010', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_contents_0010 starts`); let event = new accessibility.EventInfo(); - let endIndex = 0; + let contents = ['1']; event.type = eventType; event.bundleName = bundleName; - event.endIndex = endIndex; event.triggerAction = triggerAction; + event.contents = contents; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_endIndex_0020 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_contents_0010 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_endIndex_0030 - * @tc.name SendEvent_endIndex_0030 - * @tc.desc The endIndex of EventInfo is -1, test sendEvent() function + * @tc.number SendEvent_contents_constructor_0010 + * @tc.name SendEvent_contents_constructor_0010 + * @tc.desc The contents of EventInfo is ['1'], test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. * @tc.size SmallTest * @tc.type User */ - it('SendEvent_endIndex_0030', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_endIndex_0030 starts`); + it('SendEvent_contents_constructor_0010', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_contents_constructor_0010 starts`); - let event = new accessibility.EventInfo(); - let endIndex = -1; - event.type = eventType; - event.bundleName = bundleName; - event.endIndex = endIndex; - event.triggerAction = triggerAction; - accessibility.sendEvent(event).then((result) => { - expect(result).assertEqual(undefined); - done(); - }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_endIndex_0030 has error: ${err}`); - expect(null).assertFail(); - done(); - }); - }) + let contents = ['1']; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + contents : contents, + } - /* - * @tc.number SendEvent_itemCount_0010 - * @tc.name SendEvent_itemCount_0010 - * @tc.desc The itemCount of EventInfo is 1, test sendEvent() function - * The result of sendEvent() should be equal to a promise of undefined - * @tc.size SmallTest - * @tc.type User - */ - it('SendEvent_itemCount_0010', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_itemCount_0010 starts`); + let event = new accessibility.EventInfo(jsonObj); - let event = new accessibility.EventInfo(); - let itemCount = 1; - event.type = eventType; - event.bundleName = bundleName; - event.itemCount = itemCount; - event.triggerAction = triggerAction; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_itemCount_0010 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_contents_constructor_0010 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_itemCount_0020 - * @tc.name SendEvent_itemCount_0020 - * @tc.desc The itemCount of EventInfo is 0, test sendEvent() function + * @tc.number SendEvent_contents_0020 + * @tc.name SendEvent_contents_0020 + * @tc.desc The contents of EventInfo is [], test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_itemCount_0020', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_itemCount_0020 starts`); + it('SendEvent_contents_0020', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_contents_0020 starts`); let event = new accessibility.EventInfo(); - let itemCount = 0; + let contents = []; event.type = eventType; event.bundleName = bundleName; - event.itemCount = itemCount; event.triggerAction = triggerAction; + event.contents = contents; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_itemCount_0020 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_contents_0020 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_itemCount_0030 - * @tc.name SendEvent_itemCount_0030 - * @tc.desc The itemCount of EventInfo is -1, test sendEvent() function + * @tc.number SendEvent_contents_constructor_0020 + * @tc.name SendEvent_contents_constructor_0020 + * @tc.desc The contents of EventInfo is [], test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. * @tc.size SmallTest * @tc.type User */ - it('SendEvent_itemCount_0030', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_itemCount_0030 starts`); + it('SendEvent_contents_constructor_0020', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_contents_constructor_0020 starts`); - let event = new accessibility.EventInfo(); - let itemCount = -1; - event.type = eventType; - event.bundleName = bundleName; - event.itemCount = itemCount; - event.triggerAction = triggerAction; - accessibility.sendEvent(event).then((result) => { - expect(result).assertEqual(undefined); - done(); - }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_itemCount_0030 has error: ${err}`); - expect(null).assertFail(); - done(); - }); - }) + let contents = []; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + contents : contents, + } - /* - * @tc.number SendEvent_categoryNotification_0010 - * @tc.name SendEvent_categoryNotification_0010 - * @tc.desc The categoryNotification of EventInfo is 'call', test sendEvent() function - * The result of sendEvent() should be equal to a promise of undefined - * @tc.size SmallTest - * @tc.type User - */ - it('SendEvent_categoryNotification_0010', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_categoryNotification_0010 starts`); + let event = new accessibility.EventInfo(jsonObj); - let event = new accessibility.EventInfo(); - let categoryNotification = 'call'; - event.type = eventType; - event.bundleName = bundleName; - event.triggerAction = triggerAction; - event.categoryNotification = categoryNotification; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_categoryNotification_0010 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_contents_constructor_0020 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_categoryNotification_0020 - * @tc.name SendEvent_categoryNotification_0020 - * @tc.desc The categoryNotification of EventInfo is 'msg', test sendEvent() function + * @tc.number SendEvent_lastContent_0010 + * @tc.name SendEvent_lastContent_0010 + * @tc.desc The lastContent of EventInfo is '1', test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_categoryNotification_0020', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_categoryNotification_0020 starts`); + it('SendEvent_lastContent_0010', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_lastContent_0010 starts`); let event = new accessibility.EventInfo(); - let categoryNotification = 'msg'; + let lastContent = '1'; event.type = eventType; event.bundleName = bundleName; + event.lastContent = lastContent; event.triggerAction = triggerAction; - event.categoryNotification = categoryNotification; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_categoryNotification_0020 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_lastContent_0010 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_categoryNotification_0030 - * @tc.name SendEvent_categoryNotification_0030 - * @tc.desc The categoryNotification of EventInfo is 'email', test sendEvent() function + * @tc.number SendEvent_lastContent_constructor_0010 + * @tc.name SendEvent_lastContent_constructor_0010 + * @tc.desc The lastContent of EventInfo is '1', test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. * @tc.size SmallTest * @tc.type User */ - it('SendEvent_categoryNotification_0030', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_categoryNotification_0030 starts`); + it('SendEvent_lastContent_constructor_0010', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_lastContent_constructor_0010 starts`); - let event = new accessibility.EventInfo(); - let categoryNotification = 'email'; - event.type = eventType; - event.bundleName = bundleName; - event.triggerAction = triggerAction; - event.categoryNotification = categoryNotification; - accessibility.sendEvent(event).then((result) => { - expect(result).assertEqual(undefined); - done(); - }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_categoryNotification_0030 has error: ${err}`); - expect(null).assertFail(); - done(); - }); - }) + let lastContent = '1'; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + lastContent : lastContent, + } - /* - * @tc.number SendEvent_categoryNotification_0040 - * @tc.name SendEvent_categoryNotification_0040 - * @tc.desc The categoryNotification of EventInfo is 'event', test sendEvent() function - * The result of sendEvent() should be equal to a promise of undefined - * @tc.size SmallTest - * @tc.type User - */ - it('SendEvent_categoryNotification_0040', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_categoryNotification_0040 starts`); + let event = new accessibility.EventInfo(jsonObj); - let event = new accessibility.EventInfo(); - let categoryNotification = 'event'; - event.type = eventType; - event.bundleName = bundleName; - event.triggerAction = triggerAction; - event.categoryNotification = categoryNotification; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_categoryNotification_0040 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_lastContent_constructor_0010 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_categoryNotification_0050 - * @tc.name SendEvent_categoryNotification_0050 - * @tc.desc The categoryNotification of EventInfo is 'promo', test sendEvent() function + * @tc.number SendEvent_lastContent_0020 + * @tc.name SendEvent_lastContent_0020 + * @tc.desc The lastContent of EventInfo is '', test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_categoryNotification_0050', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_categoryNotification_0050 starts`); + it('SendEvent_lastContent_0020', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_lastContent_0020 starts`); let event = new accessibility.EventInfo(); - let categoryNotification = 'promo'; + let lastContent = ''; event.type = eventType; event.bundleName = bundleName; + event.lastContent = lastContent; event.triggerAction = triggerAction; - event.categoryNotification = categoryNotification; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_categoryNotification_0050 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_lastContent_0020 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_categoryNotification_0060 - * @tc.name SendEvent_categoryNotification_0060 - * @tc.desc The categoryNotification of EventInfo is 'alarm', test sendEvent() function + * @tc.number SendEvent_lastContent_constructor_0020 + * @tc.name SendEvent_lastContent_constructor_0020 + * @tc.desc The lastContent of EventInfo is '', test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. * @tc.size SmallTest * @tc.type User */ - it('SendEvent_categoryNotification_0060', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_categoryNotification_0060 starts`); + it('SendEvent_lastContent_constructor_0020', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_lastContent_constructor_0020 starts`); - let event = new accessibility.EventInfo(); - let categoryNotification = 'alarm'; - event.type = eventType; - event.bundleName = bundleName; - event.triggerAction = triggerAction; - event.categoryNotification = categoryNotification; - accessibility.sendEvent(event).then((result) => { - expect(result).assertEqual(undefined); - done(); - }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_categoryNotification_0060 has error: ${err}`); - expect(null).assertFail(); - done(); - }); - }) + let lastContent = ''; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + lastContent : lastContent, + } - /* - * @tc.number SendEvent_categoryNotification_0070 - * @tc.name SendEvent_categoryNotification_0070 - * @tc.desc The categoryNotification of EventInfo is 'progress', test sendEvent() function - * The result of sendEvent() should be equal to a promise of undefined - * @tc.size SmallTest - * @tc.type User - */ - it('SendEvent_categoryNotification_0070', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_categoryNotification_0070 starts`); + let event = new accessibility.EventInfo(jsonObj); - let event = new accessibility.EventInfo(); - let categoryNotification = 'progress'; - event.type = eventType; - event.bundleName = bundleName; - event.triggerAction = triggerAction; - event.categoryNotification = categoryNotification; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_categoryNotification_0070 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_lastContent_constructor_0020 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_categoryNotification_0080 - * @tc.name SendEvent_categoryNotification_0080 - * @tc.desc The categoryNotification of EventInfo is 'social', test sendEvent() function + * @tc.number SendEvent_lastContent_0030 + * @tc.name SendEvent_lastContent_0030 + * @tc.desc The lastContent of EventInfo is null, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_categoryNotification_0080', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_categoryNotification_0080 starts`); + it('SendEvent_lastContent_0030', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_lastContent_0030 starts`); let event = new accessibility.EventInfo(); - let categoryNotification = 'social'; + let lastContent = null; event.type = eventType; event.bundleName = bundleName; + event.lastContent = lastContent; event.triggerAction = triggerAction; - event.categoryNotification = categoryNotification; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_categoryNotification_0080 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_lastContent_0030 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_categoryNotification_0090 - * @tc.name SendEvent_categoryNotification_0090 - * @tc.desc The categoryNotification of EventInfo is 'err', test sendEvent() function + * @tc.number SendEvent_lastContent_constructor_0030 + * @tc.name SendEvent_lastContent_constructor_0030 + * @tc.desc The lastContent of EventInfo is null, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. * @tc.size SmallTest * @tc.type User */ - it('SendEvent_categoryNotification_0090', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_categoryNotification_0090 starts`); + it('SendEvent_lastContent_constructor_0030', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_lastContent_constructor_0030 starts`); + + let lastContent = null; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + lastContent : lastContent, + } + + let event = new accessibility.EventInfo(jsonObj); - let event = new accessibility.EventInfo(); - let categoryNotification = 'err'; - event.type = eventType; - event.bundleName = bundleName; - event.triggerAction = triggerAction; - event.categoryNotification = categoryNotification; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_categoryNotification_0090 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_lastContent_constructor_0030 has error: ${err}`); expect(null).assertFail(); done(); }); }) + /* - * @tc.number SendEvent_categoryNotification_0100 - * @tc.name SendEvent_categoryNotification_0100 - * @tc.desc The categoryNotification of EventInfo is 'transport', test sendEvent() function + * @tc.number SendEvent_beginIndex_0010 + * @tc.name SendEvent_beginIndex_0010 + * @tc.desc The beginIndex of EventInfo is 1, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_categoryNotification_0100', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_categoryNotification_0100 starts`); + it('SendEvent_beginIndex_0010', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_beginIndex_0010 starts`); let event = new accessibility.EventInfo(); - let categoryNotification = 'transport'; + let beginIndex = 1; event.type = eventType; event.bundleName = bundleName; + event.beginIndex = beginIndex; event.triggerAction = triggerAction; - event.categoryNotification = categoryNotification; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_categoryNotification_0100 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_beginIndex_0010 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_categoryNotification_0110 - * @tc.name SendEvent_categoryNotification_0110 - * @tc.desc The categoryNotification of EventInfo is 'sys', test sendEvent() function + * @tc.number SendEvent_beginIndex_constructor_0010 + * @tc.name SendEvent_beginIndex_constructor_0010 + * @tc.desc The beginIndex of EventInfo is 1, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. * @tc.size SmallTest * @tc.type User */ - it('SendEvent_categoryNotification_0110', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_categoryNotification_0110 starts`); + it('SendEvent_beginIndex_constructor_0010', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_beginIndex_constructor_0010 starts`); + + let beginIndex = 1; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + beginIndex : beginIndex, + } + + let event = new accessibility.EventInfo(jsonObj); - let event = new accessibility.EventInfo(); - let categoryNotification = 'sys'; - event.type = eventType; - event.bundleName = bundleName; - event.triggerAction = triggerAction; - event.categoryNotification = categoryNotification; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_categoryNotification_0110 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_beginIndex_constructor_0010 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_categoryNotification_0120 - * @tc.name SendEvent_categoryNotification_0120 - * @tc.desc The categoryNotification of EventInfo is 'service', test sendEvent() function + * @tc.number SendEvent_beginIndex_0020 + * @tc.name SendEvent_beginIndex_0020 + * @tc.desc The beginIndex of EventInfo is 0, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_categoryNotification_0120', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_categoryNotification_0120 starts`); + it('SendEvent_beginIndex_0020', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_beginIndex_0020 starts`); let event = new accessibility.EventInfo(); - let categoryNotification = 'service'; + let beginIndex = 0; event.type = eventType; event.bundleName = bundleName; + event.beginIndex = beginIndex; event.triggerAction = triggerAction; - event.categoryNotification = categoryNotification; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_categoryNotification_0120 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_beginIndex_0020 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_categoryNotification_0130 - * @tc.name SendEvent_categoryNotification_0130 - * @tc.desc The categoryNotification of EventInfo is '', test sendEvent() function + * @tc.number SendEvent_beginIndex_constructor_0020 + * @tc.name SendEvent_beginIndex_constructor_0020 + * @tc.desc The beginIndex of EventInfo is 0, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. * @tc.size SmallTest * @tc.type User */ - it('SendEvent_categoryNotification_0130', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_categoryNotification_0130 starts`); + it('SendEvent_beginIndex_constructor_0020', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_beginIndex_constructor_0020 starts`); + + let beginIndex = 0; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + beginIndex : beginIndex, + } + + let event = new accessibility.EventInfo(jsonObj); - let event = new accessibility.EventInfo(); - let categoryNotification = ''; - event.type = eventType; - event.bundleName = bundleName; - event.triggerAction = triggerAction; - event.categoryNotification = categoryNotification; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_categoryNotification_0130 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_beginIndex_constructor_0020 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_categoryNotification_0140 - * @tc.name SendEvent_categoryNotification_0140 - * @tc.desc The categoryNotification of EventInfo is null, test sendEvent() function + * @tc.number SendEvent_beginIndex_0030 + * @tc.name SendEvent_beginIndex_0030 + * @tc.desc The beginIndex of EventInfo is -1, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_categoryNotification_0140', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_categoryNotification_0140 starts`); + it('SendEvent_beginIndex_0030', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_beginIndex_0030 starts`); let event = new accessibility.EventInfo(); - let categoryNotification = null; + let beginIndex = -1; event.type = eventType; event.bundleName = bundleName; + event.beginIndex = beginIndex; event.triggerAction = triggerAction; - event.categoryNotification = categoryNotification; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_categoryNotification_0140 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_beginIndex_0030 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_gestureType_0010 - * @tc.name SendEvent_gestureType_0010 - * @tc.desc The gestureType of EventInfo is 'left', test sendEvent() function + * @tc.number SendEvent_beginIndex_constructor_0030 + * @tc.name SendEvent_beginIndex_constructor_0030 + * @tc.desc The beginIndex of EventInfo is -1, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. * @tc.size SmallTest * @tc.type User */ - it('SendEvent_gestureType_0010', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_gestureType_0010 starts`); + it('SendEvent_beginIndex_constructor_0030', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_beginIndex_constructor_0030 starts`); + + let beginIndex = -1; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + beginIndex : beginIndex, + } + + let event = new accessibility.EventInfo(jsonObj); - let event = new accessibility.EventInfo(); - let gestureType = 'left'; - event.type = eventType; - event.bundleName = bundleName; - event.triggerAction = triggerAction; - event.gestureType = gestureType; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_gestureType_0010 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_beginIndex_constructor_0030 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_gestureType_0020 - * @tc.name SendEvent_gestureType_0020 - * @tc.desc The gestureType of EventInfo is 'leftThenRight', test sendEvent() function - * The result of sendEvent() should be equal to a promise of undefined - * @tc.size SmallTest - * @tc.type User - */ - it('SendEvent_gestureType_0020', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_gestureType_0020 starts`); + * @tc.number SendEvent_currentIndex_0010 + * @tc.name SendEvent_currentIndex_0010 + * @tc.desc The currentIndex of EventInfo is 1, test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_currentIndex_0010', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_currentIndex_0010 starts`); let event = new accessibility.EventInfo(); - let gestureType = 'leftThenRight'; + let currentIndex = 1; event.type = eventType; event.bundleName = bundleName; + event.currentIndex = currentIndex; event.triggerAction = triggerAction; - event.gestureType = gestureType; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_gestureType_0020 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_currentIndex_0010 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_gestureType_0030 - * @tc.name SendEvent_gestureType_0030 - * @tc.desc The gestureType of EventInfo is 'leftThenUp', test sendEvent() function - * The result of sendEvent() should be equal to a promise of undefined - * @tc.size SmallTest - * @tc.type User - */ - it('SendEvent_gestureType_0030', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_gestureType_0030 starts`); + * @tc.number SendEvent_currentIndex_constructor_0010 + * @tc.name SendEvent_currentIndex_constructor_0010 + * @tc.desc The currentIndex of EventInfo is 1, test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_currentIndex_constructor_0010', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_currentIndex_constructor_0010 starts`); + + let currentIndex = 1; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + currentIndex : currentIndex, + } + + let event = new accessibility.EventInfo(jsonObj); - let event = new accessibility.EventInfo(); - let gestureType = 'leftThenUp'; - event.type = eventType; - event.bundleName = bundleName; - event.triggerAction = triggerAction; - event.gestureType = gestureType; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_gestureType_0030 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_currentIndex_constructor_0010 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_gestureType_0040 - * @tc.name SendEvent_gestureType_0040 - * @tc.desc The gestureType of EventInfo is 'leftThenDown', test sendEvent() function + * @tc.number SendEvent_currentIndex_0020 + * @tc.name SendEvent_currentIndex_0020 + * @tc.desc The currentIndex of EventInfo is 0, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_gestureType_0040', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_gestureType_0040 starts`); + it('SendEvent_currentIndex_0020', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_currentIndex_0020 starts`); let event = new accessibility.EventInfo(); - let gestureType = 'leftThenDown'; + let currentIndex = 0; event.type = eventType; event.bundleName = bundleName; + event.currentIndex = currentIndex; event.triggerAction = triggerAction; - event.gestureType = gestureType; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_gestureType_0040 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_currentIndex_0020 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_gestureType_0050 - * @tc.name SendEvent_gestureType_0050 - * @tc.desc The gestureType of EventInfo is 'right', test sendEvent() function + * @tc.number SendEvent_currentIndex_constructor_0020 + * @tc.name SendEvent_currentIndex_constructor_0020 + * @tc.desc The currentIndex of EventInfo is 0, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_gestureType_0050', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_gestureType_0050 starts`); + it('SendEvent_currentIndex_constructor_0020', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_currentIndex_constructor_0020 starts`); + + let currentIndex = 0; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + currentIndex : currentIndex, + } + + let event = new accessibility.EventInfo(jsonObj); - let event = new accessibility.EventInfo(); - let gestureType = 'right'; - event.type = eventType; - event.bundleName = bundleName; - event.triggerAction = triggerAction; - event.gestureType = gestureType; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_gestureType_0050 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_currentIndex_constructor_0020 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_gestureType_0060 - * @tc.name SendEvent_gestureType_0060 - * @tc.desc The gestureType of EventInfo is 'rightThenLeft', test sendEvent() function + * @tc.number SendEvent_currentIndex_0030 + * @tc.name SendEvent_currentIndex_0030 + * @tc.desc The currentIndex of EventInfo is -1, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_gestureType_0060', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_gestureType_0060 starts`); + it('SendEvent_currentIndex_0030', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_currentIndex_0030 starts`); let event = new accessibility.EventInfo(); - let gestureType = 'rightThenLeft'; + let currentIndex = -1; event.type = eventType; event.bundleName = bundleName; + event.currentIndex = currentIndex; event.triggerAction = triggerAction; - event.gestureType = gestureType; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_gestureType_0060 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_currentIndex_0030 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_gestureType_0070 - * @tc.name SendEvent_gestureType_0070 - * @tc.desc The gestureType of EventInfo is 'rightThenUp', test sendEvent() function + * @tc.number SendEvent_currentIndex_constructor_0030 + * @tc.name SendEvent_currentIndex_constructor_0030 + * @tc.desc The currentIndex of EventInfo is -1, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. * @tc.size SmallTest * @tc.type User */ - it('SendEvent_gestureType_0070', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_gestureType_0070 starts`); + it('SendEvent_currentIndex_constructor_0030', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_currentIndex_constructor_0030 starts`); + + let currentIndex = -1; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + currentIndex : currentIndex, + } + + let event = new accessibility.EventInfo(jsonObj); - let event = new accessibility.EventInfo(); - let gestureType = 'rightThenUp'; - event.type = eventType; - event.bundleName = bundleName; - event.triggerAction = triggerAction; - event.gestureType = gestureType; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_gestureType_0070 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_currentIndex_constructor_0030 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_gestureType_0080 - * @tc.name SendEvent_gestureType_0080 - * @tc.desc The gestureType of EventInfo is 'rightThenDown', test sendEvent() function - * The result of sendEvent() should be equal to a promise of undefined - * @tc.size SmallTest - * @tc.type User - */ - it('SendEvent_gestureType_0080', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_gestureType_0080 starts`); + * @tc.number SendEvent_endIndex_0010 + * @tc.name SendEvent_endIndex_0010 + * @tc.desc The endIndex of EventInfo is 1, test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_endIndex_0010', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_endIndex_0010 starts`); let event = new accessibility.EventInfo(); - let gestureType = 'rightThenDown'; + let endIndex = 1; event.type = eventType; event.bundleName = bundleName; + event.endIndex = endIndex; event.triggerAction = triggerAction; - event.gestureType = gestureType; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_gestureType_0080 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_endIndex_0010 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_gestureType_0090 - * @tc.name SendEvent_gestureType_0090 - * @tc.desc The gestureType of EventInfo is 'up', test sendEvent() function - * The result of sendEvent() should be equal to a promise of undefined - * @tc.size SmallTest - * @tc.type User - */ - it('SendEvent_gestureType_0090', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_gestureType_0090 starts`); + * @tc.number SendEvent_endIndex_constructor_0010 + * @tc.name SendEvent_endIndex_constructor_0010 + * @tc.desc The endIndex of EventInfo is 1, test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_endIndex_constructor_0010', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_endIndex_constructor_0010 starts`); + + let endIndex = 1; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + endIndex : endIndex, + } + + let event = new accessibility.EventInfo(jsonObj); - let event = new accessibility.EventInfo(); - let gestureType = 'up'; - event.type = eventType; - event.bundleName = bundleName; - event.triggerAction = triggerAction; - event.gestureType = gestureType; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_gestureType_0090 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_endIndex_constructor_0010 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_gestureType_0100 - * @tc.name SendEvent_gestureType_0100 - * @tc.desc The gestureType of EventInfo is 'upThenLeft', test sendEvent() function + * @tc.number SendEvent_endIndex_0020 + * @tc.name SendEvent_endIndex_0020 + * @tc.desc The endIndex of EventInfo is 0, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_gestureType_0100', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_gestureType_0100 starts`); + it('SendEvent_endIndex_0020', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_endIndex_0020 starts`); let event = new accessibility.EventInfo(); - let gestureType = 'upThenLeft'; + let endIndex = 0; event.type = eventType; event.bundleName = bundleName; + event.endIndex = endIndex; event.triggerAction = triggerAction; - event.gestureType = gestureType; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_gestureType_0100 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_endIndex_0020 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_gestureType_0110 - * @tc.name SendEvent_gestureType_0110 - * @tc.desc The gestureType of EventInfo is 'upThenRight', test sendEvent() function + * @tc.number SendEvent_endIndex_constructor_0020 + * @tc.name SendEvent_endIndex_constructor_0020 + * @tc.desc The endIndex of EventInfo is 0, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. * @tc.size SmallTest * @tc.type User */ - it('SendEvent_gestureType_0110', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_gestureType_0110 starts`); + it('SendEvent_endIndex_constructor_0020', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_endIndex_constructor_0020 starts`); + + let endIndex = 0; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + endIndex : endIndex, + } + + let event = new accessibility.EventInfo(jsonObj); - let event = new accessibility.EventInfo(); - let gestureType = 'upThenRight'; - event.type = eventType; - event.bundleName = bundleName; - event.triggerAction = triggerAction; - event.gestureType = gestureType; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_gestureType_0110 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_endIndex_constructor_0020 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_gestureType_0120 - * @tc.name SendEvent_gestureType_0120 - * @tc.desc The gestureType of EventInfo is 'upThenDown', test sendEvent() function + * @tc.number SendEvent_endIndex_0030 + * @tc.name SendEvent_endIndex_0030 + * @tc.desc The endIndex of EventInfo is -1, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_gestureType_0120', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_gestureType_0120 starts`); + it('SendEvent_endIndex_0030', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_endIndex_0030 starts`); let event = new accessibility.EventInfo(); - let gestureType = 'upThenDown'; + let endIndex = -1; event.type = eventType; event.bundleName = bundleName; + event.endIndex = endIndex; event.triggerAction = triggerAction; - event.gestureType = gestureType; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_gestureType_0120 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_endIndex_0030 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_gestureType_0130 - * @tc.name SendEvent_gestureType_0130 - * @tc.desc The gestureType of EventInfo is 'down', test sendEvent() function + * @tc.number SendEvent_endIndex_constructor_0030 + * @tc.name SendEvent_endIndex_constructor_0030 + * @tc.desc The endIndex of EventInfo is -1, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. * @tc.size SmallTest * @tc.type User */ - it('SendEvent_gestureType_0130', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_gestureType_0130 starts`); + it('SendEvent_endIndex_constructor_0030', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_endIndex_constructor_0030 starts`); + + let endIndex = -1; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + endIndex : endIndex, + } + + let event = new accessibility.EventInfo(jsonObj); - let event = new accessibility.EventInfo(); - let gestureType = 'down'; - event.type = eventType; - event.bundleName = bundleName; - event.triggerAction = triggerAction; - event.gestureType = gestureType; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_gestureType_0130 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_endIndex_constructor_0030 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_gestureType_0140 - * @tc.name SendEvent_gestureType_0140 - * @tc.desc The gestureType of EventInfo is 'downThenLeft', test sendEvent() function - * The result of sendEvent() should be equal to a promise of undefined - * @tc.size SmallTest - * @tc.type User - */ - it('SendEvent_gestureType_0140', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_gestureType_0140 starts`); + * @tc.number SendEvent_itemCount_0010 + * @tc.name SendEvent_itemCount_0010 + * @tc.desc The itemCount of EventInfo is 1, test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_itemCount_0010', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_itemCount_0010 starts`); let event = new accessibility.EventInfo(); - let gestureType = 'downThenLeft'; + let itemCount = 1; event.type = eventType; event.bundleName = bundleName; + event.itemCount = itemCount; event.triggerAction = triggerAction; - event.gestureType = gestureType; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_gestureType_0140 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_itemCount_0010 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_gestureType_0150 - * @tc.name SendEvent_gestureType_0150 - * @tc.desc The gestureType of EventInfo is 'downThenRight', test sendEvent() function - * The result of sendEvent() should be equal to a promise of undefined - * @tc.size SmallTest - * @tc.type User - */ - it('SendEvent_gestureType_0150', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_gestureType_0150 starts`); + * @tc.number SendEvent_itemCount_constructor_0010 + * @tc.name SendEvent_itemCount_constructor_0010 + * @tc.desc The itemCount of EventInfo is 1, test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_itemCount_constructor_0010', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_itemCount_constructor_0010 starts`); + + let itemCount = 1; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + itemCount : itemCount, + } + + let event = new accessibility.EventInfo(jsonObj); - let event = new accessibility.EventInfo(); - let gestureType = 'downThenRight'; - event.type = eventType; - event.bundleName = bundleName; - event.triggerAction = triggerAction; - event.gestureType = gestureType; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_gestureType_0150 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_itemCount_constructor_0010 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_gestureType_0160 - * @tc.name SendEvent_gestureType_0160 - * @tc.desc The gestureType of EventInfo is 'downThenUp', test sendEvent() function + * @tc.number SendEvent_itemCount_0020 + * @tc.name SendEvent_itemCount_0020 + * @tc.desc The itemCount of EventInfo is 0, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_gestureType_0160', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_gestureType_0160 starts`); + it('SendEvent_itemCount_0020', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_itemCount_0020 starts`); let event = new accessibility.EventInfo(); - let gestureType = 'downThenUp'; + let itemCount = 0; event.type = eventType; event.bundleName = bundleName; + event.itemCount = itemCount; event.triggerAction = triggerAction; - event.gestureType = gestureType; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_gestureType_0160 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_itemCount_0020 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_gestureType_0170 - * @tc.name SendEvent_gestureType_0170 - * @tc.desc The gestureType of EventInfo is '', test sendEvent() function + * @tc.number SendEvent_itemCount_constructor_0020 + * @tc.name SendEvent_itemCount_constructor_0020 + * @tc.desc The itemCount of EventInfo is 0, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. * @tc.size SmallTest * @tc.type User */ - it('SendEvent_gestureType_0170', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_gestureType_0170 starts`); + it('SendEvent_itemCount_constructor_0020', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_itemCount_constructor_0020 starts`); + + let itemCount = 0; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + itemCount : itemCount, + } + + let event = new accessibility.EventInfo(jsonObj); - let event = new accessibility.EventInfo(); - let gestureType = ''; - event.type = eventType; - event.bundleName = bundleName; - event.triggerAction = triggerAction; - event.gestureType = gestureType; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_gestureType_0170 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_itemCount_constructor_0020 has error: ${err}`); expect(null).assertFail(); done(); }); }) /* - * @tc.number SendEvent_gestureType_0180 - * @tc.name SendEvent_gestureType_0180 - * @tc.desc The gestureType of EventInfo is null, test sendEvent() function + * @tc.number SendEvent_itemCount_0030 + * @tc.name SendEvent_itemCount_0030 + * @tc.desc The itemCount of EventInfo is -1, test sendEvent() function * The result of sendEvent() should be equal to a promise of undefined * @tc.size SmallTest * @tc.type User */ - it('SendEvent_gestureType_0180', 0, async function (done) { - console.info(`AccessibleSendEvent: SendEvent_gestureType_0180 starts`); + it('SendEvent_itemCount_0030', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_itemCount_0030 starts`); let event = new accessibility.EventInfo(); - let gestureType = null; + let itemCount = -1; event.type = eventType; event.bundleName = bundleName; + event.itemCount = itemCount; event.triggerAction = triggerAction; - event.gestureType = gestureType; accessibility.sendEvent(event).then((result) => { expect(result).assertEqual(undefined); done(); }).catch(err => { - console.error(`AccessibleSendEvent: SendEvent_gestureType_0180 has error: ${err}`); + console.error(`AccessibleSendEvent: SendEvent_itemCount_0030 has error: ${err}`); expect(null).assertFail(); done(); }); }) - - + /* + * @tc.number SendEvent_itemCount_constructor_0030 + * @tc.name SendEvent_itemCount_constructor_0030 + * @tc.desc The itemCount of EventInfo is -1, test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_itemCount_constructor_0030', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_itemCount_constructor_0030 starts`); + + let itemCount = -1; + let jsonObj = { + type : eventType, + bundleName : bundleName, + triggerAction : triggerAction, + itemCount : itemCount, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_itemCount_constructor_0030 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) }) - } diff --git a/barrierfree/targetProject/aceTest/AppScope/app.json b/barrierfree/targetProject/aceTest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..6ccd6d235ea2014842e1ba6cbc330113a7283628 --- /dev/null +++ b/barrierfree/targetProject/aceTest/AppScope/app.json @@ -0,0 +1,15 @@ +{ + "app": { + "bundleName": "com.example.acetest", + "vendor": "huawei", + "versionCode": 1000000, + "versionName": "1.0.0", + "debug": false, + "icon": "$media:icon", + "label": "$string:app_name", + "description": "$string:description_application", + "distributedNotificationEnabled": true, + "minAPIVersion": 9, + "targetAPIVersion": 9 + } +} \ No newline at end of file diff --git a/barrierfree/targetProject/aceTest/AppScope/resources/base/element/string.json b/barrierfree/targetProject/aceTest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..559d9048af84bc4ebb7b7038a291981f5e466e78 --- /dev/null +++ b/barrierfree/targetProject/aceTest/AppScope/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AceTest" + }, + { + "name": "mainability_description", + "value": "ETS_Phone_Empty Stage Ability" + } + ] +} \ No newline at end of file diff --git a/barrierfree/targetProject/aceTest/AppScope/resources/base/media/icon.png b/barrierfree/targetProject/aceTest/AppScope/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/targetProject/aceTest/AppScope/resources/base/media/icon.png differ diff --git a/barrierfree/targetProject/aceTest/BUILD.gn b/barrierfree/targetProject/aceTest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..697577d452846f092d7c809412fdebad9486d5a3 --- /dev/null +++ b/barrierfree/targetProject/aceTest/BUILD.gn @@ -0,0 +1,41 @@ +# 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("aceTest") { + hap_profile = "entry/src/main/module.json" + hap_name = "aceTest" + testonly = true + deps = [ + ":acetest_js_assets", + ":acetest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" +} + +ohos_app_scope("acetest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("acetest_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("acetest_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":acetest_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/barrierfree/targetProject/aceTest/Test.json b/barrierfree/targetProject/aceTest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..d9fdcb92f81eac53bf51c78a428be0210c192b89 --- /dev/null +++ b/barrierfree/targetProject/aceTest/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} \ No newline at end of file diff --git a/barrierfree/targetProject/aceTest/entry/src/main/ets/Application/AbilityStage.ts b/barrierfree/targetProject/aceTest/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..32dfe93ccff0375201857794de902cec4d239442 --- /dev/null +++ b/barrierfree/targetProject/aceTest/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,7 @@ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/barrierfree/targetProject/aceTest/entry/src/main/ets/MainAbility/MainAbility.ts b/barrierfree/targetProject/aceTest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..dad945382c6700e13a7f6dc6f83788cc1868d1ec --- /dev/null +++ b/barrierfree/targetProject/aceTest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,34 @@ +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index/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") + } +}; diff --git a/barrierfree/targetProject/aceTest/entry/src/main/ets/pages/index/index.ets b/barrierfree/targetProject/aceTest/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..fd1b9a882cd2cb9a5424a63e55b557b9fd177391 --- /dev/null +++ b/barrierfree/targetProject/aceTest/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,103 @@ +/* + * 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 config from '@ohos.accessibility.config' +import commonEvent from '@ohos.commonEvent'; + +@Entry +@Component +struct Index { + @State message: string = 'Target App'; + private isEnable: boolean = false; + private subScriber = undefined; + + onPageShow() { + console.info(`TargetApp onPageShow start`); + config.enableAbility( + 'com.example.myapplication/AccessibilityExtAbility', + ["retrieve", "touchGuide", "gesture"] + ).then(() => { + console.info('TargetApp enableAbility finish'); + this.isEnable = true; + }); + } + + aboutToAppear() { + console.info('TargetApp aboutToAppear'); + commonEvent.createSubscriber({ events: ['disableExtAbility' ]}).then((subScriber) => { + this.subScriber = subScriber; + commonEvent.subscribe(this.subScriber, (err, data) => { + console.info('TargetApp disableExtAbility subscribe callback: ' + JSON.stringify(data)); + if (data && data.data == 'disable') { + this.disableAccAbility(); + } + }); + }); + } + + aboutToDisappear() { + console.info('TargetApp aboutToDisappear'); + commonEvent.unsubscribe(this.subScriber); + this.subScriber = undefined; + this.disableAccAbility(); + } + + disableAccAbility() { + if (!this.isEnable) { + console.info(`TargetApp disableAccAbility: accessibilityConfig not enabled`); + return; + } + + config.disableAbility("com.example.myapplication/AccessibilityExtAbility").then(() => { + console.info(`TargetApp disableAccAbility finish`); + this.isEnable = false; + }); + } + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + .margin({bottom: 10}) + + Row() { + Button('left') + Button('button1') + .margin({ + left: 10, + right: 10 + }) + Button('right') + } + .margin({bottom: 10}) + + Button('button2') + .margin({bottom: 10}) + + Button('button3') + .margin({bottom: 10}) + + Button('disableAbility') + .onClick(() => { + console.info('TargetApp onClick'); + this.disableAccAbility(); + }) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/barrierfree/targetProject/aceTest/entry/src/main/module.json b/barrierfree/targetProject/aceTest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..72cade6b548cf275703c58d2ab613ef5e16d95da --- /dev/null +++ b/barrierfree/targetProject/aceTest/entry/src/main/module.json @@ -0,0 +1,33 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [{ + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "visible": true, + "orientation": "portrait", + "skills": [{ + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + }] + }] + } +} \ No newline at end of file diff --git a/barrierfree/targetProject/aceTest/entry/src/main/resources/base/element/string.json b/barrierfree/targetProject/aceTest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..55f553ad5a2ad2352918f898e8984c3872db2939 --- /dev/null +++ b/barrierfree/targetProject/aceTest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "phone_entry_dsc", + "value": "i am an entry for phone" + }, + { + "name": "phone_entry_main", + "value": "the phone entry ability" + }, + { + "name": "entry_label", + "value": "AceTest" + }, + { + "name": "description_application", + "value": "target app for test" + }, + { + "name": "app_name", + "value": "AceTest" + } + ] +} diff --git a/barrierfree/targetProject/aceTest/entry/src/main/resources/base/media/icon.png b/barrierfree/targetProject/aceTest/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/targetProject/aceTest/entry/src/main/resources/base/media/icon.png differ diff --git a/barrierfree/targetProject/aceTest/entry/src/main/resources/base/profile/main_pages.json b/barrierfree/targetProject/aceTest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..821ecf2358ec52ffa8b0812267be3793be71896a --- /dev/null +++ b/barrierfree/targetProject/aceTest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index/index" + ] +} \ No newline at end of file diff --git a/barrierfree/targetProject/aceTest/signature/openharmony_sx.p7b b/barrierfree/targetProject/aceTest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..7ffcdc78527c5c1aa24520ab7e913c5f47c703f0 Binary files /dev/null and b/barrierfree/targetProject/aceTest/signature/openharmony_sx.p7b differ