diff --git a/barrierfree/BUILD.gn b/barrierfree/BUILD.gn index 03013055d7eaec776aad547cc961272ea1578ffd..b40a83952a502df10353dadbc1e9960f400d0dd8 100644 --- a/barrierfree/BUILD.gn +++ b/barrierfree/BUILD.gn @@ -28,6 +28,7 @@ group("barrierfree") { "accessiblecheckability:ActsAccessibleCheckAbilityTest", "accessibleregisterstate:ActsAccessibleRegisterStateTest", "accessiblesendevent:ActsAccessibleSendEventTest", + "accessibletest:actsaccessibletest", "targetProject/aceTest:aceTest", ] } diff --git a/barrierfree/accessibletest/BUILD.gn b/barrierfree/accessibletest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..be7ee7057d01452ea42e0c11420db27df3e4e5be --- /dev/null +++ b/barrierfree/accessibletest/BUILD.gn @@ -0,0 +1,34 @@ +# Copyright (C) 2021 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("//build/ohos_var.gni") + +group("actsaccessibletest") { + testonly = true + if (is_standard_system) { + deps = [ + "actsabilitylisttest:ActsAbilityListTest", + "actscaptionconfigurationtest:ActsCaptionConfigurationTest", + + "sceneProject/accessibilityAudibleAbility:accessibilityAudibleAbility", + + "sceneProject/accessibilityGenericAbility:accessibilityGenericAbility", + + "sceneProject/accessibilityHapticAbility:accessibilityHapticAbility", + + "sceneProject/accessibilitySpokenAbility:accessibilitySpokenAbility", + + "sceneProject/accessibilityVisualAbility:accessibilityVisualAbility", + ] + } +} diff --git a/barrierfree/accessibletest/actsabilitylisttest/AppScope/app.json b/barrierfree/accessibletest/actsabilitylisttest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..e7e8606d8f5ee69b2cb72f71f1089957136af670 --- /dev/null +++ b/barrierfree/accessibletest/actsabilitylisttest/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.abilitylisttest", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive": true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/barrierfree/accessibletest/actsabilitylisttest/AppScope/resources/base/element/string.json b/barrierfree/accessibletest/actsabilitylisttest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..b9d556bebf5f976578683fc750102cc13e853127 --- /dev/null +++ b/barrierfree/accessibletest/actsabilitylisttest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AbilityListTest" + } + ] +} diff --git a/barrierfree/accessibletest/actsabilitylisttest/AppScope/resources/base/media/app_icon.png b/barrierfree/accessibletest/actsabilitylisttest/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibletest/actsabilitylisttest/AppScope/resources/base/media/app_icon.png differ diff --git a/barrierfree/accessibletest/actsabilitylisttest/BUILD.gn b/barrierfree/accessibletest/actsabilitylisttest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..50796edf680f4a68e4bd873f35f869b53d5c6b78 --- /dev/null +++ b/barrierfree/accessibletest/actsabilitylisttest/BUILD.gn @@ -0,0 +1,43 @@ +# 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("ActsAbilityListTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":accessible_js_assets", + ":accessible_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsAbilityListTest" + subsystem_name = "barrierfree" + part_name = "accessibility" +} + +ohos_app_scope("accessible_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("accessible_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("accessible_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":accessible_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/barrierfree/accessibletest/actsabilitylisttest/Test.json b/barrierfree/accessibletest/actsabilitylisttest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..e2657e4c96e6ef2b7be916c421d3d7afd3710089 --- /dev/null +++ b/barrierfree/accessibletest/actsabilitylisttest/Test.json @@ -0,0 +1,36 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "280000", + "bundle-name": "com.example.abilitylisttest", + "module-name": "phone", + "shell-timeout": "600000", + "testcase-timeout": 70000 + }, + "kits": [ + { + "test-file-name": [ + "ActsAbilityListTest.hap", + "accessibilityAudibleAbility.hap", + "accessibilityGenericAbility.hap", + "accessibilityHapticAbility.hap", + "accessibilitySpokenAbility.hap", + "accessibilityVisualAbility.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "teardown-command":[ + "bm uninstall -n com.example.abilitylisttest", + "bm uninstall -n com.example.accessibleaudibleability.hmservice", + "bm uninstall -n com.example.accessiblegenericability.hmservice", + "bm uninstall -n com.example.accessiblehapticability.hmservice", + "bm uninstall -n com.example.accessiblespokenability.hmservice", + "bm uninstall -n com.example.accessiblevisualability.hmservice" + ] + } + ] +} diff --git a/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/Application/AbilityStage.ts b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..4972d0cb74d9e97563c81264a0c2cb9d290d353e --- /dev/null +++ b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[AbilityListTest] MyAbilityStage onCreate") + globalThis.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} \ No newline at end of file diff --git a/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/MainAbility/MainAbility.ts b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..b17fcff203e5c2c5f770dee0fcfa21a77e15eb14 --- /dev/null +++ b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "MainAbility/pages/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; diff --git a/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/MainAbility/pages/index.ets b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..2c7c2522fcd119c87bf7e6c2831297c6d0e59548 --- /dev/null +++ b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,121 @@ +/* + * 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 config from '@ohos.accessibility.config' +import accessibility from '@ohos.accessibility' +import prompt from '@ohos.prompt' + +const AUDIBLE_BUNDLE_NAME = 'com.example.accessibleaudibleability.hmservice/ServiceExtAbility' +const GENERIC_BUNDLE_NAME = 'com.example.accessiblegenericability.hmservice/ServiceExtAbility' +const HAPTIC_BUNDLE_NAME = 'com.example.accessiblehapticability.hmservice/ServiceExtAbility' +const SPOKEN_BUNDLE_NAME = 'com.example.accessiblespokenability.hmservice/ServiceExtAbility' +const VISUAL_BUNDLE_NAME = 'com.example.accessiblevisualability.hmservice/ServiceExtAbility' +const LOG_PREFIX = '[CQH-ABILITY-LIST-TEST-MANUAL]' + +@Entry +@Component +struct Index { + @State message: string = 'AbilityListTest' + @State abilityListsCallBack: string = '' + @State abilityListsPromise: string = '' + + aboutToAppear() { + console.info("start run aboutToAppear") + } + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button('AbilityList_0170-0180启动辅助应用') + .fontSize(25) + .fontWeight(FontWeight.Bold) + .margin(5) + .onClick((e) => { + this.enableAbility(LOG_PREFIX, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + }) + Button('AbilityList_0170-0180关闭辅助应用') + .fontSize(25) + .fontWeight(FontWeight.Bold) + .margin(5) + .onClick((e) => { + this.disableAbility(LOG_PREFIX, [AUDIBLE_BUNDLE_NAME]) + }) + Button('AbilityList_0170(callback)查询辅助应用') + .fontSize(25) + .fontWeight(FontWeight.Bold) + .margin(5) + .onClick((e) => { + accessibility.getAbilityLists('all', 'enable', (err, data) => { + if (err.code != 0) { + console.error(LOG_PREFIX + 'failed to getAbilityLists because ' + JSON.stringify(err)) + return + } + console.error(LOG_PREFIX + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.error(LOG_PREFIX + 'data.length : ' + JSON.stringify(data.length)) + this.abilityListsCallBack = JSON.stringify(data) + }) + }) + Text(this.abilityListsCallBack) + .fontSize(25) + Button('AbilityList_0180(promise)查询辅助应用') + .fontSize(25) + .fontWeight(FontWeight.Bold) + .margin(5) + .onClick((e) => { + accessibility.getAbilityLists('all', 'enable').then((data) => { + console.error(LOG_PREFIX + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.error(LOG_PREFIX + 'data.length : ' + JSON.stringify(data.length)) + this.abilityListsPromise = JSON.stringify(data) + }).catch((err) => { + console.error(LOG_PREFIX + 'failed to getAbilityLists because ' + JSON.stringify(err)) + }) + }) + Text(this.abilityListsPromise) + .fontSize(25) + } + .width('100%') + } + .height('100%') + } + + enableAbility(logTag, bundleNameArr) { + for (let bundleName of bundleNameArr) { + config.enableAbility(bundleName, ['retrieve']).then((data) => { + console.error(logTag + 'enableAbility ' + bundleName + ' success. data: ' + JSON.stringify(data)) + prompt.showToast({ message: '启动应用成功'}) + }).catch((error) => { + console.error(logTag + 'enableAbility ' + bundleName + ' failed. Cause: ' + JSON.stringify(error)) + prompt.showToast({ message: '启动应用异常'}) + return + }) + } + } + + disableAbility(logTag, bundleNameArr) { + for (let bundleName of bundleNameArr) { + config.disableAbility(bundleName).then((data) => { + console.error(logTag + 'disableAbility ' + bundleName + ' success. data: ' + JSON.stringify(data)) + prompt.showToast({ message: '关闭应用成功'}) + }).catch((error) => { + console.error(logTag + 'disableAbility ' + bundleName + ' failed. Cause: ' + JSON.stringify(error)) + prompt.showToast({ message: '关闭应用异常'}) + return + }) + } + } +} diff --git a/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/TestAbility/TestAbility.ts b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/TestAbility/TestAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..301aaf6099dd794d856d2ab13bf3ef6f13e3ba78 --- /dev/null +++ b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/TestAbility/TestAbility.ts @@ -0,0 +1,45 @@ +import Ability from '@ohos.application.Ability' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default class TestAbility extends Ability { + onCreate(want, launchParam) { + console.log('TestAbility onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log('TestAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('TestAbility onWindowStageCreate') + windowStage.loadContent("TestAbility/pages/index", (err, data) => { + if (err.code) { + console.error('Failed to load the content. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data)) + }); + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('TestAbility onWindowStageDestroy') + } + + onForeground() { + console.log('TestAbility onForeground') + } + + onBackground() { + console.log('TestAbility onBackground') + } +}; \ No newline at end of file diff --git a/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/TestAbility/pages/index.ets b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..733600abc03d7e777ef1a55eaddd77f4d1d7d66d --- /dev/null +++ b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,34 @@ +import router from '@ohos.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('TestAbility index aboutToAppear') + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..b7a05f076a1146a1ffcc7ecfcb4f9a024d1436a5 --- /dev/null +++ b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,64 @@ +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout', + '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a com.example.abilitylisttest.MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + if (debug == 'true') + { + cmd += ' -D' + } + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/test/Ability.test.ets b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..4f29b3064d6786e91371cd0939bcd2521d04657b --- /dev/null +++ b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,625 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import config from '@ohos.accessibility.config' +import accessibility from '@ohos.accessibility' +import prompt from '@ohos.prompt' + +const AUDIBLE_BUNDLE_NAME = 'com.example.accessibleaudibleability.hmservice/ServiceExtAbility' +const GENERIC_BUNDLE_NAME = 'com.example.accessiblegenericability.hmservice/ServiceExtAbility' +const HAPTIC_BUNDLE_NAME = 'com.example.accessiblehapticability.hmservice/ServiceExtAbility' +const SPOKEN_BUNDLE_NAME = 'com.example.accessiblespokenability.hmservice/ServiceExtAbility' +const VISUAL_BUNDLE_NAME = 'com.example.accessiblevisualability.hmservice/ServiceExtAbility' +const LOG_PREFIX = '[CQH-ABILITY-LIST-TEST]' +const TIME_OUT = 3000 +const TIME_OUT_S = 1000 + +export default function abilityTest() { + describe('ActsAbilityListTest', function () { + afterEach(async function (done) { + disableAll(LOG_PREFIX + ' disableAll ') + setTimeout(() => { + done() + }, TIME_OUT) + }) + afterAll(async function (done) { + prompt.showToast({ + message: 'CASE All End' + }) + disableAll(LOG_PREFIX + ' disableAll ') + done() + }) + /** + * @tc.number: AbilityList_0010 + * @tc.name: getAbilityLists callback API. + * @tc.desc: getAbilityLists callback API abilityType is spoken, stateType is install. + */ + it('AbilityList_0010', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0010 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('spoken', 'install', (err, data) => { + if (err.code != 0) { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + return + } + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0020 + * @tc.name: getAbilityLists promise API. + * @tc.desc: getAbilityLists promise API abilityType is spoken, stateType is install. + */ + it('AbilityList_0020', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0020 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('spoken', 'install').then((data) => { + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }).catch((err) => { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0030 + * @tc.name: getAbilityLists callback API. + * @tc.desc: getAbilityLists callback API abilityType is audible, stateType is install. + */ + it('AbilityList_0030', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0030 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('audible', 'install', (err, data) => { + if (err.code != 0) { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + return + } + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0040 + * @tc.name: getAbilityLists promise API. + * @tc.desc: getAbilityLists promise API abilityType is audible, stateType is install. + */ + it('AbilityList_0040', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0040 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('audible', 'install').then((data) => { + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }).catch((err) => { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0050 + * @tc.name: getAbilityLists callback API. + * @tc.desc: getAbilityLists callback API abilityType is visual, stateType is install. + */ + it('AbilityList_0050', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0050 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('visual', 'install', (err, data) => { + if (err.code != 0) { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + return + } + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0060 + * @tc.name: getAbilityLists promise API. + * @tc.desc: getAbilityLists promise API abilityType is visual, stateType is install. + */ + it('AbilityList_0060', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0060 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('visual', 'install').then((data) => { + console.info(LOG_PREFIX + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }).catch((err) => { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0070 + * @tc.name: getAbilityLists callback API. + * @tc.desc: getAbilityLists callback API abilityType is haptic, stateType is install. + */ + it('AbilityList_0070', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0070 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('haptic', 'install', (err, data) => { + if (err.code != 0) { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + return + } + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0080 + * @tc.name: getAbilityLists promise API. + * @tc.desc: getAbilityLists promise API abilityType is haptic, stateType is install. + */ + it('AbilityList_0080', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0080 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('haptic', 'install').then((data) => { + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }).catch((err) => { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0090 + * @tc.name: getAbilityLists callback API. + * @tc.desc: getAbilityLists callback API abilityType is generic, stateType is install. + */ + it('AbilityList_0090', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0090 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('generic', 'install', (err, data) => { + if (err.code != 0) { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + return + } + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0100 + * @tc.name: getAbilityLists promise API. + * @tc.desc: getAbilityLists promise API abilityType is generic, stateType is install. + */ + it('AbilityList_0100', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0100 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('generic', 'install').then((data) => { + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }).catch((err) => { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0110 + * @tc.name: getAbilityLists callback API. + * @tc.desc: getAbilityLists callback API abilityType is all, stateType is enable. + */ + it('AbilityList_0110', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0110 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('all', 'enable', (err, data) => { + if (err.code != 0) { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + return + } + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0111 + * @tc.name: getAbilityLists callback API. + * @tc.desc: getAbilityLists callback API abilityType is all, stateType is enable, get eventTypes. + */ + it('AbilityList_0111', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0111 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('all', 'enable', (err, data) => { + if (err.code != 0) { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + return + } + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + let eventTypes = [] + if (data.length > 0) { + eventTypes = data[0].eventTypes + } + expect(eventTypes.length).assertLarger(0) + done() + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0112 + * @tc.name: getAbilityLists callback API. + * @tc.desc: getAbilityLists callback API abilityType is all, stateType is enable, get targetBundleNames. + */ + it('AbilityList_0112', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0112 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('all', 'enable', (err, data) => { + if (err.code != 0) { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + return + } + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + let targetBundleNames = [] + if (data.length > 0) { + targetBundleNames = data[0].targetBundleNames + } + expect(targetBundleNames.length).assertLarger(0) + done() + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0113 + * @tc.name: getAbilityLists callback API. + * @tc.desc: getAbilityLists callback API abilityType is all, stateType is enable, get other attribute. + */ + it('AbilityList_0113', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0113 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('all', 'enable', (err, data) => { + if (err.code != 0) { + console.error(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + return + } + console.error(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + let id = '' + let name = '' + let bundleName = '' + let abilityTypes = [] + let capabilities = [] + let description = '' + if (data.length > 0) { + id = data[0].id + name = data[0].name + bundleName = data[0].bundleName + abilityTypes = data[0].abilityTypes + capabilities = data[0].capabilities + description = data[0].description + } + expect(id.length).assertLarger(0) + expect(name.length).assertLarger(0) + expect(bundleName.length).assertLarger(0) + expect(abilityTypes.length).assertLarger(0) + expect(capabilities.length).assertLarger(0) + expect(description.length).assertLarger(0) + done() + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0120 + * @tc.name: getAbilityLists promise API. + * @tc.desc: getAbilityLists promise API abilityType is all, stateType is enable. + */ + it('AbilityList_0120', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0120 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('all', 'enable').then((data) => { + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }).catch((err) => { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0121 + * @tc.name: getAbilityLists promise API. + * @tc.desc: getAbilityLists promise API abilityType is all, stateType is enable, get eventTypes. + */ + it('AbilityList_0121', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0121 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('all', 'enable').then((data) => { + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + let eventTypes = [] + if (data.length > 0) { + eventTypes = data[0].eventTypes + } + expect(eventTypes.length).assertLarger(0) + done() + }).catch((err) => { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0122 + * @tc.name: getAbilityLists promise API. + * @tc.desc: getAbilityLists promise API abilityType is all, stateType is enable, get targetBundleNames. + */ + it('AbilityList_0122', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0122 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('all', 'enable').then((data) => { + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + let targetBundleNames = [] + if (data.length > 0) { + targetBundleNames = data[0].targetBundleNames + } + expect(targetBundleNames.length).assertLarger(0) + done() + }).catch((err) => { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0123 + * @tc.name: getAbilityLists promise API. + * @tc.desc: getAbilityLists promise API abilityType is all, stateType is enable, get other attribute. + */ + it('AbilityList_0123', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0123 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('all', 'enable').then((data) => { + console.error(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + let id = '' + let name = '' + let bundleName = '' + let abilityTypes = [] + let capabilities = [] + let description = '' + if (data.length > 0) { + id = data[0].id + name = data[0].name + bundleName = data[0].bundleName + abilityTypes = data[0].abilityTypes + capabilities = data[0].capabilities + description = data[0].description + } + expect(id.length).assertLarger(0) + expect(name.length).assertLarger(0) + expect(bundleName.length).assertLarger(0) + expect(abilityTypes.length).assertLarger(0) + expect(capabilities.length).assertLarger(0) + expect(description.length).assertLarger(0) + done() + }).catch((err) => { + console.error(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0130 + * @tc.name: getAbilityLists callback API. + * @tc.desc: getAbilityLists callback API abilityType is all, stateType is disable. + */ + it('AbilityList_0130', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0130 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('all', 'disable', (err, data) => { + if (err.code != 0) { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + return + } + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0140 + * @tc.name: getAbilityLists promise API. + * @tc.desc: getAbilityLists promise API abilityType is all, stateType is disable. + */ + it('AbilityList_0140', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0140 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('all', 'disable').then((data) => { + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }).catch((err) => { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0150 + * @tc.name: getAbilityLists callback API. + * @tc.desc: getAbilityLists callback API abilityType is all, stateType is enable. + */ + it('AbilityList_0150', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0150 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('all', 'disable', (err, data) => { + if (err.code != 0) { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + return + } + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0160 + * @tc.name: getAbilityLists promise API. + * @tc.desc: getAbilityLists promise API abilityType is all, stateType is enable. + */ + it('AbilityList_0160', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0160 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('all', 'disable').then((data) => { + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }).catch((err) => { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + }) + + function enableAbility(logTag, bundleNameArr) { + for (let bundleName of bundleNameArr) { + config.enableAbility(bundleName, ['retrieve']).then(() => { + console.info(logTag + 'enableAbility ' + bundleName + ' success.') + }).catch((error) => { + console.info(logTag + 'enableAbility ' + bundleName + ' failed. Cause: ' + JSON.stringify(error)) + return + }) + } + } + + function disableAbility(logTag, bundleNameArr) { + for (let bundleName of bundleNameArr) { + config.disableAbility(bundleName).then(() => { + console.info(logTag + 'disableAbility ' + bundleName + ' success.') + }).catch((error) => { + console.info(logTag + 'disableAbility ' + bundleName + ' failed. Cause: ' + JSON.stringify(error)) + return + }) + } + } + + function disableAll(logTag) { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME, SPOKEN_BUNDLE_NAME, VISUAL_BUNDLE_NAME]) + } +} diff --git a/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/test/List.test.ets b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..cb35098ac281d443c7add6de76cee00a268ce092 --- /dev/null +++ b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import abilityTest from './Ability.test' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/module.json b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..b8b2f9eccdbac57f7535b0194fb125acafab3d86 --- /dev/null +++ b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/module.json @@ -0,0 +1,47 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "com.example.abilitylisttest.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "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/accessibletest/actsabilitylisttest/entry/src/main/resources/base/element/string.json b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..26c6350af6eeb5284556f05dd7a8360a06b2b5f5 --- /dev/null +++ b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "AbilityListTest entry" + }, + { + "name": "MainAbility_desc", + "value": "AbilityListTest MainAbility" + }, + { + "name": "MainAbility_label", + "value": "AbilityList" + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/resources/base/media/icon.png b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/resources/base/media/icon.png differ diff --git a/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/resources/base/profile/main_pages.json b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..c1858c216308ad312862a877139a8ba6908ec3c6 --- /dev/null +++ b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/index" + ] +} diff --git a/barrierfree/accessibletest/actsabilitylisttest/signature/openharmony_sx.p7b b/barrierfree/accessibletest/actsabilitylisttest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..7ffcdc78527c5c1aa24520ab7e913c5f47c703f0 Binary files /dev/null and b/barrierfree/accessibletest/actsabilitylisttest/signature/openharmony_sx.p7b differ diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/AppScope/app.json b/barrierfree/accessibletest/actscaptionconfigurationtest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..c626da84041386e4a7767b2cbfeafe13ac2c8b57 --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/AppScope/app.json @@ -0,0 +1,20 @@ +{ + "app": { + "bundleName": "com.example.myapplicationxtsd", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_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/accessibletest/actscaptionconfigurationtest/AppScope/resources/base/element/string.json b/barrierfree/accessibletest/actscaptionconfigurationtest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..bea3196ac976df41039009ea9ba8af2a4c8003a7 --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/AppScope/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MyApplicationXtsD" + }, + { + "name": "description_application", + "value": "MyApplicationXtsD" + } + ] +} diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/AppScope/resources/base/media/app_icon.png b/barrierfree/accessibletest/actscaptionconfigurationtest/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibletest/actscaptionconfigurationtest/AppScope/resources/base/media/app_icon.png differ diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/BUILD.gn b/barrierfree/accessibletest/actscaptionconfigurationtest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..321a2b7d93375598fee2924f8328c0a70ea6b457 --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/BUILD.gn @@ -0,0 +1,43 @@ +# 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("ActsCaptionConfigurationTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":accessible_js_assets", + ":accessible_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsCaptionConfigurationTest" + subsystem_name = "barrierfree" + part_name = "accessibility" +} + +ohos_app_scope("accessible_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("accessible_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("accessible_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":accessible_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/Test.json b/barrierfree/accessibletest/actscaptionconfigurationtest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..756ab0c14bf06819e04cba78d1671b903e217a1e --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/Test.json @@ -0,0 +1,26 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "500000", + "bundle-name": "com.example.myapplicationxtsd", + "module-name": "phone", + "shell-timeout": "600000", + "testcase-timeout": 70000 + }, + "kits": [ + { + "test-file-name": [ + "ActsCaptionConfigurationTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "teardown-command":[ + "bm uninstall -n com.example.myapplicationxtsd" + ] + } + ] +} diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/Application/AbilityStage.ts b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..add36a172b393fc11866ac788a9a3d8258410cdf --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import AbilityStage from "@ohos.application.AbilityStage" +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.info("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/MainAbility/MainAbility.ts b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..871643e56b2d19878104d250c2fecc0f721e4adf --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + globalThis.windowStage = windowStage + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "MainAbility/pages/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/MainAbility/pages/index.ets b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..ca9e1d814e8d27fd5a0f907c726be45413afcb57 --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,661 @@ +/* + * 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 commonEvent from '@ohos.commonEvent' +import accessibility from '@ohos.accessibility'; +import config from '@ohos.accessibility.config' + +export { }; +const LOG: string = "[xtsLog]"; + +const CaptionConfiguration_0010 = () => { + const caseName = "CaptionConfiguration_0010" + const logTag = LOG + caseName; + let captionsManager = accessibility.getCaptionsManager(); + if (!captionsManager) { + console.info(logTag + "captionsManager is undefined"); + return; + } + let before = captionsManager.enabled; + console.info(logTag + "captionsManager before modification. enabled=" + before); + captionsManager.enabled = !captionsManager.enabled; + let after = captionsManager.enabled; + console.info(logTag + "captionsManager after modification. enabled=" + after); + if (before != after) { + commonEventPublishOnTargetChangeExtra(caseName); + } +} + +const printCaptionsManagerStyle = (logTag, captionsManager) => { + const back = "{\"fontFamily\":\"" + captionsManager.style.fontFamily + + "\",\"fontScale\":" + captionsManager.style.fontScale + + ",\"fontColor\":\"" + captionsManager.style.fontColor + + "\",\"fontEdgeType\":\"" + captionsManager.style.fontEdgeType + + "\",\"backgroundColor\":\"" + captionsManager.style.backgroundColor + + "\",\"windowColor\":\"" + captionsManager.style.windowColor + "\"}"; + console.info(logTag + back); + return back; +}; + +const printCaptionStyle = (logTag, CaptionStyle) => { + const back = "{\"fontFamily\":\"" + CaptionStyle.fontFamily + + "\",\"fontScale\":" + CaptionStyle.fontScale + + ",\"fontColor\":\"" + CaptionStyle.fontColor + + "\",\"fontEdgeType\":\"" + CaptionStyle.fontEdgeType + + "\",\"backgroundColor\":\"" + CaptionStyle.backgroundColor + + "\",\"windowColor\":\"" + CaptionStyle.windowColor + "\"}"; + console.info(logTag + back); + return back; +}; + +const foreachList = (currValue, array) => { + if (!currValue || currValue.length < 1) { + return array[0]; + } + let result = array[0]; + array.forEach((value, index) => { + if (currValue === value) { + if (array.length > index + 1) { + result = array[index + 1]; + } + } + }); + return result; +} + +const CaptionConfiguration_0020 = () => { + const caseName = "CaptionConfiguration_0020" + const logTag = LOG + caseName; + let captionsManager = accessibility.getCaptionsManager(); + if (!captionsManager) { + console.info(logTag + "captionsManager is undefined"); + return; + } + const before = printCaptionsManagerStyle(logTag + "captionsManager before modification. style=", captionsManager); + captionsManager.style.fontFamily = foreachList(captionsManager.style.fontFamily, ['default', 'monospacedSerif', 'serif', + 'monospacedSansSerif', 'sansSerif', 'casual', 'cursive', 'smallCapitals']); + const after = printCaptionsManagerStyle(logTag + "captionsManager after modification. style=", captionsManager); + if (before != after) { + commonEventPublishOnTargetChangeExtra(caseName); + } + +}; + +const CaptionConfiguration_0030 = () => { + const caseName = "CaptionConfiguration_0030" + const logTag = LOG + caseName; + let captionsManager = accessibility.getCaptionsManager(); + if (!captionsManager) { + console.info(logTag + "captionsManager is undefined"); + return; + } + let before = (captionsManager.enabled); + console.info(logTag + "captionsManager before modification. enabled=" + before); + captionsManager.enabled = !captionsManager.enabled; + let after = captionsManager.enabled; + console.info(logTag + "captionsManager after modification. enabled=" + after); + if (before != after) { + commonEventPublishOnTargetChangeExtra(caseName); + } +} + +const CaptionConfiguration_0040 = () => { + const caseName = "CaptionConfiguration_0040" + const logTag = LOG + caseName; + let captionsManager = accessibility.getCaptionsManager(); + if (!captionsManager) { + console.info(logTag + "captionsManager is undefined"); + return; + } + const before = printCaptionsManagerStyle(logTag + "captionsManager before modification. style=", captionsManager); + captionsManager.style.fontFamily = foreachList(captionsManager.style.fontFamily, ['default', 'monospacedSerif', 'serif', + 'monospacedSansSerif', 'sansSerif', 'casual', 'cursive', 'smallCapitals']); + const after = printCaptionsManagerStyle(logTag + "captionsManager after modification. style=", captionsManager); + if (before != after) { + commonEventPublishOnTargetChangeExtra(caseName); + } +}; + +const CaptionConfiguration_0050 = () => { + const caseName = "CaptionConfiguration_0050" + const logTag = LOG + caseName; + let captionsManager = accessibility.getCaptionsManager(); + if (!captionsManager) { + console.info(logTag + "captionsManager is undefined"); + return; + } + const before = printCaptionsManagerStyle(logTag + "captionsManager before modification. style=", captionsManager); + captionsManager.style.fontFamily = foreachList(captionsManager.style.fontFamily, ['default', 'monospacedSerif', 'serif', + 'monospacedSansSerif', 'sansSerif', 'casual', 'cursive', 'smallCapitals']); + const after = printCaptionsManagerStyle(logTag + "captionsManager after modification. style=", captionsManager); + if (before != after) { + commonEventPublishOnTargetChangeExtra(caseName); + } +}; + +const CaptionConfiguration_0060 = () => { + const caseName = "CaptionConfiguration_0060" + const logTag = LOG + caseName; + let captionsManager = accessibility.getCaptionsManager(); + if (!captionsManager) { + console.info(logTag + "captionsManager is undefined"); + return; + } + const before = printCaptionsManagerStyle(logTag + "captionsManager before modification. style=", captionsManager); + captionsManager.style.fontScale = (captionsManager.style.fontScale ?? 0) + 1; + const after = printCaptionsManagerStyle(logTag + "captionsManager after modification. style=", captionsManager); + if (before != after) { + commonEventPublishOnTargetChangeExtra(caseName); + } +}; + +const CaptionConfiguration_0070 = () => { + const caseName = "CaptionConfiguration_0070" + const logTag = LOG + caseName; + let captionsManager = accessibility.getCaptionsManager(); + if (!captionsManager) { + console.info(logTag + "captionsManager is undefined"); + return; + } + const before = printCaptionsManagerStyle(logTag + "captionsManager before modification. style=", captionsManager); + captionsManager.style.fontColor = foreachList(captionsManager.style.fontColor, ['red', 'yellow', 'blue', '#ff0000ff', '##ff000000', 'black', 'white']); + const after = printCaptionsManagerStyle(logTag + "captionsManager after modification. style=", captionsManager); + if (before != after) { + commonEventPublishOnTargetChangeExtra(caseName); + } +}; + +const CaptionConfiguration_0080 = () => { + const caseName = "CaptionConfiguration_0080" + const logTag = LOG + caseName; + let captionsManager = accessibility.getCaptionsManager(); + if (!captionsManager) { + console.info(logTag + "captionsManager is undefined"); + return; + } + const before = printCaptionsManagerStyle(logTag + "captionsManager before modification. style=", captionsManager); + captionsManager.style.fontEdgeType = foreachList(captionsManager.style.fontEdgeType, ['none', 'raised', 'depressed', 'uniform', 'dropShadow']); + const after = printCaptionsManagerStyle(logTag + "captionsManager after modification. style=", captionsManager); + if (before != after) { + commonEventPublishOnTargetChangeExtra(caseName); + } +}; + +const CaptionConfiguration_0090 = () => { + const caseName = "CaptionConfiguration_0090" + const logTag = LOG + caseName; + let captionsManager = accessibility.getCaptionsManager(); + if (!captionsManager) { + console.info(logTag + "captionsManager is undefined"); + return; + } + const before = printCaptionsManagerStyle(logTag + "captionsManager before modification. style=", captionsManager); + captionsManager.style.backgroundColor = foreachList(captionsManager.style.backgroundColor, ['red', 'yellow', 'blue', '#ff0000ff', '##ff000000', 'black', 'white']); + const after = printCaptionsManagerStyle(logTag + "captionsManager after modification. style=", captionsManager); + if (before != after) { + commonEventPublishOnTargetChangeExtra(caseName); + } +}; + +const CaptionConfiguration_0100 = () => { + const caseName = "CaptionConfiguration_0100" + const logTag = LOG + caseName; + let captionsManager = accessibility.getCaptionsManager(); + if (!captionsManager) { + console.info(logTag + "captionsManager is undefined"); + return; + } + const before = printCaptionsManagerStyle(logTag + "captionsManager before modification. style=", captionsManager); + captionsManager.style.windowColor = foreachList(captionsManager.style.windowColor, ['red', 'yellow', 'blue', '#ff0000ff', '#ff000000', 'black', 'white']); + const after = printCaptionsManagerStyle(logTag + "captionsManager after modification. style=", captionsManager); + if (before != after) { + commonEventPublishOnTargetChangeExtra(caseName); + } +}; + +const CaptionConfiguration_0110 = () => { + const caseName = "CaptionConfiguration_0110" + const logTag = LOG + caseName; + let captionsManager = accessibility.getCaptionsManager(); + if (!captionsManager) { + console.info(logTag + "captionsManager is undefined"); + return; + } + const before = printCaptionsManagerStyle(logTag + "captionsManager before modification. style=", captionsManager); + for (let index = 0; index < 3; index++) { + printCaptionsManagerStyle(logTag + "captionsManager before modification. times=" + index + ". style=", captionsManager); + captionsManager.style.windowColor = foreachList(captionsManager.style.windowColor, ['red', 'yellow', 'blue', '#ff0000ff', '#ff000000', '#00000000', '#f0000000', 'black', 'white']); + printCaptionsManagerStyle(logTag + "captionsManager after modification. times=" + index + ". style=", captionsManager); + } + setTimeout(() => { + const after = printCaptionsManagerStyle(logTag + "captionsManager after modification. style=", captionsManager); + if (before != after) { + commonEventPublishOnTargetChangeExtra(caseName); + } + }, 2000) + +}; + +const CaptionConfiguration_0120 = () => { + const caseName = "CaptionConfiguration_0120" + const logTag = LOG + caseName; + let captionsManager = accessibility.getCaptionsManager(); + if (!captionsManager) { + console.info(logTag + "captionsManager is undefined"); + return; + } + const before = console.info(logTag + "captionsManager before modification. enabled=" + captionsManager.enabled); + captionsManager.enabled = undefined; + const after = console.info(logTag + "captionsManager after modification. enabled=" + captionsManager.enabled); + if (before != after) { + commonEventPublishOnTargetChangeExtra(caseName); + } +}; + +const CaptionConfiguration_0130 = () => { + const caseName = "CaptionConfiguration_0130" + const logTag = LOG + caseName; + let captionsManager = accessibility.getCaptionsManager(); + if (!captionsManager) { + console.info(logTag + "captionsManager is undefined"); + return; + } + const before = printCaptionsManagerStyle(logTag + "captionsManager before modification. style=", captionsManager); + captionsManager.style.fontEdgeType = undefined; + const after = printCaptionsManagerStyle(logTag + "captionsManager after modification. style=", captionsManager); + if (before != after) { + commonEventPublishOnTargetChangeExtra(caseName); + } +}; + +const CaptionConfiguration_0140 = () => { + const caseName = "CaptionConfiguration_0140" + const logTag = LOG + caseName; + config.captions.get().then((res) => { + console.info(logTag + "Config before modification. enabled=" + res); + config.captions.set(!res).then(() => { + console.info(logTag + "Config after modification. enabled=" + !res); + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "caption set err=" + JSON.stringify(err)); + }); + }); +}; + +const CaptionConfiguration_0150 = () => { + const caseName = "CaptionConfiguration_0150" + const logTag = LOG + caseName; + config.captionsStyle.get().then((res) => { + if (!res) { + console.info(logTag + "captionsStyle is undefined"); + return; + } + var captionsStyle = res; + printCaptionStyle(logTag + "captionsStyle before modification. style=", JSON.stringify(res)); + captionsStyle.fontFamily = foreachList(res.fontFamily, ['default', 'monospacedSerif', 'serif', + 'monospacedSansSerif', 'sansSerif', 'casual', 'cursive', 'smallCapitals']); + printCaptionStyle(logTag + "captionsStyle after modification. style=", JSON.stringify(captionsStyle)); + config.captionsStyle.set(captionsStyle).then(() => { + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "captionsStyle fontFamily set err=" + JSON.stringify(err)); + }); + }) +}; + +const CaptionConfiguration_0160 = () => { + const caseName = "CaptionConfiguration_0160" + const logTag = LOG + caseName; + config.captions.get().then((res) => { + console.info(logTag + "Config before modification. enabled=" + res); + config.captions.set(!res).then(() => { + console.info(logTag + "Config after modification. enabled=" + !res); + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "caption set err=" + JSON.stringify(err)); + }); + }); +}; + +const CaptionConfiguration_0170 = () => { + const caseName = "CaptionConfiguration_0170" + const logTag = LOG + caseName; + config.captionsStyle.get().then((res) => { + if (!res) { + console.info(logTag + "captionsStyle is undefined"); + return; + } + var captionsStyle = res; + printCaptionStyle(logTag + "captionsStyle before modification. style=", JSON.stringify(res)); + captionsStyle.fontFamily = foreachList(res.fontFamily, ['default', 'monospacedSerif', 'serif', + 'monospacedSansSerif', 'sansSerif', 'casual', 'cursive', 'smallCapitals']); + printCaptionStyle(logTag + "captionsStyle after modification. style=", JSON.stringify(captionsStyle)); + config.captionsStyle.set(captionsStyle).then(() => { + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "captionsStyle fontFamily set err=" + JSON.stringify(err)); + }); + }) +}; + +const CaptionConfiguration_0180 = () => { + const caseName = "CaptionConfiguration_0180" + const logTag = LOG + caseName; + config.captionsStyle.get().then((res) => { + if (!res) { + console.info(logTag + "captionsStyle is undefined"); + return; + } + var captionsStyle = res; + printCaptionStyle(logTag + "captionsStyle before modification. style=", JSON.stringify(res)); + captionsStyle.fontFamily = foreachList(res.fontFamily, ['default', 'monospacedSerif', 'serif', + 'monospacedSansSerif', 'sansSerif', 'casual', 'cursive', 'smallCapitals']); + printCaptionStyle(logTag + "captionsStyle after modification. style=", JSON.stringify(captionsStyle)); + config.captionsStyle.set(captionsStyle).then(() => { + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "captionsStyle fontFamily set err=" + JSON.stringify(err)); + }); + }) +}; + +const CaptionConfiguration_0190 = () => { + const caseName = "CaptionConfiguration_0190" + const logTag = LOG + caseName; + config.captionsStyle.get().then((res) => { + if (!res) { + console.info(logTag + "captionsStyle is undefined"); + return; + } + var captionsStyle = res; + printCaptionStyle(logTag + "captionsStyle before modification. style=", JSON.stringify(res)); + captionsStyle.fontScale = (res.fontScale ?? 0) + 1; + printCaptionStyle(logTag + "captionsStyle after modification. style=", JSON.stringify(captionsStyle)); + config.captionsStyle.set(captionsStyle).then(() => { + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "captionsStyle fontFamily set err=" + JSON.stringify(err)); + }); + }) +}; + +const CaptionConfiguration_0200 = () => { + const caseName = "CaptionConfiguration_0200" + const logTag = LOG + caseName; + config.captionsStyle.get().then((res) => { + if (!res) { + console.info(logTag + "captionsStyle is undefined"); + return; + } + var captionsStyle = res; + printCaptionStyle(logTag + "captionsStyle before modification. style=", JSON.stringify(res)); + captionsStyle.fontColor = foreachList(res.fontColor, ['red', 'yellow', 'blue', '#FFFFFF', '#000000', 'black', 'white']); + printCaptionStyle(logTag + "captionsStyle after modification. style=", JSON.stringify(captionsStyle)); + config.captionsStyle.set(captionsStyle).then(() => { + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "captionsStyle fontFamily set err=" + JSON.stringify(err)); + }); + }) +}; + +const CaptionConfiguration_0210 = () => { + const caseName = "CaptionConfiguration_0210" + const logTag = LOG + caseName; + config.captionsStyle.get().then((res) => { + if (!res) { + console.info(logTag + "captionsStyle is undefined"); + return; + } + var captionsStyle = res; + printCaptionStyle(logTag + "captionsStyle before modification. style=", JSON.stringify(res)); + captionsStyle.fontEdgeType = foreachList(res.fontEdgeType, ['none', 'raised', 'depressed', 'uniform', 'dropShadow']); + printCaptionStyle(logTag + "captionsStyle after modification. style=", JSON.stringify(captionsStyle)); + config.captionsStyle.set(captionsStyle).then(() => { + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "captionsStyle fontFamily set err=" + JSON.stringify(err)); + }); + }) +}; + +const CaptionConfiguration_0220 = () => { + const caseName = "CaptionConfiguration_0220" + const logTag = LOG + caseName; + config.captionsStyle.get().then((res) => { + if (!res) { + console.info(logTag + "captionsStyle is undefined"); + return; + } + var captionsStyle = res; + printCaptionStyle(logTag + "captionsStyle before modification. style=", JSON.stringify(res)); + captionsStyle.backgroundColor = foreachList(res.backgroundColor, ['red', 'yellow', 'blue', '#ff0000ff', '#ff000000', '#00000000', '#f0000000', 'black', 'white']); + printCaptionStyle(logTag + "captionsStyle after modification. style=", JSON.stringify(captionsStyle)); + config.captionsStyle.set(captionsStyle).then(() => { + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "captionsStyle fontFamily set err=" + JSON.stringify(err)); + }); + }) +}; + +const CaptionConfiguration_0230 = () => { + const caseName = "CaptionConfiguration_0230" + const logTag = LOG + caseName; + config.captionsStyle.get().then((res) => { + if (!res) { + console.info(logTag + "captionsStyle is undefined"); + return; + } + var captionsStyle = res; + printCaptionStyle(logTag + "captionsStyle before modification. style=", JSON.stringify(res)); + captionsStyle.windowColor = foreachList(res.windowColor, ['red', 'yellow', 'blue', '#ff0000ff', '#ff000000', '#00000000', '#f0000000', 'black', 'white']); + printCaptionStyle(logTag + "captionsStyle after modification. style=", JSON.stringify(captionsStyle)); + config.captionsStyle.set(captionsStyle).then(() => { + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "captionsStyle fontFamily set err=" + JSON.stringify(err)); + }); + }) +}; + +const CaptionConfiguration_0240 = () => { + const caseName = "CaptionConfiguration_0240" + const logTag = LOG + caseName; + config.captionsStyle.get().then((res) => { + if (!res) { + console.info(logTag + "captionsStyle is undefined"); + return; + } + var captionsStyle = res; + for (let index = 0; index < 3; index++) { + printCaptionStyle(logTag + "captionsStyle before modification. style=", JSON.stringify(res)); + captionsStyle.windowColor = foreachList(res.windowColor, ['red', 'yellow', 'blue', '#ff0000ff', '#ff000000', '#00000000', '#f0000000', 'black', 'white']); + printCaptionStyle(logTag + "captionsStyle after modification. style=", JSON.stringify(captionsStyle)); + config.captionsStyle.set(captionsStyle).then(() => { + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "captionsStyle fontFamily set err=" + JSON.stringify(err)); + }); + } + + + }) +}; + +const CaptionConfiguration_0260 = () => { + const caseName = "CaptionConfiguration_0260" + const logTag = LOG + caseName; + config.captionsStyle.get().then((res) => { + if (!res) { + console.info(logTag + "captionsStyle is undefined"); + return; + } + var captionsStyle = res; + printCaptionStyle(logTag + "captionsStyle before modification. style=", JSON.stringify(res)); + captionsStyle.fontEdgeType = undefined; + printCaptionStyle(logTag + "captionsStyle after modification. style=", JSON.stringify(captionsStyle)); + config.captionsStyle.set(captionsStyle).then(() => { + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "captionsStyle fontFamily set err=" + JSON.stringify(err)); + }); + }) +}; + +const commonEventPublishOnTargetChangeExtra = (caseName) => { + function publishCallback(err) { + console.info(LOG + caseName + " on_target_change_extra publish call back result:" + JSON.stringify(err)); + } + var commonEventPublishData = { + data: caseName + "_on_target_change_extra_success", + } + commonEvent.publish("on_target_change_extra", commonEventPublishData, publishCallback); +} + +const excuteAbility = (data) => { + switch (data) { + case "CaptionConfiguration_0010" + "_AccessibilityApp_start": + CaptionConfiguration_0010() + break; + case "CaptionConfiguration_0020" + "_AccessibilityApp_start": + CaptionConfiguration_0020() + break; + case "CaptionConfiguration_0030" + "_AccessibilityApp_start": + CaptionConfiguration_0030() + break; + case "CaptionConfiguration_0040" + "_AccessibilityApp_start": + CaptionConfiguration_0040() + break; + case "CaptionConfiguration_0050" + "_AccessibilityApp_start": + CaptionConfiguration_0050() + break; + case "CaptionConfiguration_0060" + "_AccessibilityApp_start": + CaptionConfiguration_0060() + break; + case "CaptionConfiguration_0070" + "_AccessibilityApp_start": + CaptionConfiguration_0070() + break; + case "CaptionConfiguration_0080" + "_AccessibilityApp_start": + CaptionConfiguration_0080() + break; + case "CaptionConfiguration_0090" + "_AccessibilityApp_start": + CaptionConfiguration_0090() + break; + case "CaptionConfiguration_0100" + "_AccessibilityApp_start": + CaptionConfiguration_0100() + break; + case "CaptionConfiguration_0110" + "_AccessibilityApp_start": + CaptionConfiguration_0110() + break; + case "CaptionConfiguration_0120" + "_AccessibilityApp_start": + CaptionConfiguration_0120() + break; + case "CaptionConfiguration_0130" + "_AccessibilityApp_start": + CaptionConfiguration_0130() + break; + case "CaptionConfiguration_0140" + "_AccessibilityApp_start": + CaptionConfiguration_0140() + break; + case "CaptionConfiguration_0150" + "_AccessibilityApp_start": + CaptionConfiguration_0150() + break; + case "CaptionConfiguration_0160" + "_AccessibilityApp_start": + CaptionConfiguration_0160() + break; + case "CaptionConfiguration_0170" + "_AccessibilityApp_start": + CaptionConfiguration_0170() + break; + case "CaptionConfiguration_0180" + "_AccessibilityApp_start": + CaptionConfiguration_0180() + break; + case "CaptionConfiguration_0190" + "_AccessibilityApp_start": + CaptionConfiguration_0190() + break; + case "CaptionConfiguration_0200" + "_AccessibilityApp_start": + CaptionConfiguration_0200() + break; + case "CaptionConfiguration_0210" + "_AccessibilityApp_start": + CaptionConfiguration_0210() + break; + case "CaptionConfiguration_0210" + "_AccessibilityApp_start": + CaptionConfiguration_0210() + break; + case "CaptionConfiguration_0220" + "_AccessibilityApp_start": + CaptionConfiguration_0220() + break; + case "CaptionConfiguration_0220" + "_AccessibilityApp_start": + CaptionConfiguration_0220() + break; + case "CaptionConfiguration_0230" + "_AccessibilityApp_start": + CaptionConfiguration_0230() + break; + case "CaptionConfiguration_0240" + "_AccessibilityApp_start": + CaptionConfiguration_0240() + break; + case "CaptionConfiguration_0260" + "_AccessibilityApp_start": + CaptionConfiguration_0260() + break; + default: + break; + } +} + +@Entry +@Component +struct Index { + private subScriber = undefined; + aboutToAppear() { + var commonEventSubscribeInfo = { + events: ["on_target_change"] + } + function subscriberCallback(err, data) { + console.info(LOG + "====>Target subscriberCallback start"); + console.info(LOG + "====>Target receive event err:" + JSON.stringify(err)); + console.info(LOG + "====>Target receive event data:" + JSON.stringify(data)); + excuteAbility(data.data); + console.info(LOG + "====>Target subscriberCallback end"); + } + commonEvent.createSubscriber(commonEventSubscribeInfo).then((subscriber) => { + console.info(LOG + "====> Target createSubscriber Start====") + this.subScriber = subscriber; + commonEvent.subscribe(subscriber, subscriberCallback); + console.info(LOG + "====> Target createSubscriber End====") + }) + console.info("start run testcase!!!!"); + } + + aboutToDisappear() { + console.info('TargetApp aboutToDisappear'); + commonEvent.unsubscribe(this.subScriber); + this.subScriber = undefined; + } + + build() { + Row() { + Column() { + Button('CaptionConfiguration') + .fontSize(15) + .fontWeight(FontWeight.Bold) + .margin(5) + .onClick((e) => { + console.info("CaptionConfiguration onClick") + }) + } + .width('100%') + } + .height('100%') + } +} diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..0ab1a5fed1ab8f3c482ae3c2c01549f9558a1aec --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts @@ -0,0 +1,61 @@ +/* + * 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 AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtensionAbility' +const logTag = "[xtsLog]" +class ServiceExtAbility extends AccessibilityExtensionAbility { + onConnect() { + const context = this.context; + console.info(logTag + "AccessibilityAll onAbilityConnected"); + var commonEventSubscribeInfo = { + events: ["on_assist_change", "execute_accessibility_event"] + } + + function subscriberCallback(err, data) { + console.info(logTag + "AccessibilityALLD subscriberCallback start"); + console.info(logTag + "AccessibilityALLD receive event err:" + JSON.stringify(err)); + console.info(logTag + "AccessibilityALLD receive event data:" + JSON.stringify(data)); + console.info(logTag + "AccessibilityALLD subscriberCallback end"); + } + + var subscriber + commonEvent.createSubscriber(commonEventSubscribeInfo).then(function (data) { + console.info(logTag + " AccessibilityALLD createSubscriber Start====") + subscriber = data; + commonEvent.subscribe(subscriber, subscriberCallback); + console.info(logTag + " AccessibilityALLD createSubscriber End====") + }) + console.info(logTag + " AccessibilityALLD onShow End====") + } + + onAccessibilityEvent(accessibilityEvent) { + printAccessibilityEvent(accessibilityEvent); + return true; + } + + onKeyEvent(keyEvent) { + console.info(" onKeyEvent"); + console.info(logTag + "onKeyEvent KeyInterception AccessibilityAllD: " + JSON.stringify(keyEvent)); + return true; + } +} + +const printAccessibilityEvent = (accessibilityEvent) => { + console.info(logTag + "AccessibilityAllD onAccessibilityEvent Start"); + console.info(logTag + "AccessibilityAllD onAccessibilityEvent accessibilityEvent=" + JSON.stringify(accessibilityEvent)); + console.info(logTag + "AccessibilityAllD onAccessibilityEvent End"); +} + +export default ServiceExtAbility diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/TestAbility/TestAbility.ts b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/TestAbility/TestAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..301aaf6099dd794d856d2ab13bf3ef6f13e3ba78 --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/TestAbility/TestAbility.ts @@ -0,0 +1,45 @@ +import Ability from '@ohos.application.Ability' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default class TestAbility extends Ability { + onCreate(want, launchParam) { + console.log('TestAbility onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log('TestAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('TestAbility onWindowStageCreate') + windowStage.loadContent("TestAbility/pages/index", (err, data) => { + if (err.code) { + console.error('Failed to load the content. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data)) + }); + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('TestAbility onWindowStageDestroy') + } + + onForeground() { + console.log('TestAbility onForeground') + } + + onBackground() { + console.log('TestAbility onBackground') + } +}; \ No newline at end of file diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/TestAbility/pages/index.ets b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..733600abc03d7e777ef1a55eaddd77f4d1d7d66d --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,34 @@ +import router from '@ohos.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('TestAbility index aboutToAppear') + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..aa80665183852aae57a7202ddb8bda62ecef59e2 --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,64 @@ +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout', + '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a com.example.myapplicationxtsd.MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + if (debug == 'true') + { + cmd += ' -D' + } + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/test/CaptionConfiguration.test.ets b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/test/CaptionConfiguration.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..2c179bbf91e4bdfeeb913672d24780009bb7e09c --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/test/CaptionConfiguration.test.ets @@ -0,0 +1,747 @@ +/* + * 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, afterAll, it, expect } from '@ohos/hypium' +import commonEvent from '@ohos.commonEvent' +import accessibility from '@ohos.accessibility'; +import config from '@ohos.accessibility.config'; +const LOG = "[xtsLog]" +const START_TIMEOUT = 5000; + +const CaptionConfigurationOn = (logTag, captionType) => { + let captionsManager = accessibility.getCaptionsManager(); + if (!captionsManager) { + console.info(logTag + " captionsManager is undefined"); + return; + } + captionsManager.on(captionType, (res) => { + console.info(logTag + " captionsManager on " + captionType + " res: " + JSON.stringify(res)); + onbackList.push(logTag + "_on_success") + console.info(logTag + "_on_success"); + }); +} + +const CaptionConfigurationOff = (logTag, captionType) => { + let captionsManager = accessibility.getCaptionsManager(); + if (!captionsManager) { + console.info(logTag + " captionsManager is undefined"); + return; + } + captionsManager.off(captionType, (res) => { + console.info(logTag + " captionsManager off " + captionType + " res: " + JSON.stringify(res)); + }); +} + +const captionOn = (logTag, caseName) => { + config.captions.on((res) => { + console.info(logTag + " captionOn res = " + JSON.stringify(res)); + console.info(logTag + "_on_success"); + onbackList.push(caseName + "_on_success") + }); +} + +const captionOff = (logTag, captionType) => { + config.captions.off((res) => { + console.info(logTag + " caption off " + captionType + " res: " + JSON.stringify(res)); + }); +} + +const captionStyleOn = (logTag, caseName) => { + config.captionsStyle.on((res) => { + console.info(logTag + " captionsStyle On res = " + JSON.stringify(res)); + console.info(logTag + "_on_success"); + onbackList.push(caseName + "_on_success") + }); +} + +const captionStyleOff = (logTag, captionType) => { + config.captionsStyle.off((res) => { + console.info(logTag + " captionsStyle off " + captionType + " res: " + JSON.stringify(res)); + }); +} + +const excuteCase = (caseNamePara) => { + console.info(LOG + 'AccessibleEventTest excuteCase: ' + caseNamePara); + + function publishCallback(err) { + console.info(LOG + caseNamePara + "on_target_change publish call back result:" + JSON.stringify(err)); + } + + var commonEventPublishData = { + data: caseNamePara + "_AccessibilityApp_start" + } + commonEvent.publish("on_target_change", commonEventPublishData, publishCallback); +} +var backList = [] +let subScriber = undefined; +var onbackList = [] +export default function CaptionConfigurationTest() { + describe('ActsCaptionConfigurationTest', function () { + beforeEach(async function (done) { + console.info(LOG + 'ActsCaptionConfigurationTest: beforeEach'); + setTimeout(() => { + done(); + }, 3000); + }); + beforeAll(async function (done) { + console.info(LOG + 'ActsCaptionConfigurationTest: beforeAll'); + + subScriber = await commonEvent.createSubscriber({ + events: ['on_target_change_extra'] + }); + console.info(LOG + 'ActsCaptionConfigurationTest beforeAll subscribe send:' + JSON.stringify(subScriber)); + + commonEvent.subscribe(subScriber, (err, data) => { + console.info(LOG + ' ActsCaptionConfigurationTest beforeAll subscribe data:' + JSON.stringify(data)); + if (data.data) { + console.info(LOG + " ActsCaptionConfigurationTest CallBack: " + data.data); + backList.push(data.data) + } + }); + setTimeout(done(), START_TIMEOUT); + }); + + afterAll(async function (done) { + console.info(LOG + 'ActsCaptionConfigurationTest: afterAll'); + setTimeout(function () { + commonEvent.unsubscribe(subScriber); + config.captions.set(false); + let captionsStyle: accessibility.CaptionsStyle = {"fontFamily":"default","fontScale":0,"fontColor":"#000000ff","fontEdgeType":"none","backgroundColor":"#000000ff","windowColor":"#000000ff"}; + config.captionsStyle.set(captionsStyle); + done(); + }, 10000); + }); + + /** + * @tc.number: CaptionConfiguration_0010 + * @tc.name: Call api:getcaptionsmanager() to set the caption parameter. + * @tc.desc: Call api:getcaptionsmanager() to set the caption parameter. + */ + it('CaptionConfiguration_0010', 1, async function (done) { + const caseName = "CaptionConfiguration_0010"; + const logF = LOG + caseName; + setTimeout(() => { + CaptionConfigurationOn(caseName, 'enableChange') + }, 1000); + setTimeout(() => { + excuteCase(caseName); + }, 3000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + var isSucceedOnBack: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + if (onbackList.indexOf(caseName + '_on_success') !== -1) { + isSucceedOnBack = true; + } + expect(isSucceedTarget && isSucceedOnBack).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget && isSucceedOnBack)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0020 + * @tc.name: Call api:getcaptionsmanager() to set the caption parameter. + * @tc.desc: Call api:getcaptionsmanager() to set the caption parameter. + */ + it('CaptionConfiguration_0020', 1, async function (done) { + const caseName = "CaptionConfiguration_0020"; + const logF = LOG + caseName; + CaptionConfigurationOn(caseName, 'styleChange') + setTimeout(() => { + excuteCase(caseName); + }, 3000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + var isSucceedOnBack: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + if (onbackList.indexOf(caseName + '_on_success') !== -1) { + isSucceedOnBack = true; + } + expect(isSucceedTarget && isSucceedOnBack).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget && isSucceedOnBack)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0030 + * @tc.name: Call api:getcaptionsmanager() to set the caption parameter. + * @tc.desc: Call api:getcaptionsmanager() to set the caption parameter. + */ + it('CaptionConfiguration_0030', 1, async function (done) { + const caseName = "CaptionConfiguration_0030"; + const logF = LOG + caseName; + setTimeout(() => { + CaptionConfigurationOn(caseName, 'enableChange'); + }, 1000); + setTimeout(() => { + CaptionConfigurationOff(caseName, 'enableChange') + }, 2000); + setTimeout(() => { + excuteCase(caseName); + }, 3000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + var isSucceedOnBack: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + if (onbackList.indexOf(caseName + '_on_success') == -1) { + isSucceedOnBack = true; + } + expect(isSucceedTarget && isSucceedOnBack).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget && isSucceedOnBack)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0040 + * @tc.name: Call api:getcaptionsmanager() to set the caption parameter. + * @tc.desc: Call api:getcaptionsmanager() to set the caption parameter. + */ + it('CaptionConfiguration_0040', 1, async function (done) { + const caseName = "CaptionConfiguration_0040"; + const logF = LOG + caseName; + setTimeout(() => { + CaptionConfigurationOn(caseName, 'styleChange'); + }, 1000); + setTimeout(() => { + CaptionConfigurationOff(caseName, 'styleChange') + }, 2000); + setTimeout(() => { + excuteCase(caseName); + }, 3000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + var isSucceedOnBack: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + if (onbackList.indexOf(caseName + '_on_success') == -1) { + isSucceedOnBack = true; + } + expect(isSucceedTarget && isSucceedOnBack).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget && isSucceedOnBack)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0050 + * @tc.name: Call api:getcaptionsmanager() to set the caption parameter. + * @tc.desc: Call api:getcaptionsmanager() to set the caption parameter. + */ + it('CaptionConfiguration_0050', 1, async function (done) { + const caseName = "CaptionConfiguration_0050"; + const logF = LOG + caseName; + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0060 + * @tc.name: Call api:getcaptionsmanager() to set the caption parameter. + * @tc.desc: Call api:getcaptionsmanager() to set the caption parameter. + */ + it('CaptionConfiguration_0060', 1, async function (done) { + const caseName = "CaptionConfiguration_0060"; + const logF = LOG + caseName; + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0070 + * @tc.name: Call api:getcaptionsmanager() to set the caption parameter. + * @tc.desc: Call api:getcaptionsmanager() to set the caption parameter. + */ + it('CaptionConfiguration_0070', 1, async function (done) { + const caseName = "CaptionConfiguration_0070"; + const logF = LOG + caseName; + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0080 + * @tc.name: Call api:getcaptionsmanager() to set the caption parameter. + * @tc.desc: Call api:getcaptionsmanager() to set the caption parameter. + */ + it('CaptionConfiguration_0080', 1, async function (done) { + const caseName = "CaptionConfiguration_0080"; + const logF = LOG + caseName; + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0090 + * @tc.name: Call api:getcaptionsmanager() to set the caption parameter. + * @tc.desc: Call api:getcaptionsmanager() to set the caption parameter. + */ + it('CaptionConfiguration_0090', 1, async function (done) { + const caseName = "CaptionConfiguration_0090"; + const logF = LOG + caseName; + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0100 + * @tc.name: Call api:getcaptionsmanager() to set the caption parameter. + * @tc.desc: Call api:getcaptionsmanager() to set the caption parameter. + */ + it('CaptionConfiguration_0100', 1, async function (done) { + const caseName = "CaptionConfiguration_0100"; + const logF = LOG + caseName; + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0110 + * @tc.name: Call api:getcaptionsmanager() to set the caption parameter. + * @tc.desc: Call api:getcaptionsmanager() to set the caption parameter. + */ + it('CaptionConfiguration_0110', 1, async function (done) { + const caseName = "CaptionConfiguration_0110"; + const logF = LOG + caseName; + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0120 + * @tc.name: Call api:getcaptionsmanager() to set the caption parameter. + * @tc.desc: Call api:getcaptionsmanager() to set the caption parameter. + */ + it('CaptionConfiguration_0120', 1, async function (done) { + const caseName = "CaptionConfiguration_0120"; + const logF = LOG + caseName; + setTimeout(() => { + CaptionConfigurationOn(caseName, undefined); + }, 1000); + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + var isSucceedOnBack: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') == -1) { + isSucceedTarget = true; + } + if (onbackList.indexOf(caseName + '_on_success') == -1) { + isSucceedOnBack = true; + } + expect(isSucceedTarget && isSucceedOnBack).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget && isSucceedOnBack)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0130 + * @tc.name: Call api:getcaptionsmanager() to set the caption parameter. + * @tc.desc: Call api:getcaptionsmanager() to set the caption parameter. + */ + it('CaptionConfiguration_0130', 1, async function (done) { + const caseName = "CaptionConfiguration_0130"; + const logF = LOG + caseName; + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0140 + * @tc.name: Call api:config to set the captions parameter. + * @tc.desc: Call api:config to set the captions parameter. + */ + it('CaptionConfiguration_0140', 1, async function (done) { + const caseName = "CaptionConfiguration_0140"; + const logF = LOG + caseName; + setTimeout(() => { + captionOn(logF, caseName) + }, 1000); + setTimeout(() => { + excuteCase(caseName); + }, 3000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + var isSucceedOnBack: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + if (onbackList.indexOf(caseName + '_on_success') !== -1) { + isSucceedOnBack = true; + } + expect(isSucceedTarget && isSucceedOnBack).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget && isSucceedOnBack)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0150 + * @tc.name: Call api:config to set the captionsStyle parameter. + * @tc.desc: Call api:config to set the captionsStyle parameter. + */ + it('CaptionConfiguration_0150', 1, async function (done) { + const caseName = "CaptionConfiguration_0150"; + const logF = LOG + caseName; + captionStyleOn(logF, caseName) + setTimeout(() => { + excuteCase(caseName); + }, 3000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + var isSucceedOnBack: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + if (onbackList.indexOf(caseName + '_on_success') !== -1) { + isSucceedOnBack = true; + } + expect(isSucceedTarget && isSucceedOnBack).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget && isSucceedOnBack)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0160 + * @tc.name: Call api:config to set the captions parameter. + * @tc.desc: Call api:config to set the captions parameter. + */ + it('CaptionConfiguration_0160', 1, async function (done) { + const caseName = "CaptionConfiguration_0160"; + const logF = LOG + caseName; + setTimeout(() => { + captionOn(logF, caseName) + }, 1000); + setTimeout(() => { + captionOff(logF, caseName) + }, 2000); + setTimeout(() => { + excuteCase(caseName); + }, 3000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + var isSucceedOnBack: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + if (onbackList.indexOf(caseName + '_on_success') == -1) { + isSucceedOnBack = true; + } + expect(isSucceedTarget && isSucceedOnBack).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget && isSucceedOnBack)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0170 + * @tc.name: Call api:config to set the captionsStyle parameter. + * @tc.desc: Call api:config to set the captionsStyle parameter. + */ + it('CaptionConfiguration_0170', 1, async function (done) { + const caseName = "CaptionConfiguration_0170"; + const logF = LOG + caseName; + setTimeout(() => { + captionStyleOn(logF, caseName); + }, 1000); + setTimeout(() => { + captionStyleOff(logF, caseName) + }, 2000); + setTimeout(() => { + excuteCase(caseName); + }, 3000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + var isSucceedOnBack: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + if (onbackList.indexOf(caseName + '_on_success') == -1) { + isSucceedOnBack = true; + } + expect(isSucceedTarget && isSucceedOnBack).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget && isSucceedOnBack)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0180 + * @tc.name: Call api:config to set the captionsStyle parameter. + * @tc.desc: Call api:config to set the captionsStyle parameter. + */ + it('CaptionConfiguration_0180', 1, async function (done) { + const caseName = "CaptionConfiguration_0180"; + const logF = LOG + caseName; + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0190 + * @tc.name: Call api:config to set the captionsStyle parameter. + * @tc.desc: Call api:config to set the captionsStyle parameter. + */ + it('CaptionConfiguration_0190', 1, async function (done) { + const caseName = "CaptionConfiguration_0190"; + const logF = LOG + caseName; + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0200 + * @tc.name: Call api:config to set the captionsStyle parameter. + * @tc.desc: Call api:config to set the captionsStyle parameter. + */ + it('CaptionConfiguration_0200', 1, async function (done) { + const caseName = "CaptionConfiguration_0200"; + const logF = LOG + caseName; + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0210 + * @tc.name: Call api:config to set the captionsStyle parameter. + * @tc.desc: Call api:config to set the captionsStyle parameter. + */ + it('CaptionConfiguration_0210', 1, async function (done) { + const caseName = "CaptionConfiguration_0210"; + const logF = LOG + caseName; + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0220 + * @tc.name: Call api:config to set the captionsStyle parameter. + * @tc.desc: Call api:config to set the captionsStyle parameter. + */ + it('CaptionConfiguration_0220', 1, async function (done) { + const caseName = "CaptionConfiguration_0220"; + const logF = LOG + caseName; + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0230 + * @tc.name: Call api:config to set the captionsStyle parameter. + * @tc.desc: Call api:config to set the captionsStyle parameter. + */ + it('CaptionConfiguration_0230', 1, async function (done) { + const caseName = "CaptionConfiguration_0230"; + const logF = LOG + caseName; + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0240 + * @tc.name: Call api:config to set the captionsStyle parameter. + * @tc.desc: Call api:config to set the captionsStyle parameter. + */ + it('CaptionConfiguration_0240', 1, async function (done) { + const caseName = "CaptionConfiguration_0240"; + const logF = LOG + caseName; + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0260 + * @tc.name: Call api:config to set the captionsStyle parameter. + * @tc.desc: Call api:config to set the captionsStyle parameter. + */ + it('CaptionConfiguration_0260', 1, async function (done) { + const caseName = "CaptionConfiguration_0260"; + const logF = LOG + caseName; + excuteCase(caseName); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + + }) +} diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/test/List.test.ets b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..736fd152148eb4a2c51bd071f744164e674020ed --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/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 CaptionConfigurationTest from './CaptionConfiguration.test' + +export default function testsuite() { + CaptionConfigurationTest() +} \ No newline at end of file diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/module.json b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..f136cb907fe408abf01a45ea7b660f18d1ea82f5 --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/module.json @@ -0,0 +1,62 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "com.example.myapplicationxtsd.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:entry_desc", + "icon": "$media:icon", + "label": "$string:entry_desc", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "name": "ServiceExtAbility", + "srcEntrance": "./ets/ServiceExtAbility/ServiceExtAbility.ts", + "label": "$string:entry_desc", + "description": "$string:entry_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/accessibletest/actscaptionconfigurationtest/entry/src/main/resources/base/element/string.json b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..e533d8e9d7cea8546c278831aac3d5b7b6f96eb1 --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,20 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "9xts" + }, + { + "name": "MainAbility_desc", + "value": "9xts" + }, + { + "name": "MainAbility_label", + "value": "9xts" + }, + { + "name": "description_serviceability", + "value": "Accessiable" + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/resources/base/media/icon.png b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/resources/base/media/icon.png differ diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/resources/base/profile/accessibility_config.json b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/resources/base/profile/accessibility_config.json new file mode 100644 index 0000000000000000000000000000000000000000..d044b388f86e66d0c6412cb286fc52dded2ca3d3 --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/resources/base/profile/accessibility_config.json @@ -0,0 +1,10 @@ +{ + "accessibilityCapabilities": [ + "retrieve", + "keyEventObserver", + "gesture", + "touchGuide" + ], + "accessibilityCapabilityRationale": "a11y_rationale", + "settingsAbility": "com.example.myapplication.accessibilitySetting" +} \ No newline at end of file diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/resources/base/profile/main_pages.json b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..c7cf4ba21afceed8745647810ebec481620a975c --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/index" + ] +} \ No newline at end of file diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/signature/openharmony_sx.p7b b/barrierfree/accessibletest/actscaptionconfigurationtest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..7ffcdc78527c5c1aa24520ab7e913c5f47c703f0 Binary files /dev/null and b/barrierfree/accessibletest/actscaptionconfigurationtest/signature/openharmony_sx.p7b differ diff --git a/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/AppScope/app.json b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..cbfdbe824e38cd1444889467261a61c8e639f2b6 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.accessibleaudibleability.hmservice", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive": true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/AppScope/resources/base/element/string.json b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0cc5794a55b4d3ba6b0bc45f4a46315236ddd4a2 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AccessibleAudibleAbility" + } + ] +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/AppScope/resources/base/media/app_icon.png b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/AppScope/resources/base/media/app_icon.png differ diff --git a/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/BUILD.gn b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..c38234ff28d163be491e1faabf18f2b0813052fd --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/BUILD.gn @@ -0,0 +1,43 @@ +# 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_hap_assist_suite("accessibilityAudibleAbility") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":accessible_js_assets", + ":accessible_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "accessibilityAudibleAbility" + subsystem_name = "barrierfree" + part_name = "accessibility" +} + +ohos_app_scope("accessible_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("accessible_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("accessible_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":accessible_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/Test.json b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..b9f4122fbf466755fe279be1082dcf138af90789 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests", +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/ets/Application/AbilityStage.ts b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..3788aefd2346d1170a208d47515b850c0cd27b2f --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[AccessibleAudibleAbility] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/ets/MainAbility/MainAbility.ts b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..1cc33db635c16e08a4aea1ddf62473cc494e4459 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[AccessibleAudibleAbility] MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[AccessibleAudibleAbility] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[AccessibleAudibleAbility] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "MainAbility/pages/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[AccessibleAudibleAbility] MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[AccessibleAudibleAbility] MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[AccessibleAudibleAbility] MainAbility onBackground") + } +}; diff --git a/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/ets/MainAbility/pages/index.ets b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..c4c382cf18941ac82d25ab571ebb3879b0f82811 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,32 @@ +/* + * 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. + */ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + 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/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..959e5a24c978e00f7e6fef9bded2fabde6adfe02 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts @@ -0,0 +1,37 @@ +/* + * 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' + + +const LOG_PREFIX = '[CQH-AUDIBLE-ABILITY-ACCESSIBLE]' +class ServiceExtAbility extends AccessibilityExtensionAbility { + onConnect() { + console.info(LOG_PREFIX + " onConnect") + } + onDisconnect() { + console.info(LOG_PREFIX + " onDisconnect") + } + onAccessibilityEvent(accessibilityEvent) { + console.info(LOG_PREFIX + " accessibilityEvent : " + JSON.stringify(accessibilityEvent)) + } + onKeyEvent(keyEvent) { + console.info(LOG_PREFIX + " keyEvent : " + JSON.stringify(keyEvent)) + return true + } +} + +export default ServiceExtAbility \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/module.json b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..7090873bee6be28b485da1e47ebd061f6c956c39 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/module.json @@ -0,0 +1,63 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": true, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "com.example.accessibleaudibleability.hmservice.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "srcEntrance": "./ets/ServiceExtAbility/ServiceExtAbility.ts", + "name": "ServiceExtAbility", + "icon": "$media:icon", + "description": "$string:description_serviceability", + "type": "accessibility", + "visible": true, + "metadata": [ + { + "name": "ohos.accessibleability", + "resource": "$profile:accessibility_config" + } + ] + } + ], + "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/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/resources/base/element/string.json b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f16cb4634cfc9c58783fd4a58ecfaaa6ecb0c1b5 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "audible辅助应用" + }, + { + "name": "description_serviceability", + "value": "audible后台服务" + }, + { + "name": "form_description", + "value": "audible辅助应用" + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/resources/base/media/icon.png b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/resources/base/media/icon.png differ diff --git a/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/resources/base/profile/accessibility_config.json b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/resources/base/profile/accessibility_config.json new file mode 100644 index 0000000000000000000000000000000000000000..8151c7d393b92ece5d6f07c71b7fb99b345c609a --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/resources/base/profile/accessibility_config.json @@ -0,0 +1,11 @@ +{ + "accessibilityCapabilities": [ + "retrieve", + "touchGuide", + "keyEventObserver", + "gesture" + ], + "accessibilityAbilityTypes": ["audible"], + "accessibilityCapabilityRationale": "a11y_rationale", + "settingsAbility": "com.example.myapplication.accessibilitySetting" +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/resources/base/profile/form_config.json b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/resources/base/profile/form_config.json new file mode 100644 index 0000000000000000000000000000000000000000..ba3489dd5c6ee9435d07201193fcb137e3ad083e --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/resources/base/profile/form_config.json @@ -0,0 +1,24 @@ +{ + "forms": [ + { + "name": "Form_Js", + "description": "$string:form_description", + "src": "pages/card/index", + "window": { + "designWidth": 720, + "autoDesignWidth": true + }, + "colorMode": "auto", + "formConfigAbility": "ability://xxxxx", + "formVisibleNotify": false, + "isDefault": true, + "updateEnabled": true, + "scheduledUpdateTime": "10:30", + "updateDuration": 1, + "defaultDimension": "2*2", + "supportDimensions": [ + "2*2" + ] + } + ] +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/resources/base/profile/main_pages.json b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..c1858c216308ad312862a877139a8ba6908ec3c6 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/index" + ] +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/signature/openharmony_sx.p7b b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..7ffcdc78527c5c1aa24520ab7e913c5f47c703f0 Binary files /dev/null and b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/signature/openharmony_sx.p7b differ diff --git a/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/AppScope/app.json b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..65cc983e91379165abea8959b770b8c97860eb1e --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.accessiblegenericability.hmservice", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive": true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/AppScope/resources/base/element/string.json b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..74b4363b3be83d1eb1dc3111775f32169670fb5a --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AccessibleGenericAbility" + } + ] +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/AppScope/resources/base/media/app_icon.png b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/AppScope/resources/base/media/app_icon.png differ diff --git a/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/BUILD.gn b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..5228324be0ae5fdae2945468db3853120b7d2490 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/BUILD.gn @@ -0,0 +1,43 @@ +# 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_hap_assist_suite("accessibilityGenericAbility") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":accessible_js_assets", + ":accessible_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "accessibilityGenericAbility" + subsystem_name = "barrierfree" + part_name = "accessibility" +} + +ohos_app_scope("accessible_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("accessible_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("accessible_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":accessible_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/Test.json b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..b9f4122fbf466755fe279be1082dcf138af90789 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests", +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/ets/Application/AbilityStage.ts b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..14b999a57dcdb13c5d435888ab8623ce5d1df2b7 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[AccessibleGenericAbility] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/ets/MainAbility/MainAbility.ts b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..faa3d8f6238f2e09036f5dbf4433a1e4c84c8a72 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[AccessibleGenericAbility] MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[AccessibleGenericAbility] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[AccessibleGenericAbility] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "MainAbility/pages/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[AccessibleGenericAbility] MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[AccessibleGenericAbility] MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[AccessibleGenericAbility] MainAbility onBackground") + } +}; diff --git a/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/ets/MainAbility/pages/index.ets b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..c4c382cf18941ac82d25ab571ebb3879b0f82811 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,32 @@ +/* + * 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. + */ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + 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/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..c8eb280227366ba3cea571269ba82f8f4fd2bede --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts @@ -0,0 +1,37 @@ +/* + * 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' + +const LOG_PREFIX = '[CQH-GENERIC-ABILITY-ACCESSIBLE]' +class ServiceExtAbility extends AccessibilityExtensionAbility { + onConnect() { + console.info(LOG_PREFIX + " onConnect") + let context = this.context + context.setTargetBundleName(['com.example.abilitylisttest', 'com.example.manualcase']) + } + onDisconnect() { + console.info(LOG_PREFIX + " onDisconnect"); + } + onAccessibilityEvent(accessibilityEvent) { + console.info(LOG_PREFIX + " accessibilityEvent : " + JSON.stringify(accessibilityEvent)); + } + onKeyEvent(keyEvent) { + console.info(LOG_PREFIX + " keyEvent : " + JSON.stringify(keyEvent)); + return true + } +} + +export default ServiceExtAbility \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/module.json b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..e1ebc13b62e7ac9ecf8d1c22aecac1450ad329c0 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/module.json @@ -0,0 +1,63 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": true, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "com.example.accessiblegesturesimulation.hmservice.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "srcEntrance": "./ets/ServiceExtAbility/ServiceExtAbility.ts", + "name": "ServiceExtAbility", + "icon": "$media:icon", + "description": "$string:description_serviceability", + "type": "accessibility", + "visible": true, + "metadata": [ + { + "name": "ohos.accessibleability", + "resource": "$profile:accessibility_config" + } + ] + } + ], + "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/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/resources/base/element/string.json b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..4287e9d5ccc478c3dce8c3b46f44ac39acb6522f --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "generic辅助应用" + }, + { + "name": "description_serviceability", + "value": "generic后台服务" + }, + { + "name": "form_description", + "value": "generic辅助应用" + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/resources/base/media/icon.png b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/resources/base/media/icon.png differ diff --git a/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/resources/base/profile/accessibility_config.json b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/resources/base/profile/accessibility_config.json new file mode 100644 index 0000000000000000000000000000000000000000..586720cff93a82d99ef081c9055cd4c2451fd5fc --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/resources/base/profile/accessibility_config.json @@ -0,0 +1,11 @@ +{ + "accessibilityCapabilities": [ + "retrieve", + "touchGuide", + "keyEventObserver", + "gesture" + ], + "accessibilityAbilityTypes": ["generic"], + "accessibilityCapabilityRationale": "a11y_rationale", + "settingsAbility": "com.example.myapplication.accessibilitySetting" +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/resources/base/profile/form_config.json b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/resources/base/profile/form_config.json new file mode 100644 index 0000000000000000000000000000000000000000..ba3489dd5c6ee9435d07201193fcb137e3ad083e --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/resources/base/profile/form_config.json @@ -0,0 +1,24 @@ +{ + "forms": [ + { + "name": "Form_Js", + "description": "$string:form_description", + "src": "pages/card/index", + "window": { + "designWidth": 720, + "autoDesignWidth": true + }, + "colorMode": "auto", + "formConfigAbility": "ability://xxxxx", + "formVisibleNotify": false, + "isDefault": true, + "updateEnabled": true, + "scheduledUpdateTime": "10:30", + "updateDuration": 1, + "defaultDimension": "2*2", + "supportDimensions": [ + "2*2" + ] + } + ] +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/resources/base/profile/main_pages.json b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..c1858c216308ad312862a877139a8ba6908ec3c6 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/index" + ] +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/signature/openharmony_sx.p7b b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..7ffcdc78527c5c1aa24520ab7e913c5f47c703f0 Binary files /dev/null and b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/signature/openharmony_sx.p7b differ diff --git a/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/AppScope/app.json b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..43bb9cae5eb94843fb319bcaf72c763cfeb35fe5 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.accessiblehapticability.hmservice", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive": true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/AppScope/resources/base/element/string.json b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..baaf37d061e7923297806c49bdb24755469eee16 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AccessibleHapticAbility" + } + ] +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/AppScope/resources/base/media/app_icon.png b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/AppScope/resources/base/media/app_icon.png differ diff --git a/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/BUILD.gn b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..66c19036e8ad61df9918ba04dcdcfd33ee47d530 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/BUILD.gn @@ -0,0 +1,43 @@ +# 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_hap_assist_suite("accessibilityHapticAbility") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":accessible_js_assets", + ":accessible_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "accessibilityHapticAbility" + subsystem_name = "barrierfree" + part_name = "accessibility" +} + +ohos_app_scope("accessible_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("accessible_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("accessible_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":accessible_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/Test.json b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..b9f4122fbf466755fe279be1082dcf138af90789 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests", +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/ets/Application/AbilityStage.ts b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..eb46727c442a4d2aec87bff72165107770fa9e9e --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[AccessibleHapticAbility] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/ets/MainAbility/MainAbility.ts b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..5a19cec0825e72325e4479f877bbff12ec83df06 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[AccessibleHapticAbility] MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[AccessibleHapticAbility] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[AccessibleHapticAbility] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "MainAbility/pages/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[AccessibleHapticAbility] MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[AccessibleHapticAbility] MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[AccessibleHapticAbility] MainAbility onBackground") + } +}; diff --git a/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/ets/MainAbility/pages/index.ets b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..c4c382cf18941ac82d25ab571ebb3879b0f82811 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,32 @@ +/* + * 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. + */ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + 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/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..0562ddaeb7f7f3cf5e47502bf37adf1eee8e5be1 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts @@ -0,0 +1,38 @@ +/* + * 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' + + +const LOG_PREFIX = '[CQH-HAPTIC-ABILITY-ACCESSIBLE]' +class ServiceExtAbility extends AccessibilityExtensionAbility { + onConnect() { + console.info(LOG_PREFIX + " onConnect") + let context = this.context + context.setTargetBundleName(['com.example.abilitylisttest', 'com.example.manualcase']) + } + onDisconnect() { + console.info(LOG_PREFIX + " onDisconnect") + } + onAccessibilityEvent(accessibilityEvent) { + console.info(LOG_PREFIX + " accessibilityEvent : " + JSON.stringify(accessibilityEvent)) + } + onKeyEvent(keyEvent) { + console.info(LOG_PREFIX + " keyEvent : " + JSON.stringify(keyEvent)); + return true + } +} + +export default ServiceExtAbility \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/module.json b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..dfcff52c314427dafbfdb8c04768a0c1e33446e3 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/module.json @@ -0,0 +1,63 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": true, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "com.example.accessiblehapticability.hmservice.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "srcEntrance": "./ets/ServiceExtAbility/ServiceExtAbility.ts", + "name": "ServiceExtAbility", + "icon": "$media:icon", + "description": "$string:description_serviceability", + "type": "accessibility", + "visible": true, + "metadata": [ + { + "name": "ohos.accessibleability", + "resource": "$profile:accessibility_config" + } + ] + } + ], + "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/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/resources/base/element/string.json b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..265991740a0ca444a8bad839d4d2411958f95bca --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "haptic辅助应用" + }, + { + "name": "description_serviceability", + "value": "haptic后台服务" + }, + { + "name": "form_description", + "value": "haptic辅助应用" + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/resources/base/media/icon.png b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/resources/base/media/icon.png differ diff --git a/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/resources/base/profile/accessibility_config.json b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/resources/base/profile/accessibility_config.json new file mode 100644 index 0000000000000000000000000000000000000000..e02d33c515eba85c77d6d8b65b052f4374165aaa --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/resources/base/profile/accessibility_config.json @@ -0,0 +1,11 @@ +{ + "accessibilityCapabilities": [ + "retrieve", + "touchGuide", + "keyEventObserver", + "gesture" + ], + "accessibilityAbilityTypes": ["haptic"], + "accessibilityCapabilityRationale": "a11y_rationale", + "settingsAbility": "com.example.myapplication.accessibilitySetting" +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/resources/base/profile/form_config.json b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/resources/base/profile/form_config.json new file mode 100644 index 0000000000000000000000000000000000000000..ba3489dd5c6ee9435d07201193fcb137e3ad083e --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/resources/base/profile/form_config.json @@ -0,0 +1,24 @@ +{ + "forms": [ + { + "name": "Form_Js", + "description": "$string:form_description", + "src": "pages/card/index", + "window": { + "designWidth": 720, + "autoDesignWidth": true + }, + "colorMode": "auto", + "formConfigAbility": "ability://xxxxx", + "formVisibleNotify": false, + "isDefault": true, + "updateEnabled": true, + "scheduledUpdateTime": "10:30", + "updateDuration": 1, + "defaultDimension": "2*2", + "supportDimensions": [ + "2*2" + ] + } + ] +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/resources/base/profile/main_pages.json b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..c1858c216308ad312862a877139a8ba6908ec3c6 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/index" + ] +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/signature/openharmony_sx.p7b b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..7ffcdc78527c5c1aa24520ab7e913c5f47c703f0 Binary files /dev/null and b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/signature/openharmony_sx.p7b differ diff --git a/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/AppScope/app.json b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..ec6887eb9a5358089d6c52ca743e6ae775fbce07 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.accessiblespokenability.hmservice", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive": true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/AppScope/resources/base/element/string.json b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..a4f2bd581747e390a6e52e0b8ee803060508c047 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AccessibleSpokenAbility" + } + ] +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/AppScope/resources/base/media/app_icon.png b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/AppScope/resources/base/media/app_icon.png differ diff --git a/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/BUILD.gn b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..99dd49114513c6a55399ed7dd2e68dc9dca35321 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/BUILD.gn @@ -0,0 +1,43 @@ +# 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_hap_assist_suite("accessibilitySpokenAbility") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":accessible_js_assets", + ":accessible_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "accessibilitySpokenAbility" + subsystem_name = "barrierfree" + part_name = "accessibility" +} + +ohos_app_scope("accessible_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("accessible_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("accessible_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":accessible_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/Test.json b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..b9f4122fbf466755fe279be1082dcf138af90789 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests", +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/ets/Application/AbilityStage.ts b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..b57816d1c23bfd8a2769b3f46bd17b2fb41bbb68 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[AccessibleSpokenAbility] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/ets/MainAbility/MainAbility.ts b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..a28eed3fa6e465181949446d1b091f9f3cfefefc --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[AccessibleSpokenAbility] MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[AccessibleSpokenAbility] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[AccessibleSpokenAbility] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "MainAbility/pages/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[AccessibleSpokenAbility] MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[AccessibleSpokenAbility] MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[AccessibleSpokenAbility] MainAbility onBackground") + } +}; diff --git a/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/ets/MainAbility/pages/index.ets b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..c4c382cf18941ac82d25ab571ebb3879b0f82811 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,32 @@ +/* + * 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. + */ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + 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/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..f21b462e8e743088fd684fda85171a191cbb42e6 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts @@ -0,0 +1,37 @@ +/* + * 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' + + +const LOG_PREFIX = '[CQH-SPOKEN-ABILITY-ACCESSIBLE]' +class ServiceExtAbility extends AccessibilityExtensionAbility { + onConnect() { + console.info(LOG_PREFIX + " onConnect") + } + onDisconnect() { + console.info(LOG_PREFIX + " onDisconnect") + } + onAccessibilityEvent(accessibilityEvent) { + console.info(LOG_PREFIX + " accessibilityEvent : " + JSON.stringify(accessibilityEvent)) + } + onKeyEvent(keyEvent) { + console.info(LOG_PREFIX + " keyEvent : " + JSON.stringify(keyEvent)) + return true + } +} + +export default ServiceExtAbility \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/module.json b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..52e9f82ef40219fbbfa0bbacb34651095a8464ff --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/module.json @@ -0,0 +1,63 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": true, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "com.example.accessiblespokenability.hmservice.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "srcEntrance": "./ets/ServiceExtAbility/ServiceExtAbility.ts", + "name": "ServiceExtAbility", + "icon": "$media:icon", + "description": "$string:description_serviceability", + "type": "accessibility", + "visible": true, + "metadata": [ + { + "name": "ohos.accessibleability", + "resource": "$profile:accessibility_config" + } + ] + } + ], + "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/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/resources/base/element/string.json b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ec4966b7c16117811826ccb46918ad6969f5f329 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "spoken辅助应用" + }, + { + "name": "description_serviceability", + "value": "spoken后台服务" + }, + { + "name": "form_description", + "value": "spoken辅助应用" + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/resources/base/media/icon.png b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/resources/base/media/icon.png differ diff --git a/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/resources/base/profile/accessibility_config.json b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/resources/base/profile/accessibility_config.json new file mode 100644 index 0000000000000000000000000000000000000000..a36e7870744f8fbbea4e2d6b9df0bf0deb08f4e1 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/resources/base/profile/accessibility_config.json @@ -0,0 +1,11 @@ +{ + "accessibilityCapabilities": [ + "retrieve", + "touchGuide", + "keyEventObserver", + "gesture" + ], + "accessibilityAbilityTypes": ["spoken"], + "accessibilityCapabilityRationale": "a11y_rationale", + "settingsAbility": "com.example.myapplication.accessibilitySetting" +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/resources/base/profile/form_config.json b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/resources/base/profile/form_config.json new file mode 100644 index 0000000000000000000000000000000000000000..ba3489dd5c6ee9435d07201193fcb137e3ad083e --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/resources/base/profile/form_config.json @@ -0,0 +1,24 @@ +{ + "forms": [ + { + "name": "Form_Js", + "description": "$string:form_description", + "src": "pages/card/index", + "window": { + "designWidth": 720, + "autoDesignWidth": true + }, + "colorMode": "auto", + "formConfigAbility": "ability://xxxxx", + "formVisibleNotify": false, + "isDefault": true, + "updateEnabled": true, + "scheduledUpdateTime": "10:30", + "updateDuration": 1, + "defaultDimension": "2*2", + "supportDimensions": [ + "2*2" + ] + } + ] +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/resources/base/profile/main_pages.json b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..c1858c216308ad312862a877139a8ba6908ec3c6 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/index" + ] +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/signature/openharmony_sx.p7b b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..7ffcdc78527c5c1aa24520ab7e913c5f47c703f0 Binary files /dev/null and b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/signature/openharmony_sx.p7b differ diff --git a/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/AppScope/app.json b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..68d4327cfefa721d895bb2cb08ef43fbd34b7dc3 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.accessiblevisualability.hmservice", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive": true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/AppScope/resources/base/element/string.json b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..2b6d6217cb2ab209b6af27e1f23add5aa6cca758 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AccessibleVisualAbility" + } + ] +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/AppScope/resources/base/media/app_icon.png b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/AppScope/resources/base/media/app_icon.png differ diff --git a/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/BUILD.gn b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..be60016fdd8fedb3d6e4460ede3b6da7405f9719 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/BUILD.gn @@ -0,0 +1,43 @@ +# 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_hap_assist_suite("accessibilityVisualAbility") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":accessible_js_assets", + ":accessible_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "accessibilityVisualAbility" + subsystem_name = "barrierfree" + part_name = "accessibility" +} + +ohos_app_scope("accessible_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("accessible_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("accessible_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":accessible_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/Test.json b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..b9f4122fbf466755fe279be1082dcf138af90789 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests", +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/ets/Application/AbilityStage.ts b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..36f6b6d60dc194aa60bb64abdbfb4686e3d6663b --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[AccessibleVisualAbility] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/ets/MainAbility/MainAbility.ts b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..9f7a954299536d8e5b4a74dd9b18b38ae7569273 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[AccessibleVisualAbility] MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[AccessibleVisualAbility] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[AccessibleVisualAbility] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "MainAbility/pages/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[AccessibleVisualAbility] MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[AccessibleVisualAbility] MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[AccessibleVisualAbility] MainAbility onBackground") + } +}; diff --git a/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/ets/MainAbility/pages/index.ets b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..c4c382cf18941ac82d25ab571ebb3879b0f82811 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,32 @@ +/* + * 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. + */ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + 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/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..3787fced051fb57a59767f1349dd4c1c24988e64 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts @@ -0,0 +1,37 @@ +/* + * 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' + + +const LOG_PREFIX = '[CQH-VISUAL-ABILITY-ACCESSIBLE]' +class ServiceExtAbility extends AccessibilityExtensionAbility { + onConnect() { + console.info(LOG_PREFIX + " onConnect") + } + onDisconnect() { + console.info(LOG_PREFIX + " onDisconnect") + } + onAccessibilityEvent(accessibilityEvent) { + console.info(LOG_PREFIX + " accessibilityEvent : " + JSON.stringify(accessibilityEvent)) + } + onKeyEvent(keyEvent) { + console.info(LOG_PREFIX + " keyEvent : " + JSON.stringify(keyEvent)) + return true + } +} + +export default ServiceExtAbility \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/module.json b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..8968e584ff870143ecf4b841adbf8145d80453e8 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/module.json @@ -0,0 +1,63 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": true, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "com.example.accessiblevisualability.hmservice.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "srcEntrance": "./ets/ServiceExtAbility/ServiceExtAbility.ts", + "name": "ServiceExtAbility", + "icon": "$media:icon", + "description": "$string:description_serviceability", + "type": "accessibility", + "visible": true, + "metadata": [ + { + "name": "ohos.accessibleability", + "resource": "$profile:accessibility_config" + } + ] + } + ], + "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/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/resources/base/element/string.json b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..97595607d0f714fb496802bbba19e4c98c5e4702 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "visual辅助应用" + }, + { + "name": "description_serviceability", + "value": "visual后台服务" + }, + { + "name": "form_description", + "value": "visual辅助应用" + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/resources/base/media/icon.png b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/resources/base/media/icon.png differ diff --git a/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/resources/base/profile/accessibility_config.json b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/resources/base/profile/accessibility_config.json new file mode 100644 index 0000000000000000000000000000000000000000..513f5644b437cf7fe677a13597213ec833351808 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/resources/base/profile/accessibility_config.json @@ -0,0 +1,11 @@ +{ + "accessibilityCapabilities": [ + "retrieve", + "touchGuide", + "keyEventObserver", + "gesture" + ], + "accessibilityAbilityTypes": ["visual"], + "accessibilityCapabilityRationale": "a11y_rationale", + "settingsAbility": "com.example.myapplication.accessibilitySetting" +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/resources/base/profile/form_config.json b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/resources/base/profile/form_config.json new file mode 100644 index 0000000000000000000000000000000000000000..ba3489dd5c6ee9435d07201193fcb137e3ad083e --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/resources/base/profile/form_config.json @@ -0,0 +1,24 @@ +{ + "forms": [ + { + "name": "Form_Js", + "description": "$string:form_description", + "src": "pages/card/index", + "window": { + "designWidth": 720, + "autoDesignWidth": true + }, + "colorMode": "auto", + "formConfigAbility": "ability://xxxxx", + "formVisibleNotify": false, + "isDefault": true, + "updateEnabled": true, + "scheduledUpdateTime": "10:30", + "updateDuration": 1, + "defaultDimension": "2*2", + "supportDimensions": [ + "2*2" + ] + } + ] +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/resources/base/profile/main_pages.json b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..c1858c216308ad312862a877139a8ba6908ec3c6 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/index" + ] +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/signature/openharmony_sx.p7b b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..7ffcdc78527c5c1aa24520ab7e913c5f47c703f0 Binary files /dev/null and b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/signature/openharmony_sx.p7b differ