提交 c0fd9549 编写于 作者: Y yichengzhao

add xts for barrierfree

Signed-off-by: Nyichengzhao <yichengzhao1@huawei.com>
Change-Id: I606ba4dc1a50971955d5520e65e77c8255f77264
上级 fe048817
# 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("barrierfree") {
testonly = true
if (is_standard_system) {
deps = [
"accessibleabilitylist:AccessibleAbilityList",
"accessiblecaptionconfiguration:AccessibleCaptionConfiguration",
"accessiblecheckability:AccessibleCheckAbility",
"accessibleregisterstate:AccessibleRegisterState",
"accessiblesendevent:AccessibleSendEvent",
]
}
}
# 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("AccessibleAbilityList") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "AccessibleAbilityList"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "180000",
"package": "com.example.accessibleabilitylist",
"shell-timeout": "180000"
},
"kits": [
{
"test-file-name": [
"AccessibleAbilityList.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.accessibleabilitylist",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.accessibleabilitylist",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"defPermissions": [
{
"availableScope": [],
"grantMode": "system_grant",
"name": "ohos.permission.DISTRIBUTED_DATASYNC"
}
],
"reqPermissions": [
{
"name": "ohos.permission.DISTRIBUTED_DATASYNC",
"reason": "ceshi"
}
],
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.accessibleabilitylist.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"visible": true,
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* 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.
*/
export default {
onCreate() {
console.info('AccessibilityApplication onCreate');
},
onDestroy() {
console.info('AccessibilityApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
{{title}}
</text>
</div>
/*
* 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 file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: "Accessbility js test"
},
onInit() {
this.title = "Accessbility js test";
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "ActsSetCheckSyncEnable"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
/*
* 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import accessibility from '@ohos.accessibility'
const abilityType = 'all';
const abilityState = 'install';
describe('AccessibleAbilityList', function () {
beforeAll(async function (done) {
console.info(`AccessibleAbilityList: beforeAll starts`);
setTimeout(done, 30000);
})
beforeEach(async function (done) {
console.info(`AccessibleAbilityList: beforeEach starts`);
done();
})
afterEach(async function (done) {
console.info(`AccessibleAbilityList: afterEach starts`);
setTimeout(done, 1000);
})
/******************************************************************************** */
/* Cases AbilityList_0210-0300 are for accessibility.getAbilityLists() API test */
/******************************************************************************** */
/*
* @tc.number AbilityList_0210
* @tc.name AbilityList_0210
* @tc.desc The parameters input are 'audible' and 'enable', test the getAbilityLists() function,
* and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityList_0210', 0, async function (done) {
console.info('AbilityList_0210');
let abilityType = 'audible';
let abilityState = 'enable';
accessibility.getAbilityLists(abilityType, abilityState, (err, data) => {
if (err.code != 0) {
console.error(`AccessibleAbilityList: AbilityList_0210 has error: ${err.code}`);
expect(null).assertFail();
done();
}
console.info(`AccessibleAbilityList: AbilityList_0210 result ${data.length}`);
expect(Array.isArray(data)).assertEqual(true);
done();
});
})
/*
* @tc.number AbilityList_0220
* @tc.name AbilityList_0220
* @tc.desc The parameters input are 'audible' and '', test the getAbilityLists() function,
* and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityList_0220', 0, async function (done) {
console.info('AbilityList_0220');
let abilityType = 'audible';
let abilityState = '';
accessibility.getAbilityLists(abilityType, abilityState, (err, data) => {
if (err.code != 0) {
console.error(`AccessibleAbilityList: AbilityList_0220 has error: ${err.code}`);
expect(null).assertFail();
done();
}
console.info(`AccessibleAbilityList: AbilityList_0220 result ${data.length}`);
expect(Array.isArray(data)).assertEqual(true);
done();
});
})
/*
* @tc.number AbilityList_0230
* @tc.name AbilityList_0230
* @tc.desc The parameters input are 'audible' and null, test the getAbilityLists() function,
* and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityList_0230', 0, async function (done) {
console.info('AbilityList_0230');
let abilityType = 'audible';
let abilityState = null;
accessibility.getAbilityLists(abilityType, abilityState, (err, data) => {
if (err.code != 0) {
console.error(`AccessibleAbilityList: AbilityList_0230 has error: ${err.code}`);
expect(null).assertFail();
done();
}
console.info(`AccessibleAbilityList: AbilityList_0230 result ${data.length}`);
expect(Array.isArray(data)).assertEqual(true);
done();
});
})
/*
* @tc.number AbilityList_0240
* @tc.name AbilityList_0240
* @tc.desc The parameters input are '' and 'enable', test the getAbilityLists() function,
* and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityList_0240', 0, async function (done) {
console.info('AbilityList_0240');
let abilityType = '';
let abilityState = 'enable';
accessibility.getAbilityLists(abilityType, abilityState, (err, data) => {
if (err.code != 0) {
console.error(`AccessibleAbilityList: AbilityList_0240 has error: ${err.code}`);
expect(null).assertFail();
done();
}
console.info(`AccessibleAbilityList: AbilityList_0240 result ${data.length}`);
expect(Array.isArray(data)).assertEqual(true);
done();
});
})
/*
* @tc.number AbilityList_0250
* @tc.name AbilityList_0250
* @tc.desc The parameters input are null and 'enable', test the getAbilityLists() function,
* and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityList_0250', 0, async function (done) {
console.info('AbilityList_0250');
let abilityType = null;
let abilityState = 'enable';
accessibility.getAbilityLists(abilityType, abilityState, (err, data) => {
if (err.code != 0) {
console.error(`AccessibleAbilityList: AbilityList_0250 has error: ${err.code}`);
expect(null).assertFail();
done();
}
console.info(`AccessibleAbilityList: AbilityList_0250 result ${data.length}`);
expect(Array.isArray(data)).assertEqual(true);
done();
});
})
/*
* @tc.number AbilityList_0260
* @tc.name AbilityList_0260
* @tc.desc The parameters input are 'audible' and 'enable', test the getAbilityLists() function,
* and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityList_0260', 0, async function (done) {
console.info('AbilityList_0260');
let abilityType = 'audible';
let abilityState = 'enable';
accessibility.getAbilityLists(abilityType, abilityState).then((result) => {
console.info(`AccessibleAbilityList: AbilityList_0260 result ${result.length}`);
expect(Array.isArray(result)).assertEqual(true);
done();
}).catch((err) => {
console.error(`AccessibleAbilityList: AbilityList_0260 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number AbilityList_0270
* @tc.name AbilityList_0270
* @tc.desc The parameters input are 'audible' and '', test the getAbilityLists() function,
* and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityList_0270', 0, async function (done) {
console.info('AbilityList_0270');
let abilityType = 'audible';
let abilityState = '';
accessibility.getAbilityLists(abilityType, abilityState).then((result) => {
console.info(`AccessibleAbilityList: AbilityList_0270 result ${result.length}`);
expect(Array.isArray(result)).assertEqual(true);
done();
}).catch((err) => {
console.error(`AccessibleAbilityList: AbilityList_0270 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number AbilityList_0280
* @tc.name AbilityList_0280
* @tc.desc The parameters input are 'audible' and null, test the getAbilityLists() function,
* and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityList_0280', 0, async function (done) {
console.info('AbilityList_0280');
let abilityType = 'audible';
let abilityState = null;
accessibility.getAbilityLists(abilityType, abilityState).then((result) => {
console.info(`AccessibleAbilityList: AbilityList_0280 result ${result.length}`);
expect(Array.isArray(result)).assertEqual(true);
done();
}).catch((err) => {
console.error(`AccessibleAbilityList: AbilityList_0280 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number AbilityList_0290
* @tc.name AbilityList_0290
* @tc.desc The parameters input are '' and 'enable', test the getAbilityLists() function,
* and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityList_0290', 0, async function (done) {
console.info('AbilityList_0290');
let abilityType = '';
let abilityState = 'enable';
accessibility.getAbilityLists(abilityType, abilityState).then((result) => {
console.info(`AccessibleAbilityList: AbilityList_0290 result ${result.length}`);
expect(Array.isArray(result)).assertEqual(true);
done();
}).catch((err) => {
console.error(`AccessibleAbilityList: AbilityList_0290 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number AbilityList_0300
* @tc.name AbilityList_0300
* @tc.desc The parameters input are null and 'enable', test the getAbilityLists() function,
* and the output is the list of AccessibilityAbilityInfo
* @tc.size SmallTest
* @tc.type User
*/
it('AbilityList_0300', 0, async function (done) {
console.info('AbilityList_0300');
let abilityType = null;
let abilityState = 'enable';
accessibility.getAbilityLists(abilityType, abilityState).then((result) => {
console.info(`AccessibleAbilityList: AbilityList_0300 result ${result.length}`);
expect(Array.isArray(result)).assertEqual(true);
done();
}).catch((err) => {
console.error(`AccessibleAbilityList: AbilityList_0300 has error: ${err}`);
expect(null).assertFail();
done();
});
})
})
/*
* 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.
*/
require('./AccessibleAbilityList.test.js')
\ No newline at end of file
# 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("AccessibleCaptionConfiguration") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "AccessibleCaptionConfiguration"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "180000",
"package": "com.example.accessiblecaptionconfiguration",
"shell-timeout": "180000"
},
"kits": [
{
"test-file-name": [
"AccessibleCaptionConfiguration.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.accessiblecaptionconfiguration",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.accessiblecaptionconfiguration",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"defPermissions": [
{
"availableScope": [],
"grantMode": "system_grant",
"name": "ohos.permission.DISTRIBUTED_DATASYNC"
}
],
"reqPermissions": [
{
"name": "ohos.permission.DISTRIBUTED_DATASYNC",
"reason": "ceshi"
}
],
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.accessiblecaptionconfiguration.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"visible": true,
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* 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.
*/
export default {
onCreate() {
console.info('AccessibilityApplication onCreate');
},
onDestroy() {
console.info('AccessibilityApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
{{title}}
</text>
</div>
/*
* 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 file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: "Accessbility js test"
},
onInit() {
this.title = "Accessbility js test";
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "ActsSetCheckSyncEnable"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
/*
* 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import accessibility from '@ohos.accessibility'
//import accessibility from '@ohos.application.AccessibilityExtension'
describe('AccessibleCaptionConfiguration', function () {
beforeEach(async function (done) {
console.info(`AccessibleCaptionConfiguration: beforeEach starts`);
let captionManager = accessibility.getCaptionsManager();
captionManager.off("enableChange");
captionManager.off("styleChange");
done();
})
afterEach(async function (done) {
console.info(`AccessibleCaptionConfiguration: afterEach starts`);
let captionManager = accessibility.getCaptionsManager();
captionManager.off("enableChange");
captionManager.off("styleChange");
setTimeout(done, 1000);
})
var CaptionsStyle = {
fontFamily: "default",
fontScale: 75,
fontColor: "blue",
fontEdgeType: "none",
backgroundColor: "green",
windowColor: "pink"
}
var StyleTest = {
fontFamily: "monospacedSerif",
fontScale: 99,
fontColor: "red",
fontEdgeType: "uniform",
backgroundColor: "pink",
windowColor: "green"
}
/*
* @tc.number CaptionConfiguration_0010
* @tc.name CaptionConfiguration_0010
* @tc.desc The parameter input is 'enableChange', test the captionManager.on() function,
* and return 'enable'
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0010', 0, async function (done) {
console.info('CaptionConfiguration_0010');
let captionManager = accessibility.getCaptionsManager();
captionManager.style = CaptionsStyle;
captionManager.enabled = true;
let stateEventType = 'enableChange';
captionManager.on(stateEventType, (data) => {
expect(data).assertEqual(false);
done();
});
captionManager.enabled = false;
})
/*
* @tc.number CaptionConfiguration_0011
* @tc.name CaptionConfiguration_0011
* @tc.desc The parameter input is 'enableChange', test the captionManager.on() function,
* and return 'enable'
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0011', 0, async function (done) {
console.info('CaptionConfiguration_0011');
let captionManager = accessibility.getCaptionsManager();
let stateEventType = 'enableChange';
captionManager.off(stateEventType);
captionManager.style = CaptionsStyle;
captionManager.enabled = false;
captionManager.on(stateEventType, (data) => {
expect(data).assertEqual(true);
done();
});
captionManager.enabled = true;
})
/*
* @tc.number CaptionConfiguration_0020
* @tc.name CaptionConfiguration_0020
* @tc.desc The parameter input is 'styleChange', test the captionManager.on() function,
* and return 'style'
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0020', 0, async function (done) {
console.info('CaptionConfiguration_0020');
let captionManager = accessibility.getCaptionsManager();
captionManager.style = CaptionsStyle;
let stateEventType = 'styleChange';
captionManager.on(stateEventType, (data) => {
expect(true).assertEqual(true);
done();
});
captionManager.style = StyleTest;
})
/*
* @tc.number CaptionConfiguration_0021
* @tc.name CaptionConfiguration_0021
* @tc.desc The parameter input is 'styleChange', test the captionManager.on() function,
* and return 'style'
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0021', 0, async function (done) {
console.info('CaptionConfiguration_0021');
let captionManager = accessibility.getCaptionsManager();
captionManager.style = CaptionsStyle;
let stateEventType = 'styleChange';
captionManager.on(stateEventType, (data) => {
expect(true).assertEqual(true);
done();
});
captionManager.style.fontFamily = "smallCapitals";
})
/*
* @tc.number CaptionConfiguration_0022
* @tc.name CaptionConfiguration_0022
* @tc.desc The parameter input is 'styleChange', test the captionManager.on() function,
* and return 'style'
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0022', 0, async function (done) {
console.info('CaptionConfiguration_0022');
let captionManager = accessibility.getCaptionsManager();
captionManager.style = CaptionsStyle;
let stateEventType = 'styleChange';
captionManager.on(stateEventType, (data) => {
expect(true).assertEqual(true);
done();
});
captionManager.style.fontScale = 99;
})
/*
* @tc.number CaptionConfiguration_0023
* @tc.name CaptionConfiguration_0023
* @tc.desc The parameter input is 'styleChange', test the captionManager.on() function,
* and return 'style'
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0023', 0, async function (done) {
console.info('CaptionConfiguration_0023');
let captionManager = accessibility.getCaptionsManager();
captionManager.style = CaptionsStyle;
let stateEventType = 'styleChange';
captionManager.on(stateEventType, (data) => {
expect(true).assertEqual(true);
done();
});
captionManager.style.fontColor = "TmepfontColor";
})
/*
* @tc.number CaptionConfiguration_0024
* @tc.name CaptionConfiguration_0024
* @tc.desc The parameter input is 'styleChange', test the captionManager.on() function,
* and return 'style'
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0024', 0, async function (done) {
console.info('CaptionConfiguration_0024');
let captionManager = accessibility.getCaptionsManager();
captionManager.style = CaptionsStyle;
let stateEventType = 'styleChange';
captionManager.on(stateEventType, (data) => {
expect(true).assertEqual(true);
done();
});
captionManager.style.fontEdgeType = "dropShadow";
})
/*
* @tc.number CaptionConfiguration_0025
* @tc.name CaptionConfiguration_0025
* @tc.desc The parameter input is 'styleChange', test the captionManager.on() function,
* and return 'style'
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0025', 0, async function (done) {
console.info('CaptionConfiguration_0025');
let captionManager = accessibility.getCaptionsManager();
captionManager.style = CaptionsStyle;
let stateEventType = 'styleChange';
captionManager.on(stateEventType, (data) => {
expect(true).assertEqual(true);
done();
});
captionManager.style.backgroundColor = "TmepbackgroundColor";
})
/*
* @tc.number CaptionConfiguration_0026
* @tc.name CaptionConfiguration_0026
* @tc.desc The parameter input is 'styleChange', test the captionManager.on() function,
* and return 'style'
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0026', 0, async function (done) {
console.info('CaptionConfiguration_0026');
let captionManager = accessibility.getCaptionsManager();
captionManager.style = CaptionsStyle;
let stateEventType = 'styleChange';
captionManager.on(stateEventType, (data) => {
expect(true).assertEqual(true);
done();
});
captionManager.style.windowColor = "TmepwindowColor";
})
/*
* @tc.number CaptionConfiguration_0032
* @tc.name CaptionConfiguration_0032
* @tc.desc The parameter input is 'enableChange', test the captionManager.off() function,
* and return true
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0032', 0, async function (done) {
console.info('CaptionConfiguration_0032');
let stateEventType = 'enableChange';
let captionManager = accessibility.getCaptionsManager();
captionManager.off(stateEventType);
captionManager.enabled = true;
captionManager.on(stateEventType, (data) => {
expect(true).assertEqual(true);
done();
});
captionManager.off("ERROR", (data) => {
expect(data).assertEqual(false);
done();
});
})
/*
* @tc.number CaptionConfiguration_0042
* @tc.name CaptionConfiguration_0042
* @tc.desc The parameter input is 'styleChange', test the captionManager.off() function,
* and return true
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0042', 0, async function (done) {
console.info('CaptionConfiguration_0042');
let stateEventType = 'styleChange';
let captionManager = accessibility.getCaptionsManager();
captionManager.off(stateEventType);
captionManager.on(stateEventType, (data) => {
});
captionManager.off("ERROR", (data) => {
expect(data).assertEqual(false);
done();
});
})
/*
* @tc.number CaptionConfiguration_0050
* @tc.name CaptionConfiguration_0050
* @tc.desc Test getCaptionsManager() function by modifying fontFamily.
* Return CaptionsManager.
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0050', 0, async function (done) {
console.info('CaptionConfiguration_0050');
let captionManager = accessibility.getCaptionsManager();
let fontFamily = "default";
captionManager.style.fontFamily = fontFamily;
let value = captionManager.style.fontFamily;
expect(value).assertEqual(fontFamily);
done();
})
/*
* @tc.number CaptionConfiguration_0051
* @tc.name CaptionConfiguration_0051
* @tc.desc Test getCaptionsManager() function by modifying fontFamily.
* Return CaptionsManager.
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0051', 0, async function (done) {
console.info('CaptionConfiguration_0051');
let captionManager = accessibility.getCaptionsManager();
let fontFamily = "monospacedSerif";
captionManager.style.fontFamily = fontFamily;
let value = captionManager.style.fontFamily;
expect(value).assertEqual(fontFamily);
done();
})
/*
* @tc.number CaptionConfiguration_0052
* @tc.name CaptionConfiguration_0052
* @tc.desc Test getCaptionsManager() function by modifying fontFamily.
* Return CaptionsManager.
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0052', 0, async function (done) {
console.info('CaptionConfiguration_0052');
let captionManager = accessibility.getCaptionsManager();
let fontFamily = "serif";
captionManager.style.fontFamily = fontFamily;
let value = captionManager.style.fontFamily;
expect(value).assertEqual(fontFamily);
done();
})
/*
* @tc.number CaptionConfiguration_0053
* @tc.name CaptionConfiguration_0053
* @tc.desc Test getCaptionsManager() function by modifying fontFamily.
* Return CaptionsManager.
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0053', 0, async function (done) {
console.info('CaptionConfiguration_0053');
let captionManager = accessibility.getCaptionsManager();
let fontFamily = "monospacedSansSerif";
captionManager.style.fontFamily = fontFamily;
let value = captionManager.style.fontFamily;
expect(value).assertEqual(fontFamily);
done();
})
/*
* @tc.number CaptionConfiguration_0054
* @tc.name CaptionConfiguration_0054
* @tc.desc Test getCaptionsManager() function by modifying fontFamily.
* Return CaptionsManager.
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0054', 0, async function (done) {
console.info('CaptionConfiguration_0054');
let captionManager = accessibility.getCaptionsManager();
let fontFamily = "sansSerif";
captionManager.style.fontFamily = fontFamily;
let value = captionManager.style.fontFamily;
expect(value).assertEqual(fontFamily);
done();
})
/*
* @tc.number CaptionConfiguration_0055
* @tc.name CaptionConfiguration_0055
* @tc.desc Test getCaptionsManager() function by modifying fontFamily.
* Return CaptionsManager.
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0055', 0, async function (done) {
console.info('CaptionConfiguration_0055');
let captionManager = accessibility.getCaptionsManager();
let fontFamily = "casual";
captionManager.style.fontFamily = fontFamily;
let value = captionManager.style.fontFamily;
expect(value).assertEqual(fontFamily);
done();
})
/*
* @tc.number CaptionConfiguration_0056
* @tc.name CaptionConfiguration_0056
* @tc.desc Test getCaptionsManager() function by modifying fontFamily.
* Return CaptionsManager.
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0056', 0, async function (done) {
console.info('CaptionConfiguration_0056');
let captionManager = accessibility.getCaptionsManager();
let fontFamily = "cursive";
captionManager.style.fontFamily = fontFamily;
let value = captionManager.style.fontFamily;
expect(value).assertEqual(fontFamily);
done();
})
/*
* @tc.number CaptionConfiguration_0057
* @tc.name CaptionConfiguration_0057
* @tc.desc Test getCaptionsManager() function by modifying fontFamily.
* Return CaptionsManager.
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0057', 0, async function (done) {
console.info('CaptionConfiguration_0057');
let captionManager = accessibility.getCaptionsManager();
let fontFamily = "smallCapitals";
captionManager.style.fontFamily = fontFamily;
let value = captionManager.style.fontFamily;
expect(value).assertEqual(fontFamily);
done();
})
/*
* @tc.number CaptionConfiguration_0058
* @tc.name CaptionConfiguration_0058
* @tc.desc Test getCaptionsManager() function by modifying fontFamily.
* Return CaptionsManager.
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0058', 0, async function (done) {
console.info('CaptionConfiguration_0058');
let captionManager = accessibility.getCaptionsManager();
let fontFamily = "none";
captionManager.style.fontFamily = fontFamily;
let value = captionManager.style.fontFamily;
expect(value).assertEqual(fontFamily);
done();
})
/*
* @tc.number CaptionConfiguration_0059
* @tc.name CaptionConfiguration_0059
* @tc.desc Test getCaptionsManager() function by modifying fontFamily.
* Return CaptionsManager.
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0059', 0, async function (done) {
console.info('CaptionConfiguration_0059');
let captionManager = accessibility.getCaptionsManager();
let fontFamily = "";
captionManager.style.fontFamily = fontFamily;
let value = captionManager.style.fontFamily;
expect(value).assertEqual(fontFamily);
done();
})
/*
* @tc.number CaptionConfiguration_0060
* @tc.name CaptionConfiguration_0060
* @tc.desc Test getCaptionsManager() function by modifying fontScale.
* Return CaptionsManager.
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0060', 0, async function (done) {
console.info('CaptionConfiguration_0060');
let captionManager = accessibility.getCaptionsManager();
let fontScale =9007199254740992;
captionManager.style.fontScale = fontScale;
let value = captionManager.style.fontScale;
expect(value).assertEqual(0);
done();
})
/*
* @tc.number CaptionConfiguration_0061
* @tc.name CaptionConfiguration_0061
* @tc.desc Test getCaptionsManager() function by modifying fontScale.
* Return CaptionsManager.
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0061', 0, async function (done) {
console.info('CaptionConfiguration_0061');
let captionManager = accessibility.getCaptionsManager();
let fontScale =0;
captionManager.style.fontScale = fontScale;
let value = captionManager.style.fontScale;
expect(value).assertEqual(fontScale);
done();
})
/*
* @tc.number CaptionConfiguration_0062
* @tc.name CaptionConfiguration_0062
* @tc.desc Test getCaptionsManager() function by modifying fontScale.
* Return CaptionsManager.
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0062', 0, async function (done) {
console.info('CaptionConfiguration_0062');
let captionManager = accessibility.getCaptionsManager();
let fontScale =-1;
captionManager.style.fontScale = fontScale;
let value = captionManager.style.fontScale;
expect(value).assertEqual(-1);
done();
})
/*
* @tc.number CaptionConfiguration_0080
* @tc.name CaptionConfiguration_0080
* @tc.desc Test getCaptionsManager() function by modifying fontEdgeType.
* Return CaptionsManager.
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0080', 0, async function (done) {
console.info('CaptionConfiguration_0080');
let captionManager = accessibility.getCaptionsManager();
let fontEdgeType ="none";
captionManager.style.fontEdgeType = fontEdgeType;
let value = captionManager.style.fontEdgeType;
expect(value).assertEqual(fontEdgeType);
done();
})
/*
* @tc.number CaptionConfiguration_0081
* @tc.name CaptionConfiguration_0081
* @tc.desc Test getCaptionsManager() function by modifying fontEdgeType.
* Return CaptionsManager.
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0081', 0, async function (done) {
console.info('CaptionConfiguration_0081');
let captionManager = accessibility.getCaptionsManager();
let fontEdgeType ="raised";
captionManager.style.fontEdgeType = fontEdgeType;
let value = captionManager.style.fontEdgeType;
expect(value).assertEqual(fontEdgeType);
done();
})
/*
* @tc.number CaptionConfiguration_0082
* @tc.name CaptionConfiguration_0082
* @tc.desc Test getCaptionsManager() function by modifying fontEdgeType.
* Return CaptionsManager.
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0082', 0, async function (done) {
console.info('CaptionConfiguration_0082');
let captionManager = accessibility.getCaptionsManager();
let fontEdgeType ="depressed";
captionManager.style.fontEdgeType = fontEdgeType;
let value = captionManager.style.fontEdgeType;
expect(value).assertEqual(fontEdgeType);
done();
})
/*
* @tc.number CaptionConfiguration_0083
* @tc.name CaptionConfiguration_0083
* @tc.desc Test getCaptionsManager() function by modifying fontEdgeType.
* Return CaptionsManager.
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0083', 0, async function (done) {
console.info('CaptionConfiguration_0083');
let captionManager = accessibility.getCaptionsManager();
let fontEdgeType ="uniform";
captionManager.style.fontEdgeType = fontEdgeType;
let value = captionManager.style.fontEdgeType;
expect(value).assertEqual(fontEdgeType);
done();
})
/*
* @tc.number CaptionConfiguration_0084
* @tc.name CaptionConfiguration_0084
* @tc.desc Test getCaptionsManager() function by modifying fontEdgeType.
* Return CaptionsManager.
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0084', 0, async function (done) {
console.info('CaptionConfiguration_0084');
let captionManager = accessibility.getCaptionsManager();
let fontEdgeType ="dropShadow";
captionManager.style.fontEdgeType = fontEdgeType;
let value = captionManager.style.fontEdgeType;
expect(value).assertEqual(fontEdgeType);
done();
})
/*
* @tc.number CaptionConfiguration_0085
* @tc.name CaptionConfiguration_0085
* @tc.desc Test getCaptionsManager() function by modifying fontEdgeType.
* Return CaptionsManager.
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0085', 0, async function (done) {
console.info('CaptionConfiguration_0085');
let captionManager = accessibility.getCaptionsManager();
let fontEdgeType ="";
captionManager.style.fontEdgeType = fontEdgeType;
let value = captionManager.style.fontEdgeType;
expect(value).assertEqual(fontEdgeType);
done();
})
/*
* @tc.number CaptionConfiguration_0090
* @tc.name CaptionConfiguration_0090
* @tc.desc Test getCaptionsManager() function by modifying backgroundColor.
* Return CaptionsManager.
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0090', 0, async function (done) {
console.info('CaptionConfiguration_0090');
let captionManager = accessibility.getCaptionsManager();
let backgroundColor ="TmepbackgroundColor";
captionManager.style.backgroundColor = backgroundColor;
let value = captionManager.style.backgroundColor;
expect(value).assertEqual(backgroundColor);
done();
})
/*
* @tc.number CaptionConfiguration_0091
* @tc.name CaptionConfiguration_0091
* @tc.desc Test getCaptionsManager() function by modifying backgroundColor.
* Return CaptionsManager.
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0091', 0, async function (done) {
console.info('CaptionConfiguration_0091');
let captionManager = accessibility.getCaptionsManager();
let backgroundColor ="none";
captionManager.style.backgroundColor = backgroundColor;
let value = captionManager.style.backgroundColor;
expect(value).assertEqual(backgroundColor);
done();
})
/*
* @tc.number CaptionConfiguration_0092
* @tc.name CaptionConfiguration_0092
* @tc.desc Test getCaptionsManager() function by modifying backgroundColor.
* Return CaptionsManager.
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0092', 0, async function (done) {
console.info('CaptionConfiguration_0092');
let captionManager = accessibility.getCaptionsManager();
let backgroundColor ="";
captionManager.style.backgroundColor = backgroundColor;
let value = captionManager.style.backgroundColor;
expect(value).assertEqual(backgroundColor);
done();
})
/*
* @tc.number CaptionConfiguration_0100
* @tc.name CaptionConfiguration_0100
* @tc.desc Test getCaptionsManager() function by modifying windowColor.
* Return CaptionsManager.
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0100', 0, async function (done) {
console.info('CaptionConfiguration_0100');
let captionManager = accessibility.getCaptionsManager();
let windowColor ="TmepwindowColor";
captionManager.style.windowColor = windowColor;
let value = captionManager.style.windowColor;
expect(value).assertEqual(windowColor);
done();
})
/*
* @tc.number CaptionConfiguration_0101
* @tc.name CaptionConfiguration_0101
* @tc.desc Test getCaptionsManager() function by modifying windowColor.
* Return CaptionsManager.
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0101', 0, async function (done) {
console.info('CaptionConfiguration_0101');
let captionManager = accessibility.getCaptionsManager();
let windowColor ="none";
captionManager.style.windowColor = windowColor;
let value = captionManager.style.windowColor;
expect(value).assertEqual(windowColor);
done();
})
/*
* @tc.number CaptionConfiguration_0102
* @tc.name CaptionConfiguration_0102
* @tc.desc Test getCaptionsManager() function by modifying windowColor.
* Return CaptionsManager.
* @tc.size SmallTest
* @tc.type User
*/
it('CaptionConfiguration_0102', 0, async function (done) {
console.info('CaptionConfiguration_0102');
let captionManager = accessibility.getCaptionsManager();
let windowColor ="";
captionManager.style.windowColor = windowColor;
let value = captionManager.style.windowColor;
expect(value).assertEqual(windowColor);
done();
})
})
/*
* 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.
*/
require('./AccessibleCaptionConfiguration.test.js')
\ No newline at end of file
# 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("AccessibleCheckAbility") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "AccessibleCheckAbility"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "180000",
"package": "com.example.accessiblecheckability",
"shell-timeout": "180000"
},
"kits": [
{
"test-file-name": [
"AccessibleCheckAbility.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.accessiblecheckability",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.accessiblecheckability",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"defPermissions": [
{
"availableScope": [],
"grantMode": "system_grant",
"name": "ohos.permission.DISTRIBUTED_DATASYNC"
}
],
"reqPermissions": [
{
"name": "ohos.permission.DISTRIBUTED_DATASYNC",
"reason": "ceshi"
}
],
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.accessiblecheckability.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"visible": true,
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* 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.
*/
export default {
onCreate() {
console.info('AccessibilityApplication onCreate');
},
onDestroy() {
console.info('AccessibilityApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
{{title}}
</text>
</div>
/*
* 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 file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: "Accessbility js test"
},
onInit() {
this.title = "Accessbility js test";
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "ActsSetCheckSyncEnable"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
/*
* 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import accessibility from '@ohos.accessibility'
describe('AccessibleCheckAbility', function () {
const TIMEOUT = 1000;
beforeEach(async function (done) {
console.info(`AccessibleAbilityList: beforeEach starts`);
done();
})
afterEach(async function (done) {
console.info(`AccessibleAbilityList: afterEach starts`);
setTimeout(done, TIMEOUT);
})
/******************************************************************************************* */
/* Cases CheckAbilityIsOpen_0170-0180 are for accessibility.isOpenAccessibility() API test */
/******************************************************************************************* */
/* Cases for namespace accessibility */
/*
* @tc.number CheckAbilityIsOpen_0170
* @tc.name CheckAbilityIsOpen_0170
* @tc.desc Test isOpenAccessibility() function in callback mode.
* The result of isOpenAccessibility() should be boolean type.
* @tc.size SmallTest
* @tc.type User
*/
it('CheckAbilityIsOpen_0170', 0, async function (done) {
console.info('CheckAbilityIsOpen_0170');
accessibility.isOpenAccessibility((err, data) => {
if (err.code != 0) {
console.error(`AccessibilityApi: CheckAbilityIsOpen_0170 has error: ${err.code}`);
expect(null).assertFail();
done();
}
expect(typeof (data)).assertEqual('boolean');
done();
});
})
/*
* @tc.number CheckAbilityIsOpen_0180
* @tc.name CheckAbilityIsOpen_0180
* @tc.desc Test isOpenAccessibility() function in promise mode.
* The result of isOpenAccessibility() should be boolean type.
* @tc.size SmallTest
* @tc.type User
*/
it('CheckAbilityIsOpen_0180', 0, async function (done) {
console.info('CheckAbilityIsOpen_0180');
accessibility.isOpenAccessibility().then((result) => {
console.info(`AccessibilityApi: CheckAbilityIsOpen_0180 result: ${result}`);
expect(typeof (result)).assertEqual('boolean');
done();
}).catch((err) => {
console.error(`AccessibilityApi: CheckAbilityIsOpen_0180 has error: ${err.code}`);
expect(null).assertFail();
done();
});
})
/******************************************************************************************* */
/* Cases CheckAbilityIsOpen_0190-0200 are for accessibility.isOpenTouchGuide() API test */
/******************************************************************************************* */
/*
* @tc.number CheckAbilityIsOpen_0190
* @tc.name CheckAbilityIsOpen_0190
* @tc.desc Test isOpenTouchGuide() function in callback mode.
* The result of isOpenTouchGuide() should be boolean type.
* @tc.size SmallTest
* @tc.type User
*/
it('CheckAbilityIsOpen_0190', 0, async function (done) {
console.info('CheckAbilityIsOpen_0190');
accessibility.isOpenTouchGuide((err, data) => {
if (err.code != 0) {
console.error(`AccessibilityApi: CheckAbilityIsOpen_0190 has error: ${err.code}`);
expect(null).assertFail();
done();
}
expect(typeof (data)).assertEqual('boolean');
done();
});
})
/*
* @tc.number CheckAbilityIsOpen_0200
* @tc.name CheckAbilityIsOpen_0200
* @tc.desc Test isOpenTouchGuide() function in promise mode.
* The result of isOpenTouchGuide() should be boolean type.
* @tc.size SmallTest
* @tc.type User
*/
it('CheckAbilityIsOpen_0200', 0, async function (done) {
console.info('CheckAbilityIsOpen_0200');
accessibility.isOpenTouchGuide().then((result) => {
console.info(`AccessibilityApi: CheckAbilityIsOpen_0200 result: ${result}`);
expect(typeof (result)).assertEqual('boolean');
done();
}).catch((err) => {
console.error(`AccessibilityApi: CheckAbilityIsOpen_0200 has error: ${err.code}`);
expect(null).assertFail();
done();
});
})
})
/*
* 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.
*/
require('./AccessibleCheckAbility.test.js')
\ No newline at end of file
# 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("AccessibleRegisterState") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "AccessibleRegisterState"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "180000",
"package": "com.example.accessibleregisterstate",
"shell-timeout": "180000"
},
"kits": [
{
"test-file-name": [
"AccessibleRegisterState.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.accessibleregisterstate",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.accessibleregisterstate",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"defPermissions": [
{
"availableScope": [],
"grantMode": "system_grant",
"name": "ohos.permission.DISTRIBUTED_DATASYNC"
}
],
"reqPermissions": [
{
"name": "ohos.permission.DISTRIBUTED_DATASYNC",
"reason": "ceshi"
}
],
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.accessibleregisterstate.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"visible": true,
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* 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.
*/
export default {
onCreate() {
console.info('AccessibilityApplication onCreate');
},
onDestroy() {
console.info('AccessibilityApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
{{title}}
</text>
</div>
/*
* 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 file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: "Accessbility js test"
},
onInit() {
this.title = "Accessbility js test";
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "ActsSetCheckSyncEnable"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
/*
* 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import accessibility from '@ohos.accessibility'
const bundleName = 'com.sample.testfora11y';
const triggerAction = 'accessibilityFocus';
const eventType = 'accessibilityFocus';
describe('AccessibleRegisterState', function () {
beforeEach(async function (done) {
console.info(`AccessibleRegisterState: beforeEach starts`);
done();
})
afterEach(async function (done) {
console.info(`AccessibleRegisterState: afterEach starts`);
setTimeout(done, 1000);
})
/******************************************************************************** */
/* Cases RegisterStateOnOff_0330-0360 are for accessibility.on() API test */
/******************************************************************************** */
/*
* @tc.number RegisterStateOnOff_0330
* @tc.name RegisterStateOnOff_0330
* @tc.desc The parameter input is 'accessibility', test the accessibility.on() function,
* and return void.
* @tc.size SmallTest
* @tc.type User
*/
it('RegisterStateOnOff_0330', 0, async function (done) {
console.info('RegisterStateOnOff_0330');
const stateEventType = 'accessibility';
let ret = accessibility.on(stateEventType, (data) => {});
expect(ret).assertEqual(undefined);
done();
})
/*
* @tc.number RegisterStateOnOff_0340
* @tc.name RegisterStateOnOff_0340
* @tc.desc The parameter input is 'touchGuide', test the accessibility.on() function,
* and return void.
* @tc.size SmallTest
* @tc.type User
*/
it('RegisterStateOnOff_0340', 0, async function (done) {
console.info('RegisterStateOnOff_0340');
const stateEventType = 'touchGuide';
let ret = accessibility.on(stateEventType, (data) => {});
expect(ret).assertEqual(undefined);
done();
})
/*
* @tc.number RegisterStateOnOff_0350
* @tc.name RegisterStateOnOff_0350
* @tc.desc The parameter input is '', test the accessibility.on() function,
* and return void.
* @tc.size SmallTest
* @tc.type User
*/
it('RegisterStateOnOff_0350', 0, async function (done) {
console.info('RegisterStateOnOff_0350');
const stateEventType = '';
let ret = accessibility.on(stateEventType, (data) => {});
expect(ret).assertEqual(undefined);
done();
})
/*
* @tc.number RegisterStateOnOff_0360
* @tc.name RegisterStateOnOff_0360
* @tc.desc The parameter input is null, test the accessibility.on() function,
* and return void.
* @tc.size SmallTest
* @tc.type User
*/
it('RegisterStateOnOff_0360', 0, async function (done) {
console.info('RegisterStateOnOff_0360');
const stateEventType = null;
let ret = accessibility.on(stateEventType, (data) => {});
expect(ret).assertEqual(undefined);
done();
})
/******************************************************************************** */
/* Cases RegisterStateOnOff_0370-0410 are for accessibility.off() API test */
/******************************************************************************** */
/*
* @tc.number RegisterStateOnOff_0370
* @tc.name RegisterStateOnOff_0370
* @tc.desc The parameter input is 'accessibility', test the accessibility.off() function,
* and return void.
* @tc.size SmallTest
* @tc.type User
*/
it('RegisterStateOnOff_0370', 0, async function (done) {
console.info('RegisterStateOnOff_0370');
const stateEventType = 'accessibility';
let ret = accessibility.off(stateEventType, (data) => {});
expect(ret).assertEqual(undefined);
done();
})
/*
* @tc.number RegisterStateOnOff_0380
* @tc.name RegisterStateOnOff_0380
* @tc.desc The parameter input is 'touchGuide', test the accessibility.off() function,
* and return void.
* @tc.size SmallTest
* @tc.type User
*/
it('RegisterStateOnOff_0380', 0, async function (done) {
console.info('RegisterStateOnOff_0380');
const stateEventType = 'touchGuide';
let ret = accessibility.off(stateEventType, (data) => {});
expect(ret).assertEqual(undefined);
done();
})
/*
* @tc.number RegisterStateOnOff_0390
* @tc.name RegisterStateOnOff_0390
* @tc.desc The parameter input is '', test the accessibility.off() function,
* and return void.
* @tc.size SmallTest
* @tc.type User
*/
it('RegisterStateOnOff_0390', 0, async function (done) {
console.info('RegisterStateOnOff_0390');
const stateEventType = '';
let ret = accessibility.off(stateEventType, (data) => {});
expect(ret).assertEqual(undefined);
done();
})
/*
* @tc.number RegisterStateOnOff_0400
* @tc.name RegisterStateOnOff_0400
* @tc.desc The parameter input is null, test the accessibility.off() function,
* and return void.
* @tc.size SmallTest
* @tc.type User
*/
it('RegisterStateOnOff_0400', 0, async function (done) {
console.info('RegisterStateOnOff_0400');
const stateEventType = null;
let ret = accessibility.off(stateEventType, (data) => {});
expect(ret).assertEqual(undefined);
done();
})
/*
* @tc.number RegisterStateOnOff_0410
* @tc.name RegisterStateOnOff_0410
* @tc.desc The parameter input is null, test the accessibility.off() function,
* and return void.
* @tc.size SmallTest
* @tc.type User
*/
it('RegisterStateOnOff_0410', 0, async function (done) {
console.info('RegisterStateOnOff_0410');
const stateEventType = null;
let ret = accessibility.off(stateEventType, (data) => {});
expect(ret).assertEqual(undefined);
done();
})
})
/*
* 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.
*/
require('./AccessibleRegisterState.test.js')
\ No newline at end of file
# 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("AccessibleSendEvent") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "AccessibleSendEvent"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "180000",
"package": "com.example.accessiblesendevent",
"shell-timeout": "180000"
},
"kits": [
{
"test-file-name": [
"AccessibleSendEvent.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.accessiblesendevent",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.accessiblesendevent",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"defPermissions": [
{
"availableScope": [],
"grantMode": "system_grant",
"name": "ohos.permission.DISTRIBUTED_DATASYNC"
}
],
"reqPermissions": [
{
"name": "ohos.permission.DISTRIBUTED_DATASYNC",
"reason": "ceshi"
}
],
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.accessiblesendevent.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"visible": true,
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* 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.
*/
export default {
onCreate() {
console.info('AccessibilityApplication onCreate');
},
onDestroy() {
console.info('AccessibilityApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
{{title}}
</text>
</div>
/*
* 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 file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: "Accessbility js test"
},
onInit() {
this.title = "Accessbility js test";
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "ActsSetCheckSyncEnable"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
/*
* 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import accessibility from '@ohos.accessibility'
const bundleName = 'com.sample.testfora11y';
const triggerAction = 'accessibilityFocus';
const eventType = 'accessibilityFocus';
describe('AccessibleSendEvent', function () {
beforeEach(async function (done) {
console.info(`AccessibleSendEvent: beforeEach starts`);
done();
})
afterEach(async function (done) {
console.info(`AccessibleSendEvent: afterEach starts`);
setTimeout(done, 1000);
})
/******************************************************************************** */
/* Cases SendEventAccessibility_0010-0020 & SendEventAccessibilityNull_0010-0020 */
/* are for accessibility.sendEvent() API test */
/******************************************************************************** */
/*
* @tc.number SendEventAccessibility_0010
* @tc.name SendEventAccessibility_0010
* @tc.desc The parameter input is EventInfo, test the sendEvent() function,
* and should return true.
* @tc.size SmallTest
* @tc.type User
*/
it('SendEventAccessibility_0010', 0, async function (done) {
console.info('SendEventAccessibility_0010');
let event = new accessibility.EventInfo();
event.type = eventType;
event.bundleName = bundleName;
event.triggerAction = triggerAction;
accessibility.sendEvent(event, (err, data) => {
if (err.code != 0) {
console.error(`AccessibleSendEvent: SendEventAccessibility_0010 has error: ${err.code}`);
expect(null).assertFail();
done();
}
console.info(`AccessibleSendEvent: SendEventAccessibility_0010 data ${data}`);
expect(data).assertEqual(true);
done();
})
})
/*
* @tc.number SendEventAccessibility_0020
* @tc.name SendEventAccessibility_0020
* @tc.desc The parameter input is EventInfo, test the sendEvent() function,
* and should return true.
* @tc.size SmallTest
* @tc.type User
*/
it('SendEventAccessibility_0020', 0, async function (done) {
console.info('SendEventAccessibility_0020');
let event = new accessibility.EventInfo();
event.type = eventType;
event.bundleName = bundleName;
event.triggerAction = triggerAction;
accessibility.sendEvent(event).then((result) => {
console.info(`AccessibleSendEvent: SendEventAccessibility_0020 data ${result}`);
expect(result).assertEqual(true);
done();
}).catch((err) => {
console.error(`AccessibleSendEvent: SendEventAccessibility_0020 has error: ${err}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number SendEventAccessibilityNull_0010
* @tc.name SendEventAccessibilityNull_0010
* @tc.desc The parameter input is null, test the sendEvent() function,
* and should return false.
* @tc.size SmallTest
* @tc.type User
*/
it('SendEventAccessibilityNull_0010', 0, async function (done) {
console.info('SendEventAccessibilityNull_0010');
let event = null;
accessibility.sendEvent(event, (err, data) => {
if (err.code != 0) {
console.error(`AccessibleSendEvent: SendEventAccessibilityNull_0010 has error: ${err.code}`);
expect(null).assertFail();
done();
}
console.info(`AccessibleSendEvent: SendEventAccessibilityNull_0010 data ${data}`);
expect(data).assertEqual(false);
done();
})
})
/*
* @tc.number SendEventAccessibilityNull_0020
* @tc.name SendEventAccessibilityNull_0020
* @tc.desc The parameter input is null, test the sendEvent() function,
* and should return false.
* @tc.size SmallTest
* @tc.type User
*/
it('SendEventAccessibilityNull_0020', 0, async function (done) {
console.info('SendEventAccessibilityNull_0020');
let event = null;
accessibility.sendEvent(event).then((result) => {
console.info(`AccessibleSendEvent: SendEventAccessibilityNull_0020 data ${result}`);
expect(result).assertEqual(false);
done();
}).catch((err) => {
console.error(`AccessibleSendEvent: SendEventAccessibilityNull_0020 has error: ${err}`);
expect(null).assertFail();
done();
});
})
})
/*
* 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.
*/
require('./AccessibleSendEvent.test.js')
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册