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

添加API属性覆盖

Signed-off-by: Mupceet's avatarMupceet <mupceet@gmail.com>
上级 7e910007
...@@ -28,6 +28,7 @@ group("barrierfree") { ...@@ -28,6 +28,7 @@ group("barrierfree") {
"accessiblecheckability:ActsAccessibleCheckAbilityTest", "accessiblecheckability:ActsAccessibleCheckAbilityTest",
"accessibleregisterstate:ActsAccessibleRegisterStateTest", "accessibleregisterstate:ActsAccessibleRegisterStateTest",
"accessiblesendevent:ActsAccessibleSendEventTest", "accessiblesendevent:ActsAccessibleSendEventTest",
"accessibletest:actsaccessibletest",
"targetProject/aceTest:aceTest", "targetProject/aceTest:aceTest",
] ]
} }
......
# 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",
]
}
}
{
"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
}
}
}
{
"string": [
{
"name": "app_name",
"value": "AbilityListTest"
}
]
}
# 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"
}
{
"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"
]
}
]
}
/*
* 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
/*
* 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")
}
};
/*
* 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
})
}
}
}
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
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
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
/*
* 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])
}
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import abilityTest from './Ability.test'
export default function testsuite() {
abilityTest()
}
\ No newline at end of file
{
"module": {
"name": "phone",
"type": "entry",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:entry_desc",
"mainElement": "MainAbility",
"deviceTypes": [
"phone",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"uiSyntax": "ets",
"abilities": [
{
"name": "com.example.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
{
"string": [
{
"name": "entry_desc",
"value": "AbilityListTest entry"
},
{
"name": "MainAbility_desc",
"value": "AbilityListTest MainAbility"
},
{
"name": "MainAbility_label",
"value": "AbilityList"
}
]
}
\ No newline at end of file
{
"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
}
}
}
{
"string": [
{
"name": "app_name",
"value": "MyApplicationXtsD"
},
{
"name": "description_application",
"value": "MyApplicationXtsD"
}
]
}
# 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"
}
{
"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"
]
}
]
}
/*
* 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
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
import Ability from '@ohos.application.Ability'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
// Ability is creating, initialize resources for this ability
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
onDestroy() {
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
globalThis.windowStage = windowStage
globalThis.abilityContext = this.context
windowStage.setUIContent(this.context, "MainAbility/pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file';
import 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%')
}
}
/*
* 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
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
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
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
/*
* 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);
});
})
}
/*
* 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
{
"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
{
"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
{
"accessibilityCapabilities": [
"retrieve",
"keyEventObserver",
"gesture",
"touchGuide"
],
"accessibilityCapabilityRationale": "a11y_rationale",
"settingsAbility": "com.example.myapplication.accessibilitySetting"
}
\ No newline at end of file
{
"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
}
}
}
# 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"
}
{
"description": "Configuration for hjunit demo Tests",
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[AccessibleAudibleAbility] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
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")
}
};
/*
* 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
/*
* 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
{
"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
{
"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
{
"accessibilityCapabilities": [
"retrieve",
"touchGuide",
"keyEventObserver",
"gesture"
],
"accessibilityAbilityTypes": ["audible"],
"accessibilityCapabilityRationale": "a11y_rationale",
"settingsAbility": "com.example.myapplication.accessibilitySetting"
}
\ No newline at end of file
{
"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"
]
}
]
}
{
"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
}
}
}
# 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"
}
{
"description": "Configuration for hjunit demo Tests",
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[AccessibleGenericAbility] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
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")
}
};
/*
* 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
/*
* 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
{
"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
{
"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
{
"accessibilityCapabilities": [
"retrieve",
"touchGuide",
"keyEventObserver",
"gesture"
],
"accessibilityAbilityTypes": ["generic"],
"accessibilityCapabilityRationale": "a11y_rationale",
"settingsAbility": "com.example.myapplication.accessibilitySetting"
}
\ No newline at end of file
{
"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"
]
}
]
}
{
"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
}
}
}
# 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"
}
{
"description": "Configuration for hjunit demo Tests",
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[AccessibleHapticAbility] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
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")
}
};
/*
* 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
/*
* 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
{
"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
{
"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
{
"accessibilityCapabilities": [
"retrieve",
"touchGuide",
"keyEventObserver",
"gesture"
],
"accessibilityAbilityTypes": ["haptic"],
"accessibilityCapabilityRationale": "a11y_rationale",
"settingsAbility": "com.example.myapplication.accessibilitySetting"
}
\ No newline at end of file
{
"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"
]
}
]
}
{
"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
}
}
}
# 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"
}
{
"description": "Configuration for hjunit demo Tests",
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[AccessibleSpokenAbility] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
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")
}
};
/*
* 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
/*
* 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
{
"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
{
"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
{
"accessibilityCapabilities": [
"retrieve",
"touchGuide",
"keyEventObserver",
"gesture"
],
"accessibilityAbilityTypes": ["spoken"],
"accessibilityCapabilityRationale": "a11y_rationale",
"settingsAbility": "com.example.myapplication.accessibilitySetting"
}
\ No newline at end of file
{
"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"
]
}
]
}
{
"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
}
}
}
# 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"
}
{
"description": "Configuration for hjunit demo Tests",
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[AccessibleVisualAbility] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
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")
}
};
/*
* 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
/*
* 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
{
"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
{
"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
{
"accessibilityCapabilities": [
"retrieve",
"touchGuide",
"keyEventObserver",
"gesture"
],
"accessibilityAbilityTypes": ["visual"],
"accessibilityCapabilityRationale": "a11y_rationale",
"settingsAbility": "com.example.myapplication.accessibilitySetting"
}
\ No newline at end of file
{
"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"
]
}
]
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册