diff --git a/barrierfree/BUILD.gn b/barrierfree/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..cb98d2993825f8dff4f4ec6ea0aa5bd26a722b5d --- /dev/null +++ b/barrierfree/BUILD.gn @@ -0,0 +1,27 @@ +# 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", + ] + } +} diff --git a/barrierfree/accessibleabilitylist/BUILD.gn b/barrierfree/accessibleabilitylist/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..df4260aa0bf7e4502208326134ab3a6127b22257 --- /dev/null +++ b/barrierfree/accessibleabilitylist/BUILD.gn @@ -0,0 +1,31 @@ +# 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" +} diff --git a/barrierfree/accessibleabilitylist/Test.json b/barrierfree/accessibleabilitylist/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..a0e171f3a091d1a10f01b4cca86e8e2ed13e5abb --- /dev/null +++ b/barrierfree/accessibleabilitylist/Test.json @@ -0,0 +1,18 @@ +{ + "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 + } + ] +} diff --git a/barrierfree/accessibleabilitylist/entry/src/main/config.json b/barrierfree/accessibleabilitylist/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..15215e2387e6ef2c33b9b52533bedd8fcf1f1d93 --- /dev/null +++ b/barrierfree/accessibleabilitylist/entry/src/main/config.json @@ -0,0 +1,74 @@ +{ + "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 diff --git a/barrierfree/accessibleabilitylist/entry/src/main/js/default/app.js b/barrierfree/accessibleabilitylist/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..5707f4d8b754dd144785dcb7362d17f2eeae2106 --- /dev/null +++ b/barrierfree/accessibleabilitylist/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * 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'); + } +}; diff --git a/barrierfree/accessibleabilitylist/entry/src/main/js/default/i18n/en-US.json b/barrierfree/accessibleabilitylist/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/barrierfree/accessibleabilitylist/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/barrierfree/accessibleabilitylist/entry/src/main/js/default/i18n/zh-CN.json b/barrierfree/accessibleabilitylist/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/barrierfree/accessibleabilitylist/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/barrierfree/accessibleabilitylist/entry/src/main/js/default/pages/index/index.css b/barrierfree/accessibleabilitylist/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/barrierfree/accessibleabilitylist/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/barrierfree/accessibleabilitylist/entry/src/main/js/default/pages/index/index.hml b/barrierfree/accessibleabilitylist/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..c45422b42d0bf788a1c2c0eb299a981f07ce8613 --- /dev/null +++ b/barrierfree/accessibleabilitylist/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{title}} + +
diff --git a/barrierfree/accessibleabilitylist/entry/src/main/js/default/pages/index/index.js b/barrierfree/accessibleabilitylist/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..3125e9d43606aa8f9229d1ff0bcb4c8860a16233 --- /dev/null +++ b/barrierfree/accessibleabilitylist/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,45 @@ +/* + * 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 diff --git a/barrierfree/accessibleabilitylist/entry/src/main/js/resources/base/element/string.json b/barrierfree/accessibleabilitylist/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..52efec27776c61fecdfd7bd9c8f9bbb6e7e5e234 --- /dev/null +++ b/barrierfree/accessibleabilitylist/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ActsSetCheckSyncEnable" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessibleabilitylist/entry/src/main/js/resources/base/media/icon.png b/barrierfree/accessibleabilitylist/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibleabilitylist/entry/src/main/js/resources/base/media/icon.png differ diff --git a/barrierfree/accessibleabilitylist/entry/src/main/js/test/AccessibleAbilityList.test.js b/barrierfree/accessibleabilitylist/entry/src/main/js/test/AccessibleAbilityList.test.js new file mode 100644 index 0000000000000000000000000000000000000000..70b2be65e439ce9ed403ae317a88c182da1b3266 --- /dev/null +++ b/barrierfree/accessibleabilitylist/entry/src/main/js/test/AccessibleAbilityList.test.js @@ -0,0 +1,276 @@ +/* + * 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(); + }); + }) +}) + diff --git a/barrierfree/accessibleabilitylist/entry/src/main/js/test/List.test.js b/barrierfree/accessibleabilitylist/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..bf0f919b71aa8b7d308f8a8f6b63b7f487718025 --- /dev/null +++ b/barrierfree/accessibleabilitylist/entry/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * 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 diff --git a/barrierfree/accessibleabilitylist/signature/openharmony_sx.p7b b/barrierfree/accessibleabilitylist/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/barrierfree/accessibleabilitylist/signature/openharmony_sx.p7b differ diff --git a/barrierfree/accessiblecaptionconfiguration/BUILD.gn b/barrierfree/accessiblecaptionconfiguration/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..3601269043430826f8222a16fec2fa851da7e4cd --- /dev/null +++ b/barrierfree/accessiblecaptionconfiguration/BUILD.gn @@ -0,0 +1,31 @@ +# 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" +} diff --git a/barrierfree/accessiblecaptionconfiguration/Test.json b/barrierfree/accessiblecaptionconfiguration/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..a743056c4cebf83554e2c0817c66918295a4f0dc --- /dev/null +++ b/barrierfree/accessiblecaptionconfiguration/Test.json @@ -0,0 +1,18 @@ +{ + "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 + } + ] +} diff --git a/barrierfree/accessiblecaptionconfiguration/entry/src/main/config.json b/barrierfree/accessiblecaptionconfiguration/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..d087c6c0bd59442d411286b1ff9b5d04e066c40a --- /dev/null +++ b/barrierfree/accessiblecaptionconfiguration/entry/src/main/config.json @@ -0,0 +1,74 @@ +{ + "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 diff --git a/barrierfree/accessiblecaptionconfiguration/entry/src/main/js/default/app.js b/barrierfree/accessiblecaptionconfiguration/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..5707f4d8b754dd144785dcb7362d17f2eeae2106 --- /dev/null +++ b/barrierfree/accessiblecaptionconfiguration/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * 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'); + } +}; diff --git a/barrierfree/accessiblecaptionconfiguration/entry/src/main/js/default/i18n/en-US.json b/barrierfree/accessiblecaptionconfiguration/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/barrierfree/accessiblecaptionconfiguration/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/barrierfree/accessiblecaptionconfiguration/entry/src/main/js/default/i18n/zh-CN.json b/barrierfree/accessiblecaptionconfiguration/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/barrierfree/accessiblecaptionconfiguration/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/barrierfree/accessiblecaptionconfiguration/entry/src/main/js/default/pages/index/index.css b/barrierfree/accessiblecaptionconfiguration/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/barrierfree/accessiblecaptionconfiguration/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/barrierfree/accessiblecaptionconfiguration/entry/src/main/js/default/pages/index/index.hml b/barrierfree/accessiblecaptionconfiguration/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..c45422b42d0bf788a1c2c0eb299a981f07ce8613 --- /dev/null +++ b/barrierfree/accessiblecaptionconfiguration/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{title}} + +
diff --git a/barrierfree/accessiblecaptionconfiguration/entry/src/main/js/default/pages/index/index.js b/barrierfree/accessiblecaptionconfiguration/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..3125e9d43606aa8f9229d1ff0bcb4c8860a16233 --- /dev/null +++ b/barrierfree/accessiblecaptionconfiguration/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,45 @@ +/* + * 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 diff --git a/barrierfree/accessiblecaptionconfiguration/entry/src/main/js/resources/base/element/string.json b/barrierfree/accessiblecaptionconfiguration/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..52efec27776c61fecdfd7bd9c8f9bbb6e7e5e234 --- /dev/null +++ b/barrierfree/accessiblecaptionconfiguration/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ActsSetCheckSyncEnable" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessiblecaptionconfiguration/entry/src/main/js/resources/base/media/icon.png b/barrierfree/accessiblecaptionconfiguration/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessiblecaptionconfiguration/entry/src/main/js/resources/base/media/icon.png differ diff --git a/barrierfree/accessiblecaptionconfiguration/entry/src/main/js/test/AccessibleCaptionConfiguration.test.js b/barrierfree/accessiblecaptionconfiguration/entry/src/main/js/test/AccessibleCaptionConfiguration.test.js new file mode 100644 index 0000000000000000000000000000000000000000..6416b737f5853c19f5249324556ec7d9ed8cfd89 --- /dev/null +++ b/barrierfree/accessiblecaptionconfiguration/entry/src/main/js/test/AccessibleCaptionConfiguration.test.js @@ -0,0 +1,736 @@ +/* + * 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(); + }) + +}) diff --git a/barrierfree/accessiblecaptionconfiguration/entry/src/main/js/test/List.test.js b/barrierfree/accessiblecaptionconfiguration/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..03a6a4146438e3015f8cdd5b2069962008a00b79 --- /dev/null +++ b/barrierfree/accessiblecaptionconfiguration/entry/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * 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 diff --git a/barrierfree/accessiblecaptionconfiguration/signature/openharmony_sx.p7b b/barrierfree/accessiblecaptionconfiguration/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/barrierfree/accessiblecaptionconfiguration/signature/openharmony_sx.p7b differ diff --git a/barrierfree/accessiblecheckability/BUILD.gn b/barrierfree/accessiblecheckability/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..98f3d97a250de93bd17b2381777a798817bd0c84 --- /dev/null +++ b/barrierfree/accessiblecheckability/BUILD.gn @@ -0,0 +1,31 @@ +# 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" +} diff --git a/barrierfree/accessiblecheckability/Test.json b/barrierfree/accessiblecheckability/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..35130ba66c313bbc3c8ac0bfbbd73fabeca6e59d --- /dev/null +++ b/barrierfree/accessiblecheckability/Test.json @@ -0,0 +1,18 @@ +{ + "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 + } + ] +} diff --git a/barrierfree/accessiblecheckability/entry/src/main/config.json b/barrierfree/accessiblecheckability/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..1b6983e0649a97a3c5b21a9585f9fec4830ebbcd --- /dev/null +++ b/barrierfree/accessiblecheckability/entry/src/main/config.json @@ -0,0 +1,74 @@ +{ + "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 diff --git a/barrierfree/accessiblecheckability/entry/src/main/js/default/app.js b/barrierfree/accessiblecheckability/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..5707f4d8b754dd144785dcb7362d17f2eeae2106 --- /dev/null +++ b/barrierfree/accessiblecheckability/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * 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'); + } +}; diff --git a/barrierfree/accessiblecheckability/entry/src/main/js/default/i18n/en-US.json b/barrierfree/accessiblecheckability/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/barrierfree/accessiblecheckability/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/barrierfree/accessiblecheckability/entry/src/main/js/default/i18n/zh-CN.json b/barrierfree/accessiblecheckability/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/barrierfree/accessiblecheckability/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/barrierfree/accessiblecheckability/entry/src/main/js/default/pages/index/index.css b/barrierfree/accessiblecheckability/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/barrierfree/accessiblecheckability/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/barrierfree/accessiblecheckability/entry/src/main/js/default/pages/index/index.hml b/barrierfree/accessiblecheckability/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..c45422b42d0bf788a1c2c0eb299a981f07ce8613 --- /dev/null +++ b/barrierfree/accessiblecheckability/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{title}} + +
diff --git a/barrierfree/accessiblecheckability/entry/src/main/js/default/pages/index/index.js b/barrierfree/accessiblecheckability/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..3125e9d43606aa8f9229d1ff0bcb4c8860a16233 --- /dev/null +++ b/barrierfree/accessiblecheckability/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,45 @@ +/* + * 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 diff --git a/barrierfree/accessiblecheckability/entry/src/main/js/resources/base/element/string.json b/barrierfree/accessiblecheckability/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..52efec27776c61fecdfd7bd9c8f9bbb6e7e5e234 --- /dev/null +++ b/barrierfree/accessiblecheckability/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ActsSetCheckSyncEnable" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessiblecheckability/entry/src/main/js/resources/base/media/icon.png b/barrierfree/accessiblecheckability/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessiblecheckability/entry/src/main/js/resources/base/media/icon.png differ diff --git a/barrierfree/accessiblecheckability/entry/src/main/js/test/AccessibleCheckAbility.test.js b/barrierfree/accessiblecheckability/entry/src/main/js/test/AccessibleCheckAbility.test.js new file mode 100644 index 0000000000000000000000000000000000000000..2067710d6618f26d05a3e1d703484e3327a081bc --- /dev/null +++ b/barrierfree/accessiblecheckability/entry/src/main/js/test/AccessibleCheckAbility.test.js @@ -0,0 +1,125 @@ +/* + * 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(); + }); + }) +}) + diff --git a/barrierfree/accessiblecheckability/entry/src/main/js/test/List.test.js b/barrierfree/accessiblecheckability/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..3664d7b37e67a4adcc45dcb414e53f53485b37ed --- /dev/null +++ b/barrierfree/accessiblecheckability/entry/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * 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 diff --git a/barrierfree/accessiblecheckability/signature/openharmony_sx.p7b b/barrierfree/accessiblecheckability/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/barrierfree/accessiblecheckability/signature/openharmony_sx.p7b differ diff --git a/barrierfree/accessibleregisterstate/BUILD.gn b/barrierfree/accessibleregisterstate/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..44799b473dd75a497a902b3aa79aa08cf779f7ec --- /dev/null +++ b/barrierfree/accessibleregisterstate/BUILD.gn @@ -0,0 +1,31 @@ +# 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" +} diff --git a/barrierfree/accessibleregisterstate/Test.json b/barrierfree/accessibleregisterstate/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..8d498af676a508412b8d878840e8334c74b294e5 --- /dev/null +++ b/barrierfree/accessibleregisterstate/Test.json @@ -0,0 +1,18 @@ +{ + "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 + } + ] +} diff --git a/barrierfree/accessibleregisterstate/entry/src/main/config.json b/barrierfree/accessibleregisterstate/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..2a3b9a6821786daea6874c3c543c4c5867c6a0ea --- /dev/null +++ b/barrierfree/accessibleregisterstate/entry/src/main/config.json @@ -0,0 +1,74 @@ +{ + "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 diff --git a/barrierfree/accessibleregisterstate/entry/src/main/js/default/app.js b/barrierfree/accessibleregisterstate/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..5707f4d8b754dd144785dcb7362d17f2eeae2106 --- /dev/null +++ b/barrierfree/accessibleregisterstate/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * 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'); + } +}; diff --git a/barrierfree/accessibleregisterstate/entry/src/main/js/default/i18n/en-US.json b/barrierfree/accessibleregisterstate/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/barrierfree/accessibleregisterstate/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/barrierfree/accessibleregisterstate/entry/src/main/js/default/i18n/zh-CN.json b/barrierfree/accessibleregisterstate/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/barrierfree/accessibleregisterstate/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/barrierfree/accessibleregisterstate/entry/src/main/js/default/pages/index/index.css b/barrierfree/accessibleregisterstate/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/barrierfree/accessibleregisterstate/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/barrierfree/accessibleregisterstate/entry/src/main/js/default/pages/index/index.hml b/barrierfree/accessibleregisterstate/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..c45422b42d0bf788a1c2c0eb299a981f07ce8613 --- /dev/null +++ b/barrierfree/accessibleregisterstate/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{title}} + +
diff --git a/barrierfree/accessibleregisterstate/entry/src/main/js/default/pages/index/index.js b/barrierfree/accessibleregisterstate/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..3125e9d43606aa8f9229d1ff0bcb4c8860a16233 --- /dev/null +++ b/barrierfree/accessibleregisterstate/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,45 @@ +/* + * 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 diff --git a/barrierfree/accessibleregisterstate/entry/src/main/js/resources/base/element/string.json b/barrierfree/accessibleregisterstate/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..52efec27776c61fecdfd7bd9c8f9bbb6e7e5e234 --- /dev/null +++ b/barrierfree/accessibleregisterstate/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ActsSetCheckSyncEnable" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessibleregisterstate/entry/src/main/js/resources/base/media/icon.png b/barrierfree/accessibleregisterstate/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibleregisterstate/entry/src/main/js/resources/base/media/icon.png differ diff --git a/barrierfree/accessibleregisterstate/entry/src/main/js/test/AccessibleRegisterState.test.js b/barrierfree/accessibleregisterstate/entry/src/main/js/test/AccessibleRegisterState.test.js new file mode 100644 index 0000000000000000000000000000000000000000..7508e44b00f4a99d82380fde479030cd4e4a44ee --- /dev/null +++ b/barrierfree/accessibleregisterstate/entry/src/main/js/test/AccessibleRegisterState.test.js @@ -0,0 +1,186 @@ +/* + * 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(); + }) +}) + diff --git a/barrierfree/accessibleregisterstate/entry/src/main/js/test/List.test.js b/barrierfree/accessibleregisterstate/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..e1862838ac16a13d7ba0c0e67f26e20b9e96923a --- /dev/null +++ b/barrierfree/accessibleregisterstate/entry/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * 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 diff --git a/barrierfree/accessibleregisterstate/signature/openharmony_sx.p7b b/barrierfree/accessibleregisterstate/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/barrierfree/accessibleregisterstate/signature/openharmony_sx.p7b differ diff --git a/barrierfree/accessiblesendevent/BUILD.gn b/barrierfree/accessiblesendevent/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..666670584ae51a77006441e4184beeaaa308f5d9 --- /dev/null +++ b/barrierfree/accessiblesendevent/BUILD.gn @@ -0,0 +1,31 @@ +# 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" +} diff --git a/barrierfree/accessiblesendevent/Test.json b/barrierfree/accessiblesendevent/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..606ed0d5099940df8fd01b3197dd88f6a7cd638b --- /dev/null +++ b/barrierfree/accessiblesendevent/Test.json @@ -0,0 +1,18 @@ +{ + "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 + } + ] +} diff --git a/barrierfree/accessiblesendevent/entry/src/main/config.json b/barrierfree/accessiblesendevent/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..c0bc8572d9cbde633d096bf7752be48afa339adc --- /dev/null +++ b/barrierfree/accessiblesendevent/entry/src/main/config.json @@ -0,0 +1,74 @@ +{ + "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 diff --git a/barrierfree/accessiblesendevent/entry/src/main/js/default/app.js b/barrierfree/accessiblesendevent/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..5707f4d8b754dd144785dcb7362d17f2eeae2106 --- /dev/null +++ b/barrierfree/accessiblesendevent/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * 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'); + } +}; diff --git a/barrierfree/accessiblesendevent/entry/src/main/js/default/i18n/en-US.json b/barrierfree/accessiblesendevent/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/barrierfree/accessiblesendevent/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/barrierfree/accessiblesendevent/entry/src/main/js/default/i18n/zh-CN.json b/barrierfree/accessiblesendevent/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/barrierfree/accessiblesendevent/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/barrierfree/accessiblesendevent/entry/src/main/js/default/pages/index/index.css b/barrierfree/accessiblesendevent/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/barrierfree/accessiblesendevent/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/barrierfree/accessiblesendevent/entry/src/main/js/default/pages/index/index.hml b/barrierfree/accessiblesendevent/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..c45422b42d0bf788a1c2c0eb299a981f07ce8613 --- /dev/null +++ b/barrierfree/accessiblesendevent/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{title}} + +
diff --git a/barrierfree/accessiblesendevent/entry/src/main/js/default/pages/index/index.js b/barrierfree/accessiblesendevent/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..3125e9d43606aa8f9229d1ff0bcb4c8860a16233 --- /dev/null +++ b/barrierfree/accessiblesendevent/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,45 @@ +/* + * 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 diff --git a/barrierfree/accessiblesendevent/entry/src/main/js/resources/base/element/string.json b/barrierfree/accessiblesendevent/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..52efec27776c61fecdfd7bd9c8f9bbb6e7e5e234 --- /dev/null +++ b/barrierfree/accessiblesendevent/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ActsSetCheckSyncEnable" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessiblesendevent/entry/src/main/js/resources/base/media/icon.png b/barrierfree/accessiblesendevent/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessiblesendevent/entry/src/main/js/resources/base/media/icon.png differ diff --git a/barrierfree/accessiblesendevent/entry/src/main/js/test/AccessibleSendEvent.test.js b/barrierfree/accessiblesendevent/entry/src/main/js/test/AccessibleSendEvent.test.js new file mode 100644 index 0000000000000000000000000000000000000000..92e10884f0e280d52e3acb8d877728ff2acd322b --- /dev/null +++ b/barrierfree/accessiblesendevent/entry/src/main/js/test/AccessibleSendEvent.test.js @@ -0,0 +1,141 @@ +/* + * 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(); + }); + }) + + +}) + diff --git a/barrierfree/accessiblesendevent/entry/src/main/js/test/List.test.js b/barrierfree/accessiblesendevent/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..0b4ff95aa7fdb12462662dba9f6d11ef6e910690 --- /dev/null +++ b/barrierfree/accessiblesendevent/entry/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * 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 diff --git a/barrierfree/accessiblesendevent/signature/openharmony_sx.p7b b/barrierfree/accessiblesendevent/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/barrierfree/accessiblesendevent/signature/openharmony_sx.p7b differ