From d330ec8a2a6315386309190dd0afac1f701a29ad Mon Sep 17 00:00:00 2001 From: anning Date: Tue, 27 Sep 2022 18:53:06 +0800 Subject: [PATCH] applications Signed-off-by: anning --- applications/BUILD.gn | 17 + .../settingsdata}/BUILD.gn | 0 .../settingsdata}/settings_ets/BUILD.gn | 0 .../settingsdata}/settings_ets/Test.json | 38 +- .../settings_ets/entry/src/main/config.json | 210 +- .../entry/src/main/ets/MainAbility/app.ets | 42 +- .../src/main/ets/MainAbility/pages/index.ets | 74 +- .../entry/src/main/ets/TestAbility/app.ets | 62 +- .../src/main/ets/TestAbility/pages/index.ets | 96 +- .../ets/TestRunner/OpenHarmonyTestRunner.ts | 152 +- .../entry/src/main/ets/test/List.test.ets | 36 +- .../main/ets/test/SettingUiJsunit.test.ets | 2374 ++++++++--------- .../main/resources/base/element/string.json | 38 +- .../src/main/resources/base/media/icon.png | Bin .../settings_ets/signature/openharmony_sx.p7b | Bin test_packages.gni | 1 + 16 files changed, 1579 insertions(+), 1561 deletions(-) create mode 100644 applications/BUILD.gn rename {settingsdata => applications/settingsdata}/BUILD.gn (100%) mode change 100755 => 100644 rename {settingsdata => applications/settingsdata}/settings_ets/BUILD.gn (100%) rename {settingsdata => applications/settingsdata}/settings_ets/Test.json (96%) rename {settingsdata => applications/settingsdata}/settings_ets/entry/src/main/config.json (95%) rename {settingsdata => applications/settingsdata}/settings_ets/entry/src/main/ets/MainAbility/app.ets (97%) rename {settingsdata => applications/settingsdata}/settings_ets/entry/src/main/ets/MainAbility/pages/index.ets (96%) rename {settingsdata => applications/settingsdata}/settings_ets/entry/src/main/ets/TestAbility/app.ets (97%) rename {settingsdata => applications/settingsdata}/settings_ets/entry/src/main/ets/TestAbility/pages/index.ets (96%) rename {settingsdata => applications/settingsdata}/settings_ets/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts (97%) rename {settingsdata => applications/settingsdata}/settings_ets/entry/src/main/ets/test/List.test.ets (97%) rename {settingsdata => applications/settingsdata}/settings_ets/entry/src/main/ets/test/SettingUiJsunit.test.ets (97%) rename {settingsdata => applications/settingsdata}/settings_ets/entry/src/main/resources/base/element/string.json (94%) rename {settingsdata => applications/settingsdata}/settings_ets/entry/src/main/resources/base/media/icon.png (100%) rename {settingsdata => applications/settingsdata}/settings_ets/signature/openharmony_sx.p7b (100%) diff --git a/applications/BUILD.gn b/applications/BUILD.gn new file mode 100644 index 000000000..7c8653c03 --- /dev/null +++ b/applications/BUILD.gn @@ -0,0 +1,17 @@ +# 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. + +group("applications") { + testonly = true + deps = [ "settingsdata:settingsdata" ] +} diff --git a/settingsdata/BUILD.gn b/applications/settingsdata/BUILD.gn old mode 100755 new mode 100644 similarity index 100% rename from settingsdata/BUILD.gn rename to applications/settingsdata/BUILD.gn diff --git a/settingsdata/settings_ets/BUILD.gn b/applications/settingsdata/settings_ets/BUILD.gn similarity index 100% rename from settingsdata/settings_ets/BUILD.gn rename to applications/settingsdata/settings_ets/BUILD.gn diff --git a/settingsdata/settings_ets/Test.json b/applications/settingsdata/settings_ets/Test.json similarity index 96% rename from settingsdata/settings_ets/Test.json rename to applications/settingsdata/settings_ets/Test.json index 4ed73b907..648902a80 100644 --- a/settingsdata/settings_ets/Test.json +++ b/applications/settingsdata/settings_ets/Test.json @@ -1,19 +1,19 @@ -{ - "description": "Configuration for settings Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "600000", - "bundle-name": "com.open.harmony.settings", - "package-name": "com.open.harmony.settings", - "shell-timeout": "600000" - }, - "kits": [ - { - "test-file-name": [ - "ActsSettingsEtsTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} +{ + "description": "Configuration for settings Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.open.harmony.settings", + "package-name": "com.open.harmony.settings", + "shell-timeout": "600000" + }, + "kits": [ + { + "test-file-name": [ + "ActsSettingsEtsTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/settingsdata/settings_ets/entry/src/main/config.json b/applications/settingsdata/settings_ets/entry/src/main/config.json similarity index 95% rename from settingsdata/settings_ets/entry/src/main/config.json rename to applications/settingsdata/settings_ets/entry/src/main/config.json index 287d466ba..a40195cf1 100644 --- a/settingsdata/settings_ets/entry/src/main/config.json +++ b/applications/settingsdata/settings_ets/entry/src/main/config.json @@ -1,105 +1,105 @@ -{ - "app": { - "bundleName": "com.open.harmony.settings", - "vendor": "open", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.open.harmony.settings", - "name": ".MyApplication", - "mainAbility": "com.open.harmony.settings.MainAbility", - "srcPath": "", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "orientation": "unspecified", - "visible": true, - "srcPath": "MainAbility", - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "formsEnabled": false, - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - }, - { - "orientation": "unspecified", - "visible": true, - "srcPath": "TestAbility", - "name": ".TestAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:TestAbility_desc", - "formsEnabled": false, - "label": "$string:TestAbility_label", - "type": "page", - "launchType": "standard" - } - ], - "reqPermissions": [ - { - "name":"ohos.permission.MANAGE_SECURE_SETTINGS", - "reason":"need use ohos.permission.,MANAGE_SECURE_SETTINGS" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - }, - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".TestAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} +{ + "app": { + "bundleName": "com.open.harmony.settings", + "vendor": "open", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.open.harmony.settings", + "name": ".MyApplication", + "mainAbility": "com.open.harmony.settings.MainAbility", + "srcPath": "", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "formsEnabled": false, + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + }, + { + "orientation": "unspecified", + "visible": true, + "srcPath": "TestAbility", + "name": ".TestAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "formsEnabled": false, + "label": "$string:TestAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "reqPermissions": [ + { + "name":"ohos.permission.MANAGE_SECURE_SETTINGS", + "reason":"need use ohos.permission.,MANAGE_SECURE_SETTINGS" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} diff --git a/settingsdata/settings_ets/entry/src/main/ets/MainAbility/app.ets b/applications/settingsdata/settings_ets/entry/src/main/ets/MainAbility/app.ets similarity index 97% rename from settingsdata/settings_ets/entry/src/main/ets/MainAbility/app.ets rename to applications/settingsdata/settings_ets/entry/src/main/ets/MainAbility/app.ets index 5d603333c..fc86a0485 100644 --- a/settingsdata/settings_ets/entry/src/main/ets/MainAbility/app.ets +++ b/applications/settingsdata/settings_ets/entry/src/main/ets/MainAbility/app.ets @@ -1,22 +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('Application onCreate') - }, - onDestroy() { - console.info('Application onDestroy') - }, +/** + * 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('Application onCreate') + }, + onDestroy() { + console.info('Application onDestroy') + }, } \ No newline at end of file diff --git a/settingsdata/settings_ets/entry/src/main/ets/MainAbility/pages/index.ets b/applications/settingsdata/settings_ets/entry/src/main/ets/MainAbility/pages/index.ets similarity index 96% rename from settingsdata/settings_ets/entry/src/main/ets/MainAbility/pages/index.ets rename to applications/settingsdata/settings_ets/entry/src/main/ets/MainAbility/pages/index.ets index 54b28ac3d..5e23de1ad 100644 --- a/settingsdata/settings_ets/entry/src/main/ets/MainAbility/pages/index.ets +++ b/applications/settingsdata/settings_ets/entry/src/main/ets/MainAbility/pages/index.ets @@ -1,37 +1,37 @@ -// @ts-nocheck -/** - * 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. - */ - -@Entry -@Component -struct MyComponent { - aboutToAppear() { - } - - build() { - Flex({ - direction: FlexDirection.Column, - alignItems: ItemAlign.Center, - justifyContent: FlexAlign.Center - }) { - Text('Settings ETS TEST') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} - +// @ts-nocheck +/** + * 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. + */ + +@Entry +@Component +struct MyComponent { + aboutToAppear() { + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('Settings ETS TEST') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} + diff --git a/settingsdata/settings_ets/entry/src/main/ets/TestAbility/app.ets b/applications/settingsdata/settings_ets/entry/src/main/ets/TestAbility/app.ets similarity index 97% rename from settingsdata/settings_ets/entry/src/main/ets/TestAbility/app.ets rename to applications/settingsdata/settings_ets/entry/src/main/ets/TestAbility/app.ets index 9511bef9a..1405dd359 100644 --- a/settingsdata/settings_ets/entry/src/main/ets/TestAbility/app.ets +++ b/applications/settingsdata/settings_ets/entry/src/main/ets/TestAbility/app.ets @@ -1,32 +1,32 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from 'hypium/index' -import testsuite from '../test/List.test' - -export default { - onCreate() { - console.info('Application onCreate') - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - console.info('start run testcase!!!') - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - }, - onDestroy() { - console.info('Application onDestroy') - }, +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('Application onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info('Application onDestroy') + }, } \ No newline at end of file diff --git a/settingsdata/settings_ets/entry/src/main/ets/TestAbility/pages/index.ets b/applications/settingsdata/settings_ets/entry/src/main/ets/TestAbility/pages/index.ets similarity index 96% rename from settingsdata/settings_ets/entry/src/main/ets/TestAbility/pages/index.ets rename to applications/settingsdata/settings_ets/entry/src/main/ets/TestAbility/pages/index.ets index 011878f2b..52663437c 100644 --- a/settingsdata/settings_ets/entry/src/main/ets/TestAbility/pages/index.ets +++ b/applications/settingsdata/settings_ets/entry/src/main/ets/TestAbility/pages/index.ets @@ -1,49 +1,49 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import router from '@system.router'; - -@Entry -@Component -struct Index { - aboutToAppear() { - console.info('TestAbility index aboutToAppear') - } - - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(()=>{ - }) - } - .width('100%') - } - .height('100%') - } +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import router from '@system.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('TestAbility index aboutToAppear') + } + + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } } \ No newline at end of file diff --git a/settingsdata/settings_ets/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/applications/settingsdata/settings_ets/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts similarity index 97% rename from settingsdata/settings_ets/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts rename to applications/settingsdata/settings_ets/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts index 143e3ae5c..14e78a653 100644 --- a/settingsdata/settings_ets/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ b/applications/settingsdata/settings_ets/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -1,77 +1,77 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import TestRunner from '@ohos.application.testRunner' -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' - -var abilityDelegator = undefined -var abilityDelegatorArguments = undefined - -function translateParamsToString(parameters) { - const keySet = new Set([ - '-s class', '-s notClass', '-s suite', '-s itName', - '-s level', '-s testType', '-s size', '-s timeout', - '-s package' - ]) - let targetParams = ''; - for (const key in parameters) { - if (keySet.has(key)) { - targetParams += ' ' + key + ' ' + parameters[key] - } - } - return targetParams.trim() -} - -async function onAbilityCreateCallback() { - console.log('onAbilityCreateCallback'); -} - -async function addAbilityMonitorCallback(err: any) { - console.info('addAbilityMonitorCallback : ' + JSON.stringify(err)) -} - -export default class OpenHarmonyTestRunner implements TestRunner { - constructor() { - } - - onPrepare() { - console.info('OpenHarmonyTestRunner OnPrepare') - } - - onRun() { - console.log('OpenHarmonyTestRunner onRun run') - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - - let lMonitor = { - abilityName: testAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName - cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) - console.info('cmd : '+cmd) - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - console.info('executeShellCommand : err : ' + JSON.stringify(err)); - console.info('executeShellCommand : data : ' + d.stdResult); - console.info('executeShellCommand : data : ' + d.exitCode); - }) - console.info('OpenHarmonyTestRunner onRun call abilityDelegator.getAppContext') - var context = abilityDelegator.getAppContext() - console.info('getAppContext : ' + JSON.stringify(context)) - console.info('OpenHarmonyTestRunner onRun end') - } +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams += ' ' + key + ' ' + parameters[key] + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log('onAbilityCreateCallback'); +} + +async function addAbilityMonitorCallback(err: any) { + console.info('addAbilityMonitorCallback : ' + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + } + + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun call abilityDelegator.getAppContext') + var context = abilityDelegator.getAppContext() + console.info('getAppContext : ' + JSON.stringify(context)) + console.info('OpenHarmonyTestRunner onRun end') + } }; \ No newline at end of file diff --git a/settingsdata/settings_ets/entry/src/main/ets/test/List.test.ets b/applications/settingsdata/settings_ets/entry/src/main/ets/test/List.test.ets similarity index 97% rename from settingsdata/settings_ets/entry/src/main/ets/test/List.test.ets rename to applications/settingsdata/settings_ets/entry/src/main/ets/test/List.test.ets index 1b296eaec..de54e5512 100644 --- a/settingsdata/settings_ets/entry/src/main/ets/test/List.test.ets +++ b/applications/settingsdata/settings_ets/entry/src/main/ets/test/List.test.ets @@ -1,19 +1,19 @@ -/** - * 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 settingUiJsunit from './SettingUiJsunit.test.ets'; - -export default function testsuite() { - settingUiJsunit(); +/** + * 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 settingUiJsunit from './SettingUiJsunit.test.ets'; + +export default function testsuite() { + settingUiJsunit(); } \ No newline at end of file diff --git a/settingsdata/settings_ets/entry/src/main/ets/test/SettingUiJsunit.test.ets b/applications/settingsdata/settings_ets/entry/src/main/ets/test/SettingUiJsunit.test.ets similarity index 97% rename from settingsdata/settings_ets/entry/src/main/ets/test/SettingUiJsunit.test.ets rename to applications/settingsdata/settings_ets/entry/src/main/ets/test/SettingUiJsunit.test.ets index fda8237db..91bda9735 100644 --- a/settingsdata/settings_ets/entry/src/main/ets/test/SettingUiJsunit.test.ets +++ b/applications/settingsdata/settings_ets/entry/src/main/ets/test/SettingUiJsunit.test.ets @@ -1,1187 +1,1187 @@ -// @ts-nocheck -/** - * 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 "hypium/index"; -import settings from '@ohos.settings' -import featureAbility from '@ohos.ability.featureAbility'; - -export default function settingUiJsunit() { - describe('appInfoTest', function () { - console.log("************* settings Test start*************"); - it('settings_uri_test_001', 0,async function (done) { - var name = 'settings.screen.test'; - var uri = settings.getUriSync(name); - console.info("[settings_uri_test_001] uri is: " + uri); - var uri2 = settings.getUriSync(name); - console.info("[settings_uri_test_001] uri2 is: " + uri2); - expect(uri).assertEqual(uri2); - done(); - }); - - it('settings_uri_test_002', 0, async function (done) { - var name = ''; - var uri = settings.getUriSync(name); - console.info("[settings_uri_test_002] uri is: " + uri); - expect(uri).assertEqual('dataability:///com.ohos.settingsdata.DataAbility') - done(); - }); - - it('settings_uri_test_003', 0, async function (done) { - var name = 122.00; - try { - var uri = settings.getUriSync(name); - console.info("[settings_uri_test_003] uri is: " + uri); - } catch (err) { - let errMsg = err; - console.error("[settings_uri_test_003] error = " + errMsg); - expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") - .assertTrue(); - } - done(); - }); - - it('settings_uri_test_004', 0, async function (done) { - var name = 'settings.screen.brightness'; - var uri = settings.getUriSync(name); - console.info("[settings_uri_test_004] uri is: " + uri); - expect(uri).assertEqual('dataability:///com.ohos.settingsdata.DataAbility/settings.screen.brightness') - done(); - }); - - it('settings_get_value_005', 0, async function (done) { - var name = 'settings.screen.brightness20'; - var uri = settings.getUriSync(name); - var helper = featureAbility.acquireDataAbilityHelper(uri); - let value = settings.getValueSync(helper, name, "test getValueSync"); - console.info("[settings_get_value_005] value is: " + value); - expect(value).assertEqual("test getValueSync"); - done(); - }); - - it('settings_get_value_006', 0, async function (done) { - var name = 'settings.screen.brightness2'; - var uri = settings.getUriSync(name); - console.info("[settings_get_value_006] uri is: " + uri); - var helper = featureAbility.acquireDataAbilityHelper(uri); - let obj = { - aa: "aa" - } - try { - let value = settings.getValueSync(helper, name, obj); - console.info("[settings_get_value_006] value is: " + value); - expect(value).assertEqual("test getValueSync"); - } catch (err) { - console.error("[settings_get_value_006] error = " + err); - expect(err == "Error: assertion (valueType == napi_string) failed: Wrong argument[2] type. String expected.") - .assertTrue(); - } - done(); - }); - - it('settings_get_value_007', 0, async function (done) { - var name = 'settings.screen.brightness3'; - var uri = settings.getUriSync(name); - console.info("[settings_get_value_007] uri is: " + uri); - var helper = featureAbility.acquireDataAbilityHelper(uri); - let obj = ''; - try { - let value = settings.getValueSync(helper, name, obj); - console.info("[settings_get_value_007] value is: " + value); - expect(value).assertEqual(''); - } catch (err) { - console.error("[settings_get_value_007] error = " + err); - expect(err == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") - .assertTrue(); - } - done(); - }); - - it('settings_get_value_008', 0, async function (done) { - var name = 'settings.screen.brightness4'; - var uri = settings.getUriSync(name); - console.info("[settings_get_value_008] uri is: " + uri); - var helper = featureAbility.acquireDataAbilityHelper(uri); - let obj = null; - try { - let value = settings.getValueSync(helper, name, obj); - console.info("[settings_get_value_008] value is: " + value); - } catch (err) { - console.error("[settings_get_value_008] error = " + err); - expect(err == "Error: assertion (valueType == napi_string) failed: Wrong argument[2] type. String expected.") - .assertTrue(); - } - done(); - }); - - it('settings_get_value_009', 0, async function (done) { - var name = 'settings.screen.brightness5'; - var uri = settings.getUriSync(name); - console.info("[settings_get_value_009] uri is: " + uri); - var helper = "helper"; - try { - let value = settings.getValueSync(helper, name, "test getValueSync"); - console.info("[settings_get_value_009] value is: " + value); - } catch (err) { - console.error("[settings_get_value_009] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_get_value_010', 0, async function (done) { - var name = 'settings.screen.brightness6'; - var uri = settings.getUriSync(name); - console.info("[settings_get_value_010] uri is: " + uri); - var helper = null; - try { - let value = settings.getValueSync(helper, name, "test getValueSync"); - console.info("[settings_get_value_010] value is: " + value); - } catch (err) { - console.error("[settings_get_value_010] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_get_value_0011', 0, async function (done) { - var name = 'settings.screen.brightness7'; - var uri = settings.getUriSync(name); - console.info("[settings_get_value_0011] uri is: " + uri); - var helper = "helper"; - let obj = 121; - try { - let value = settings.getValueSync(helper, name, obj); - console.info("[settings_get_value_0011] value is: " + value); - } catch (err) { - console.error("[settings_get_value_0011] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_get_value_0012', 0, async function (done) { - var name = 'settings.screen.brightness8'; - var uri = settings.getUriSync(name); - console.info("[settings_get_value_0012] uri is: " + uri); - var helper = null; - let obj = null; - try { - let value = settings.getValueSync(helper, name, obj); - console.info("[settings_get_value_0012] value is: " + value); - } catch (err) { - console.error("[settings_get_value_0012] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_get_value_013', 0, async function (done) { - var name = 1322.00; - try { - var uri = settings.getUriSync(name); - console.info("[settings_get_value_013] uri is: " + uri); - } catch (err) { - let errMsg = err; - console.error("[settings_get_value_013] error = " + errMsg); - expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") - .assertTrue(); - } - var helper = featureAbility.acquireDataAbilityHelper(uri); - try { - let value = settings.getValueSync(helper, name, "test getValueSync"); - console.info("[settings_get_value_013] value is: " + value); - } catch (err) { - console.error("[settings_get_value_013] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_get_value_014', 0, async function (done) { - let name = null; - try { - var uri = settings.getUriSync(name); - console.info("[settings_get_value_014] uri is: " + uri); - } catch (err) { - let errMsg = err; - console.error("[settings_get_value_014] error = " + errMsg); - expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") - .assertTrue(); - } - var helper = featureAbility.acquireDataAbilityHelper(uri); - try { - let value = settings.getValueSync(helper, name, "test getValueSync"); - console.info("[settings_get_value_014] value is: " + value); - } catch (err) { - console.error("[settings_get_value_014] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_get_value_0015', 0, async function (done) { - let name = 1332; - try { - var uri = settings.getUriSync(name); - console.info("[settings_get_value_0015] uri is: " + uri); - } catch (err) { - let errMsg = err; - console.error("[settings_get_value_0015] error = " + errMsg); - expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") - .assertTrue(); - } - var helper = featureAbility.acquireDataAbilityHelper(uri); - let obj = 22223; - try { - let value = settings.getValueSync(helper, name, obj); - console.info("[settings_get_value_0015] value is: " + value); - } catch (err) { - console.error("[settings_get_value_0015] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_get_value_0016', 0, async function (done) { - let name = 1332; - try { - var uri = settings.getUriSync(name); - console.info("[settings_get_value_0016] uri is: " + uri); - } catch (err) { - let errMsg = err; - console.error("[settings_get_value_0016] error = " + errMsg); - expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") - .assertTrue(); - } - var helper = "helper"; - try { - let value = settings.getValueSync(helper, name, "test getValueSync"); - console.info("[settings_get_value_0016] value is: " + value); - } catch (err) { - console.error("[settings_get_value_0016] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_get_value_0017', 0, async function (done) { - let name = 1332; - try { - var uri = settings.getUriSync(name); - console.info("[settings_get_value_0017] uri is: " + uri); - } catch (err) { - let errMsg = err; - console.error("[settings_get_value_0017] error = " + errMsg); - expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") - .assertTrue(); - } - var helper = "helper"; - let obj = 221323; - try { - let value = settings.getValueSync(helper, name, obj); - console.info("[settings_get_value_0017] value is: " + value); - } catch (err) { - console.error("[settings_get_value_0017] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_set_value_018', 0, async function (done) { - let name = 'settings.screen.brightness10'; - var uri = settings.getUriSync(name); - var helper = featureAbility.acquireDataAbilityHelper(uri); - let value = settings.setValueSync(helper, name, "test getValueSync"); - expect(value).assertEqual(true); - done(); - }); - - it('settings_set_value_019', 0, async function (done) { - let name = 'settings.screen.brightness11'; - var uri = settings.getUriSync(name); - var helper = featureAbility.acquireDataAbilityHelper(uri); - let obj = 32344.00; - try { - let value = settings.setValueSync(helper, name, obj); - console.info("[settings_set_value_019] value is: " + value); - expect(value).assertEqual(true); - } catch (err) { - console.error("[settings_set_value_019] error = " + err); - expect(err == "Error: assertion (valueType == napi_string) failed: Wrong argument[2] type. String expected.") - .assertTrue(); - } - done(); - }); - - it('settings_set_value_020', 0, async function (done) { - let name = 'settings.screen.brightness12'; - var uri = settings.getUriSync(name); - var helper = featureAbility.acquireDataAbilityHelper(uri); - let obj = null; - try { - let value = settings.setValueSync(helper, name, obj); - console.info("[settings_set_value_020] value is: " + value); - expect(value).assertEqual(true); - } catch (err) { - console.error("[settings_set_value_020] error = " + err); - expect(err == "Error: assertion (valueType == napi_string) failed: Wrong argument[2] type. String expected.") - .assertTrue(); - } - done(); - }); - - it('settings_set_value_021', 0, async function (done) { - let name = 'settings.screen.brightness13'; - var helper = "helper"; - try { - let value = settings.setValueSync(helper, name, "test getValueSync"); - expect(value).assertEqual(true); - } catch (err) { - console.error("[settings_set_value_021] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_set_value_022', 0, async function (done) { - let name = 'settings.screen.brightness13'; - var helper = null; - try { - let value = settings.setValueSync(helper, name, "test getValueSync"); - expect(value).assertEqual(true); - } catch (err) { - console.error("[settings_set_value_022] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_set_value_023', 0, async function (done) { - let name = 'settings.screen.brightness14'; - var helper = "helper"; - let obj = 343434.00; - try { - let value = settings.setValueSync(helper, name, obj); - expect(value).assertEqual(true); - } catch (err) { - console.error("[settings_set_value_023] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_set_value_024', 0, async function (done) { - let name = 'settings.screen.brightness14'; - var helper = "helper"; - let obj = null; - try { - let value = settings.setValueSync(helper, name, obj); - expect(value).assertEqual(true); - } catch (err) { - console.error("[settings_set_value_024] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_set_value_025', 0, async function (done) { - let name = 'settings.screen.brightness14'; - var helper = null; - let obj = 2323.00; - try { - let value = settings.setValueSync(helper, name, obj); - expect(value).assertEqual(true); - } catch (err) { - console.error("[settings_set_value_025] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_set_value_026', 0, async function (done) { - let name = 1332; - try { - var uri = settings.getUriSync(name); - console.info("[settings_set_value_026] uri is: " + uri); - } catch (err) { - let errMsg = err; - console.error("[settings_set_value_026] error = " + errMsg); - expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") - .assertTrue(); - } - var helper = featureAbility.acquireDataAbilityHelper(uri); - try { - let value = settings.setValueSync(helper, name, "test getValueSync"); - expect(value).assertEqual(true); - } catch (err) { - console.error("[settings_set_value_026] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_set_value_027', 0, async function (done) { - let name = null; - try { - var uri = settings.getUriSync(name); - console.info("[settings_set_value_027] uri is: " + uri); - } catch (err) { - let errMsg = err; - console.error("[settings_set_value_027] error = " + errMsg); - expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") - .assertTrue(); - } - var helper = featureAbility.acquireDataAbilityHelper(uri); - try { - let value = settings.setValueSync(helper, name, "test getValueSync"); - expect(value).assertEqual(true); - } catch (err) { - console.error("[settings_set_value_027] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_set_value_028', 0, async function (done) { - let name = 2323; - try { - var uri = settings.getUriSync(name); - console.info("[settings_set_value_028] uri is: " + uri); - } catch (err) { - let errMsg = err; - console.error("[settings_set_value_028] error = " + errMsg); - expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") - .assertTrue(); - } - var helper = featureAbility.acquireDataAbilityHelper(uri); - let obj = 232.00; - try { - let value = settings.setValueSync(helper, name, obj); - expect(value).assertEqual(true); - } catch (err) { - console.error("[settings_set_value_028] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_set_value_029', 0, async function (done) { - let name = 2323; - try { - var uri = settings.getUriSync(name); - console.info("[settings_set_value_029] uri is: " + uri); - } catch (err) { - let errMsg = err; - console.error("[settings_set_value_029] error = " + errMsg); - expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") - .assertTrue(); - } - var helper = featureAbility.acquireDataAbilityHelper(uri); - let obj = null; - try { - let value = settings.setValueSync(helper, name, obj); - expect(value).assertEqual(true); - } catch (err) { - console.error("[settings_set_value_029] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_set_value_030', 0, async function (done) { - let name = 2323; - try { - var uri = settings.getUriSync(name); - console.info("[settings_set_value_030] uri is: " + uri); - } catch (err) { - let errMsg = err; - console.error("[settings_set_value_030] error = " + errMsg); - expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") - .assertTrue(); - } - var helper = "helper"; - try { - let value = settings.setValueSync(helper, name, "text value"); - expect(value).assertEqual(true); - } catch (err) { - console.error("[settings_set_value_030] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_set_value_031', 0, async function (done) { - let name = 2323; - try { - var uri = settings.getUriSync(name); - console.info("[settings_set_value_031] uri is: " + uri); - } catch (err) { - let errMsg = err; - console.error("[settings_set_value_031] error = " + errMsg); - expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") - .assertTrue(); - } - var helper = null; - try { - let value = settings.setValueSync(helper, name, "text value"); - expect(value).assertEqual(true); - } catch (err) { - console.error("[settings_set_value_031] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_set_value_032', 0, async function (done) { - let name = 2323; - try { - var uri = settings.getUriSync(name); - console.info("[settings_set_value_032] uri is: " + uri); - } catch (err) { - let errMsg = err; - console.error("[settings_set_value_032] error = " + errMsg); - expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") - .assertTrue(); - } - var helper = "helper"; - let obj = 2323; - try { - let value = settings.setValueSync(helper, name, obj); - expect(value).assertEqual(true); - } catch (err) { - console.error("[settings_set_value_032] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_get_value_033', 0, async function (done){ - let uri = 'dataability:///com.ohos.settingsdata.DataAbility'; - let helper = featureAbility.acquireDataAbilityHelper(uri); - - let name = 'settings.screen.brightness33'; - let value = 'brightness33' - try{ - settings.setValueSync(helper, name, value); - settings.getValue(helper, name, ret =>{ - console.info("[settings_get_value_033] value is: " + ret); - expect(ret).assertEqual(value); - done(); - }) - } catch(err){ - console.info("[settings_get_value_033] error is: " + toString(error)); - expect(true).assertTrue(); - done(); - return; - } - }); - - it('settings_get_value_034', 0, async function (done){ - let uri = 'dataability:///com.ohos.settingsdata.DataAbility'; - let helper = featureAbility.acquireDataAbilityHelper(uri); - - let name = 'settings.screen.brightness34'; - let value = 'brightness34' - - try{ - settings.setValueSync(helper, name, value); - settings.getValue(helper, name).then(ret =>{ - console.info("[settings_get_value_034] value is: " + ret); - expect(ret).assertEqual(value); - done(); - }) - } catch(err){ - console.info("[settings_get_value_034] error is: " + toString(error)); - expect(true).assertTrue(); - done(); - return; - } - }); - - it('settings_get_value_035', 0, async function (done){ - var name = 'settings.screen.brightness35'; - let uriPrefix = 'dataability:///com.ohos.settingsdata.DataAbility' - let expectValue = uriPrefix + '/' + name; - try{ - settings.getURI(name).then(data => { - console.info("[settings_get_uri_035] uri is: " + data); - expect(data).assertEqual(expectValue); - done(); - }) - } catch(err){ - console.info("[settings_get_uri_035] error is: " + toString(error)); - expect(true).assertTrue(); - done(); - return; - } - }); - - it('settings_get_value_036', 0, async function (done){ - var name = 'settings.screen.brightness36'; - let uriPrefix = 'dataability:///com.ohos.settingsdata.DataAbility' - let expectValue = uriPrefix + '/' + name; - try{ - settings.getURI(name, (data) =>{ - console.info("[settings_get_uri_036] uri is: " + data); - expect(data).assertEqual(expectValue); - done(); - }) - }catch(err){ - console.info("[settings_get_uri_036] error is: " + toString(error)); - expect(true).assertTrue(); - done(); - return; - } - }); - - it('settings_get_value_037',0,async function (done) { - var str ="settings.date.date_format" - expect(str).assertEqual(settings.date.DATE_FORMAT); - done(); - }); - - it('settings_get_value_038',0,async function (done) { - var str ="settings.date.time_format" - expect(str).assertEqual(settings.date.TIME_FORMAT); - done(); - }); - - it('settings_get_value_039',0,async function (done) { - var str ="settings.date.auto_gain_time" - expect(str).assertEqual(settings.date.AUTO_GAIN_TIME); - done(); - }); - - it('settings_get_value_040',0,async function (done) { - var str ="settings.date.auto_gain_time_zone" - expect(str).assertEqual(settings.date.AUTO_GAIN_TIME_ZONE); - done(); - }); - - it('settings_get_value_041',0,async function (done) { - var str ="settings.display.font_scale" - expect(str).assertEqual(settings.display.FONT_SCALE); - done(); - }); - - it('settings_get_value_042',0,async function (done) { - var str ="settings.display.screen_brightness_status" - expect(str).assertEqual(settings.display.SCREEN_BRIGHTNESS_STATUS); - done(); - }); - - it('settings_get_value_043',0,async function (done) { - var str ="settings.display.auto_screen_brightness" - expect(str).assertEqual(settings.display.AUTO_SCREEN_BRIGHTNESS); - done(); - }); - - it('settings_get_value_044',0,async function (done) { - var int = 1 - expect(int).assertEqual(settings.display.AUTO_SCREEN_BRIGHTNESS_MODE); - done(); - }); - - it('settings_get_value_045',0,async function (done) { - var int = 0 - expect(int).assertEqual(settings.display.MANUAL_SCREEN_BRIGHTNESS_MODE); - done(); - }); - - it('settings_get_value_046',0,async function (done) { - var str ="settings.display.screen_off_timeout" - expect(str).assertEqual(settings.display.SCREEN_OFF_TIMEOUT); - done(); - }); - - it('settings_get_value_047',0,async function (done) { - var str ="settings.display.default_screen_rotation" - expect(str).assertEqual(settings.display.DEFAULT_SCREEN_ROTATION); - done(); - }); - - it('settings_get_value_048',0,async function (done) { - var str ="settings.display.animator_duration_scale" - expect(str).assertEqual(settings.display.ANIMATOR_DURATION_SCALE); - done(); - }); - - it('settings_get_value_049',0,async function (done) { - var str ="settings.display.transition_animation_scale" - expect(str).assertEqual(settings.display.TRANSITION_ANIMATION_SCALE); - done(); - }); - - it('settings_get_value_050',0,async function (done) { - var str ="settings.display.window_animation_scale" - expect(str).assertEqual(settings.display.WINDOW_ANIMATION_SCALE); - done(); - }); - - it('settings_get_value_051',0,async function (done) { - var str = "settings.display.display_inversion_status" - expect(str).assertEqual(settings.display.DISPLAY_INVERSION_STATUS); - done(); - }); - - it('settings_get_value_052',0,async function (done) { - var str = "settings.general.setup_wizard_finished" - expect(str).assertEqual(settings.general.SETUP_WIZARD_FINISHED); - done(); - }); - - it('settings_get_value_053',0,async function (done) { - var str = "settings.general.end_button_action" - expect(str).assertEqual(settings.general.END_BUTTON_ACTION); - done(); - }); - - it('settings_get_value_054',0,async function (done) { - var str = "settings.general.airplane_mode_status" - expect(str).assertEqual(settings.general.AIRPLANE_MODE_STATUS); - done(); - }); - - it('settings_get_value_055',0,async function (done) { - var str = "settings.general.accelerometer_rotation_status" - expect(str).assertEqual(settings.general.ACCELEROMETER_ROTATION_STATUS); - done(); - }); - - it('settings_get_value_056',0,async function (done) { - var str = "settings.general.device_provision_status" - expect(str).assertEqual(settings.general.DEVICE_PROVISION_STATUS); - done(); - }); - - it('settings_get_value_057',0,async function (done) { - var str = "settings.general.hdc_status" - expect(str).assertEqual(settings.general.HDC_STATUS); - done(); - }); - - - - it('settings_get_value_058',0,async function (done) { - var str = "settings.general.boot_counting" - expect(str).assertEqual(settings.general.BOOT_COUNTING); - done(); - }); - - it('settings_get_value_059',0,async function (done) { - var str = "settings.general.contact_metadata_sync_status" - expect(str).assertEqual(settings.general.CONTACT_METADATA_SYNC_STATUS); - done(); - }); - - it('settings_get_value_060',0,async function (done) { - var str = "settings.general.development_settings_status" - expect(str).assertEqual(settings.general.DEVELOPMENT_SETTINGS_STATUS); - done(); - }); - - it('settings_get_value_061',0,async function (done) { - var str = "settings.general.device_name" - expect(str).assertEqual(settings.general.DEVICE_NAME); - done(); - }); - - it('settings_get_value_062',0,async function (done) { - var str = "settings.general.usb_storage_status" - expect(str).assertEqual(settings.general.USB_STORAGE_STATUS); - done(); - }); - - it('settings_get_value_063',0,async function (done) { - var str = "settings.general.debugger_waiting" - expect(str).assertEqual(settings.general.DEBUGGER_WAITING); - done(); - }); - - it('settings_get_value_064',0,async function (done) { - var str = "settings.general.debug_app_package" - expect(str).assertEqual(settings.general.DEBUG_APP_PACKAGE); - done(); - }); - - it('settings_get_value_065',0,async function (done) { - var str = "settings.general.accessibility_status" - expect(str).assertEqual(settings.general.ACCESSIBILITY_STATUS); - done(); - }); - - it('settings_get_value_066',0,async function (done) { - var str = "settings.general.activated_accessibility_services" - expect(str).assertEqual(settings.general.ACTIVATED_ACCESSIBILITY_SERVICES); - done(); - }); - - it('settings_get_value_067',0,async function (done) { - var str = "settings.general.geolocation_origins_allowed" - expect(str).assertEqual(settings.general.GEOLOCATION_ORIGINS_ALLOWED); - done(); - }); - - it('settings_get_value_068',0,async function (done) { - var str = "settings.general.skip_use_hints" - expect(str).assertEqual(settings.general.SKIP_USE_HINTS); - done(); - }); - - it('settings_get_value_069',0,async function (done) { - var str = "settings.general.touch_exploration_status" - expect(str).assertEqual(settings.general.TOUCH_EXPLORATION_STATUS); - done(); - }); - - it('settings_get_value_070',0,async function (done) { - var str = "settings.input.default_input_method" - expect(str).assertEqual(settings.input.DEFAULT_INPUT_METHOD); - done(); - }); - - it('settings_get_value_071',0,async function (done){ - var str = "settings.input.activated_input_method_submode" - let expectValue:string=settings.input.ACTIVATED_INPUT_METHOD_SUB_MODE; - expect(str).assertEqual(expectValue); - done(); - }); - - - it('settings_get_value_072',0,async function (done){ - var str = "settings.input.activated_input_methods" - expect(str).assertEqual(settings.input.ACTIVATED_INPUT_METHODS); - done(); - }); - - - it('settings_get_value_073',0,async function (done){ - var str = "settings.input.selector_visibility_for_input_method" - expect(str).assertEqual(settings.input.SELECTOR_VISIBILITY_FOR_INPUT_METHOD); - done(); - }); - - - it('settings_get_value_074',0,async function (done){ - var str = "settings.input.auto_caps_text_input" - expect(str).assertEqual(settings.input.AUTO_CAPS_TEXT_INPUT); - done(); - }); - - - it('settings_get_value_075',0,async function (done){ - var str = "settings.input.auto_punctuate_text_input" - expect(str).assertEqual(settings.input.AUTO_PUNCTUATE_TEXT_INPUT); - done(); - }); - - - it('settings_get_value_076',0,async function (done){ - var str = "settings.input.auto_replace_text_input" - expect(str).assertEqual(settings.input.AUTO_REPLACE_TEXT_INPUT); - done(); - }); - - - it('settings_get_value_077',0,async function (done){ - var str = "settings.input.show_password_text_input" - expect(str).assertEqual(settings.input.SHOW_PASSWORD_TEXT_INPUT); - done(); - }); - - - it('settings_get_value_078',0,async function (done){ - var str = "settings.network.data_roaming_status" - expect(str).assertEqual(settings.network.DATA_ROAMING_STATUS); - done(); - }); - - - it('settings_get_value_079',0,async function (done){ - var str = "settings.network.http_proxy_cfg" - expect(str).assertEqual(settings.network.HTTP_PROXY_CFG); - done(); - }); - - - it('settings_get_value_080',0,async function (done){ - var str = "settings.network.network_preference_usage" - expect(str).assertEqual(settings.network.NETWORK_PREFERENCE_USAGE); - done(); - }); - - - it('settings_get_value_081',0,async function (done){ - var str = "settings.phone.rtt_calling_status" - expect(str).assertEqual(settings.phone.RTT_CALLING_STATUS); - done(); - }); - - - it('settings_get_value_082',0,async function (done){ - var str = "settings.sound.vibrate_while_ringing" - expect(str).assertEqual(settings.sound.VIBRATE_WHILE_RINGING); - done(); - }); - - - it('settings_get_value_083',0,async function (done){ - var str = "settings.sound.default_alarm_alert" - expect(str).assertEqual(settings.sound.DEFAULT_ALARM_ALERT); - done(); - }); - - - it('settings_get_value_084',0,async function (done){ - var str = "settings.sound.dtmf_tone_type_while_dialing" - expect(str).assertEqual(settings.sound.DTMF_TONE_TYPE_WHILE_DIALING); - done(); - }); - - - it('settings_get_value_085',0,async function (done){ - var str = "settings.sound.dtmf_tone_while_dialing" - expect(str).assertEqual(settings.sound.DTMF_TONE_WHILE_DIALING); - done(); - }); - - - it('settings_get_value_086',0,async function (done){ - var str = "settings.sound.haptic_feedback_status" - expect(str).assertEqual(settings.sound.HAPTIC_FEEDBACK_STATUS); - done(); - }); - - - it('settings_get_value_087',0,async function (done){ - var str = "settings.sound.affected_mode_ringer_streams" - expect(str).assertEqual(settings.sound.AFFECTED_MODE_RINGER_STREAMS); - done(); - }); - - - it('settings_get_value_088',0,async function (done){ - var str = "settings.sound.affected_mute_streams" - expect(str).assertEqual(settings.sound.AFFECTED_MUTE_STREAMS); - done(); - }); - - - it('settings_get_value_089',0,async function (done){ - var str = "settings.sound.default_notification_sound" - expect(str).assertEqual(settings.sound.DEFAULT_NOTIFICATION_SOUND); - done(); - }); - - - it('settings_get_value_090',0,async function (done){ - var str = "settings.sound.default_ringtone" - expect(str).assertEqual(settings.sound.DEFAULT_RINGTONE); - done(); - }); - - it('settings_get_value_091',0,async function (done) { - var str ="settings.sound.sound_effects_status" - expect(str).assertEqual(settings.sound.SOUND_EFFECTS_STATUS); - done(); - }); - - it('settings_get_value_092',0,async function (done) { - var str ="settings.sound.vibrate_status" - expect(str).assertEqual(settings.sound.VIBRATE_STATUS); - done(); - }); - - it('settings_get_value_093',0,async function (done) { - var str ="settings.tts.default_tts_pitch" - expect(str).assertEqual(settings.tts.DEFAULT_TTS_PITCH); - done(); - }); - - it('settings_get_value_094',0,async function (done) { - var str ="settings.tts.default_tts_rate" - expect(str).assertEqual(settings.tts.DEFAULT_TTS_RATE); - done(); - }); - - it('settings_get_value_095',0,async function (done) { - var str ="settings.tts.default_tts_synth" - expect(str).assertEqual(settings.tts.DEFAULT_TTS_SYNTH); - done(); - }); - - it('settings_get_value_096',0,async function (done) { - var str ="settings.tts.enabled_tts_plugins" - expect(str).assertEqual(settings.tts.ENABLED_TTS_PLUGINS); - done(); - }); - - it('settings_get_value_097',0,async function (done) { - var str ="settings.wireless.bluetooth_radio" - expect(str).assertEqual(settings.wireless.BLUETOOTH_RADIO); - done(); - }); - - it('settings_get_value_098',0,async function (done) { - var str ="settings.wireless.cell_radio" - expect(str).assertEqual(settings.wireless.CELL_RADIO); - done(); - }); - - it('settings_get_value_099',0,async function (done) { - var str ="settings.wireless.nfc_radio" - expect(str).assertEqual(settings.wireless.NFC_RADIO); - done(); - }); - - it('settings_get_value_100',0,async function (done) { - var str ="settings.wireless.airplane_mode_radios" - expect(str).assertEqual(settings.wireless.AIRPLANE_MODE_RADIOS); - done(); - }); - - it('settings_get_value_101',0,async function (done) { - var str ="settings.wireless.bluetooth_status" - expect(str).assertEqual(settings.wireless.BLUETOOTH_STATUS); - done(); - }); - - it('settings_get_value_102',0,async function (done) { - var str ="settings.wireless.bluetooth_discoverability_status" - expect(str).assertEqual(settings.wireless.BLUETOOTH_DISCOVER_ABILITY_STATUS); - done(); - }); - - it('settings_get_value_103',0,async function (done) { - var str ="settings.wireless.bluetooth_discover_timeout" - expect(str).assertEqual(settings.wireless.BLUETOOTH_DISCOVER_TIMEOUT); - done(); - }); - - it('settings_get_value_104',0,async function (done) { - var str ="settings.wireless.wifi_dhcp_max_retry_count" - expect(str).assertEqual(settings.wireless.WIFI_DHCP_MAX_RETRY_COUNT); - done(); - }); - - it('settings_get_value_105',0,async function (done) { - var str ="settings.wireless.wifi_to_mobile_data_awake_timeout" - expect(str).assertEqual(settings.wireless.WIFI_TO_MOBILE_DATA_AWAKE_TIMEOUT); - done(); - }); - - it('settings_get_value_106',0,async function (done) { - var str ="settings.wireless.wifi_status" - expect(str).assertEqual(settings.wireless.WIFI_STATUS); - done(); - }); - - it('settings_get_value_107',0,async function (done) { - var str ="settings.wireless.wifi_watchdog_status" - expect(str).assertEqual(settings.wireless.WIFI_WATCHDOG_STATUS); - done(); - }); - - it('settings_get_value_108',0,async function (done) { - var str ="settings.wireless.wifi_radio" - expect(str).assertEqual(settings.wireless.WIFI_RADIO); - done(); - }); - - it('settings_get_value_109',0,async function (done) { - var str ="settings.wireless.owner_lockdown_wifi_cfg" - expect(str).assertEqual(settings.wireless.OWNER_LOCKDOWN_WIFI_CFG); - done(); - }); - - it('settings_get_value_110',0,async function (done) { - var str ="settings.wireless.owner_lockdown_wifi_cfg" - expect(str).assertEqual(settings.wireless.OWNER_LOCKDOWN_WIFI_CFG); - done(); - }); - - it('settings_get_value_111',0,async function (done) { - let uri = 'dataability:///com.ohos.settingsdata.DataAbility'; - let helper = featureAbility.acquireDataAbilityHelper(uri); - let name = 'settings.screen.brightness111';//关键字 - let value = 'brightness111'//值 - try{ - settings.setValue(helper, name, value,(data)=>{ - console.info("[settings_get_value_111] value is:" + data); - settings.getValue(helper, name).then(ret => { - console.info("[settings_get_value_111] value is:" + ret); - expect(ret).assertEqual(value); - done(); - }) - }); - }catch(err){ - console.info("[settings_get_value_111] error is:" + toString(error)); - expect(true).assertTrue(); - done(); - return; - } - }); - - it('settings_get_value_112',0,async function (done) { - let uri = 'dataability:///com.ohos.settingsdata.DataAbility'; - let helper = featureAbility.acquireDataAbilityHelper(uri); - let name = 'settings.screen.brightness112';//关键字 - let value = 'brightness112'//值 - try{ - settings.setValue(helper, name, value) - .then((data)=>{ - console.info("[settings_get_value_112] value is:" + data); - settings.getValue(helper, name).then(ret => { - console.info("[settings_get_value_112] value is:" + ret); - expect(ret).assertEqual(value); - done(); - }) - }) - .catch((err)=>{ - console.info("[settings_get_value_112] error is:" + toString(error)); - expect(true).assertTrue(); - done(); - return; - }) - }catch(err){ - console.info("[settings_get_value_112] error is:" + toString(error)); - expect(true).assertTrue(); - done(); - return; - } - }); - }) -} +// @ts-nocheck +/** + * 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 "hypium/index"; +import settings from '@ohos.settings' +import featureAbility from '@ohos.ability.featureAbility'; + +export default function settingUiJsunit() { + describe('appInfoTest', function () { + console.log("************* settings Test start*************"); + it('settings_uri_test_001', 0,async function (done) { + var name = 'settings.screen.test'; + var uri = settings.getUriSync(name); + console.info("[settings_uri_test_001] uri is: " + uri); + var uri2 = settings.getUriSync(name); + console.info("[settings_uri_test_001] uri2 is: " + uri2); + expect(uri).assertEqual(uri2); + done(); + }); + + it('settings_uri_test_002', 0, async function (done) { + var name = ''; + var uri = settings.getUriSync(name); + console.info("[settings_uri_test_002] uri is: " + uri); + expect(uri).assertEqual('dataability:///com.ohos.settingsdata.DataAbility') + done(); + }); + + it('settings_uri_test_003', 0, async function (done) { + var name = 122.00; + try { + var uri = settings.getUriSync(name); + console.info("[settings_uri_test_003] uri is: " + uri); + } catch (err) { + let errMsg = err; + console.error("[settings_uri_test_003] error = " + errMsg); + expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") + .assertTrue(); + } + done(); + }); + + it('settings_uri_test_004', 0, async function (done) { + var name = 'settings.screen.brightness'; + var uri = settings.getUriSync(name); + console.info("[settings_uri_test_004] uri is: " + uri); + expect(uri).assertEqual('dataability:///com.ohos.settingsdata.DataAbility/settings.screen.brightness') + done(); + }); + + it('settings_get_value_005', 0, async function (done) { + var name = 'settings.screen.brightness20'; + var uri = settings.getUriSync(name); + var helper = featureAbility.acquireDataAbilityHelper(uri); + let value = settings.getValueSync(helper, name, "test getValueSync"); + console.info("[settings_get_value_005] value is: " + value); + expect(value).assertEqual("test getValueSync"); + done(); + }); + + it('settings_get_value_006', 0, async function (done) { + var name = 'settings.screen.brightness2'; + var uri = settings.getUriSync(name); + console.info("[settings_get_value_006] uri is: " + uri); + var helper = featureAbility.acquireDataAbilityHelper(uri); + let obj = { + aa: "aa" + } + try { + let value = settings.getValueSync(helper, name, obj); + console.info("[settings_get_value_006] value is: " + value); + expect(value).assertEqual("test getValueSync"); + } catch (err) { + console.error("[settings_get_value_006] error = " + err); + expect(err == "Error: assertion (valueType == napi_string) failed: Wrong argument[2] type. String expected.") + .assertTrue(); + } + done(); + }); + + it('settings_get_value_007', 0, async function (done) { + var name = 'settings.screen.brightness3'; + var uri = settings.getUriSync(name); + console.info("[settings_get_value_007] uri is: " + uri); + var helper = featureAbility.acquireDataAbilityHelper(uri); + let obj = ''; + try { + let value = settings.getValueSync(helper, name, obj); + console.info("[settings_get_value_007] value is: " + value); + expect(value).assertEqual(''); + } catch (err) { + console.error("[settings_get_value_007] error = " + err); + expect(err == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") + .assertTrue(); + } + done(); + }); + + it('settings_get_value_008', 0, async function (done) { + var name = 'settings.screen.brightness4'; + var uri = settings.getUriSync(name); + console.info("[settings_get_value_008] uri is: " + uri); + var helper = featureAbility.acquireDataAbilityHelper(uri); + let obj = null; + try { + let value = settings.getValueSync(helper, name, obj); + console.info("[settings_get_value_008] value is: " + value); + } catch (err) { + console.error("[settings_get_value_008] error = " + err); + expect(err == "Error: assertion (valueType == napi_string) failed: Wrong argument[2] type. String expected.") + .assertTrue(); + } + done(); + }); + + it('settings_get_value_009', 0, async function (done) { + var name = 'settings.screen.brightness5'; + var uri = settings.getUriSync(name); + console.info("[settings_get_value_009] uri is: " + uri); + var helper = "helper"; + try { + let value = settings.getValueSync(helper, name, "test getValueSync"); + console.info("[settings_get_value_009] value is: " + value); + } catch (err) { + console.error("[settings_get_value_009] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_get_value_010', 0, async function (done) { + var name = 'settings.screen.brightness6'; + var uri = settings.getUriSync(name); + console.info("[settings_get_value_010] uri is: " + uri); + var helper = null; + try { + let value = settings.getValueSync(helper, name, "test getValueSync"); + console.info("[settings_get_value_010] value is: " + value); + } catch (err) { + console.error("[settings_get_value_010] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_get_value_0011', 0, async function (done) { + var name = 'settings.screen.brightness7'; + var uri = settings.getUriSync(name); + console.info("[settings_get_value_0011] uri is: " + uri); + var helper = "helper"; + let obj = 121; + try { + let value = settings.getValueSync(helper, name, obj); + console.info("[settings_get_value_0011] value is: " + value); + } catch (err) { + console.error("[settings_get_value_0011] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_get_value_0012', 0, async function (done) { + var name = 'settings.screen.brightness8'; + var uri = settings.getUriSync(name); + console.info("[settings_get_value_0012] uri is: " + uri); + var helper = null; + let obj = null; + try { + let value = settings.getValueSync(helper, name, obj); + console.info("[settings_get_value_0012] value is: " + value); + } catch (err) { + console.error("[settings_get_value_0012] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_get_value_013', 0, async function (done) { + var name = 1322.00; + try { + var uri = settings.getUriSync(name); + console.info("[settings_get_value_013] uri is: " + uri); + } catch (err) { + let errMsg = err; + console.error("[settings_get_value_013] error = " + errMsg); + expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") + .assertTrue(); + } + var helper = featureAbility.acquireDataAbilityHelper(uri); + try { + let value = settings.getValueSync(helper, name, "test getValueSync"); + console.info("[settings_get_value_013] value is: " + value); + } catch (err) { + console.error("[settings_get_value_013] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_get_value_014', 0, async function (done) { + let name = null; + try { + var uri = settings.getUriSync(name); + console.info("[settings_get_value_014] uri is: " + uri); + } catch (err) { + let errMsg = err; + console.error("[settings_get_value_014] error = " + errMsg); + expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") + .assertTrue(); + } + var helper = featureAbility.acquireDataAbilityHelper(uri); + try { + let value = settings.getValueSync(helper, name, "test getValueSync"); + console.info("[settings_get_value_014] value is: " + value); + } catch (err) { + console.error("[settings_get_value_014] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_get_value_0015', 0, async function (done) { + let name = 1332; + try { + var uri = settings.getUriSync(name); + console.info("[settings_get_value_0015] uri is: " + uri); + } catch (err) { + let errMsg = err; + console.error("[settings_get_value_0015] error = " + errMsg); + expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") + .assertTrue(); + } + var helper = featureAbility.acquireDataAbilityHelper(uri); + let obj = 22223; + try { + let value = settings.getValueSync(helper, name, obj); + console.info("[settings_get_value_0015] value is: " + value); + } catch (err) { + console.error("[settings_get_value_0015] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_get_value_0016', 0, async function (done) { + let name = 1332; + try { + var uri = settings.getUriSync(name); + console.info("[settings_get_value_0016] uri is: " + uri); + } catch (err) { + let errMsg = err; + console.error("[settings_get_value_0016] error = " + errMsg); + expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") + .assertTrue(); + } + var helper = "helper"; + try { + let value = settings.getValueSync(helper, name, "test getValueSync"); + console.info("[settings_get_value_0016] value is: " + value); + } catch (err) { + console.error("[settings_get_value_0016] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_get_value_0017', 0, async function (done) { + let name = 1332; + try { + var uri = settings.getUriSync(name); + console.info("[settings_get_value_0017] uri is: " + uri); + } catch (err) { + let errMsg = err; + console.error("[settings_get_value_0017] error = " + errMsg); + expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") + .assertTrue(); + } + var helper = "helper"; + let obj = 221323; + try { + let value = settings.getValueSync(helper, name, obj); + console.info("[settings_get_value_0017] value is: " + value); + } catch (err) { + console.error("[settings_get_value_0017] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_set_value_018', 0, async function (done) { + let name = 'settings.screen.brightness10'; + var uri = settings.getUriSync(name); + var helper = featureAbility.acquireDataAbilityHelper(uri); + let value = settings.setValueSync(helper, name, "test getValueSync"); + expect(value).assertEqual(true); + done(); + }); + + it('settings_set_value_019', 0, async function (done) { + let name = 'settings.screen.brightness11'; + var uri = settings.getUriSync(name); + var helper = featureAbility.acquireDataAbilityHelper(uri); + let obj = 32344.00; + try { + let value = settings.setValueSync(helper, name, obj); + console.info("[settings_set_value_019] value is: " + value); + expect(value).assertEqual(true); + } catch (err) { + console.error("[settings_set_value_019] error = " + err); + expect(err == "Error: assertion (valueType == napi_string) failed: Wrong argument[2] type. String expected.") + .assertTrue(); + } + done(); + }); + + it('settings_set_value_020', 0, async function (done) { + let name = 'settings.screen.brightness12'; + var uri = settings.getUriSync(name); + var helper = featureAbility.acquireDataAbilityHelper(uri); + let obj = null; + try { + let value = settings.setValueSync(helper, name, obj); + console.info("[settings_set_value_020] value is: " + value); + expect(value).assertEqual(true); + } catch (err) { + console.error("[settings_set_value_020] error = " + err); + expect(err == "Error: assertion (valueType == napi_string) failed: Wrong argument[2] type. String expected.") + .assertTrue(); + } + done(); + }); + + it('settings_set_value_021', 0, async function (done) { + let name = 'settings.screen.brightness13'; + var helper = "helper"; + try { + let value = settings.setValueSync(helper, name, "test getValueSync"); + expect(value).assertEqual(true); + } catch (err) { + console.error("[settings_set_value_021] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_set_value_022', 0, async function (done) { + let name = 'settings.screen.brightness13'; + var helper = null; + try { + let value = settings.setValueSync(helper, name, "test getValueSync"); + expect(value).assertEqual(true); + } catch (err) { + console.error("[settings_set_value_022] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_set_value_023', 0, async function (done) { + let name = 'settings.screen.brightness14'; + var helper = "helper"; + let obj = 343434.00; + try { + let value = settings.setValueSync(helper, name, obj); + expect(value).assertEqual(true); + } catch (err) { + console.error("[settings_set_value_023] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_set_value_024', 0, async function (done) { + let name = 'settings.screen.brightness14'; + var helper = "helper"; + let obj = null; + try { + let value = settings.setValueSync(helper, name, obj); + expect(value).assertEqual(true); + } catch (err) { + console.error("[settings_set_value_024] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_set_value_025', 0, async function (done) { + let name = 'settings.screen.brightness14'; + var helper = null; + let obj = 2323.00; + try { + let value = settings.setValueSync(helper, name, obj); + expect(value).assertEqual(true); + } catch (err) { + console.error("[settings_set_value_025] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_set_value_026', 0, async function (done) { + let name = 1332; + try { + var uri = settings.getUriSync(name); + console.info("[settings_set_value_026] uri is: " + uri); + } catch (err) { + let errMsg = err; + console.error("[settings_set_value_026] error = " + errMsg); + expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") + .assertTrue(); + } + var helper = featureAbility.acquireDataAbilityHelper(uri); + try { + let value = settings.setValueSync(helper, name, "test getValueSync"); + expect(value).assertEqual(true); + } catch (err) { + console.error("[settings_set_value_026] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_set_value_027', 0, async function (done) { + let name = null; + try { + var uri = settings.getUriSync(name); + console.info("[settings_set_value_027] uri is: " + uri); + } catch (err) { + let errMsg = err; + console.error("[settings_set_value_027] error = " + errMsg); + expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") + .assertTrue(); + } + var helper = featureAbility.acquireDataAbilityHelper(uri); + try { + let value = settings.setValueSync(helper, name, "test getValueSync"); + expect(value).assertEqual(true); + } catch (err) { + console.error("[settings_set_value_027] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_set_value_028', 0, async function (done) { + let name = 2323; + try { + var uri = settings.getUriSync(name); + console.info("[settings_set_value_028] uri is: " + uri); + } catch (err) { + let errMsg = err; + console.error("[settings_set_value_028] error = " + errMsg); + expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") + .assertTrue(); + } + var helper = featureAbility.acquireDataAbilityHelper(uri); + let obj = 232.00; + try { + let value = settings.setValueSync(helper, name, obj); + expect(value).assertEqual(true); + } catch (err) { + console.error("[settings_set_value_028] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_set_value_029', 0, async function (done) { + let name = 2323; + try { + var uri = settings.getUriSync(name); + console.info("[settings_set_value_029] uri is: " + uri); + } catch (err) { + let errMsg = err; + console.error("[settings_set_value_029] error = " + errMsg); + expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") + .assertTrue(); + } + var helper = featureAbility.acquireDataAbilityHelper(uri); + let obj = null; + try { + let value = settings.setValueSync(helper, name, obj); + expect(value).assertEqual(true); + } catch (err) { + console.error("[settings_set_value_029] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_set_value_030', 0, async function (done) { + let name = 2323; + try { + var uri = settings.getUriSync(name); + console.info("[settings_set_value_030] uri is: " + uri); + } catch (err) { + let errMsg = err; + console.error("[settings_set_value_030] error = " + errMsg); + expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") + .assertTrue(); + } + var helper = "helper"; + try { + let value = settings.setValueSync(helper, name, "text value"); + expect(value).assertEqual(true); + } catch (err) { + console.error("[settings_set_value_030] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_set_value_031', 0, async function (done) { + let name = 2323; + try { + var uri = settings.getUriSync(name); + console.info("[settings_set_value_031] uri is: " + uri); + } catch (err) { + let errMsg = err; + console.error("[settings_set_value_031] error = " + errMsg); + expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") + .assertTrue(); + } + var helper = null; + try { + let value = settings.setValueSync(helper, name, "text value"); + expect(value).assertEqual(true); + } catch (err) { + console.error("[settings_set_value_031] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_set_value_032', 0, async function (done) { + let name = 2323; + try { + var uri = settings.getUriSync(name); + console.info("[settings_set_value_032] uri is: " + uri); + } catch (err) { + let errMsg = err; + console.error("[settings_set_value_032] error = " + errMsg); + expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") + .assertTrue(); + } + var helper = "helper"; + let obj = 2323; + try { + let value = settings.setValueSync(helper, name, obj); + expect(value).assertEqual(true); + } catch (err) { + console.error("[settings_set_value_032] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_get_value_033', 0, async function (done){ + let uri = 'dataability:///com.ohos.settingsdata.DataAbility'; + let helper = featureAbility.acquireDataAbilityHelper(uri); + + let name = 'settings.screen.brightness33'; + let value = 'brightness33' + try{ + settings.setValueSync(helper, name, value); + settings.getValue(helper, name, ret =>{ + console.info("[settings_get_value_033] value is: " + ret); + expect(ret).assertEqual(value); + done(); + }) + } catch(err){ + console.info("[settings_get_value_033] error is: " + toString(error)); + expect(true).assertTrue(); + done(); + return; + } + }); + + it('settings_get_value_034', 0, async function (done){ + let uri = 'dataability:///com.ohos.settingsdata.DataAbility'; + let helper = featureAbility.acquireDataAbilityHelper(uri); + + let name = 'settings.screen.brightness34'; + let value = 'brightness34' + + try{ + settings.setValueSync(helper, name, value); + settings.getValue(helper, name).then(ret =>{ + console.info("[settings_get_value_034] value is: " + ret); + expect(ret).assertEqual(value); + done(); + }) + } catch(err){ + console.info("[settings_get_value_034] error is: " + toString(error)); + expect(true).assertTrue(); + done(); + return; + } + }); + + it('settings_get_value_035', 0, async function (done){ + var name = 'settings.screen.brightness35'; + let uriPrefix = 'dataability:///com.ohos.settingsdata.DataAbility' + let expectValue = uriPrefix + '/' + name; + try{ + settings.getURI(name).then(data => { + console.info("[settings_get_uri_035] uri is: " + data); + expect(data).assertEqual(expectValue); + done(); + }) + } catch(err){ + console.info("[settings_get_uri_035] error is: " + toString(error)); + expect(true).assertTrue(); + done(); + return; + } + }); + + it('settings_get_value_036', 0, async function (done){ + var name = 'settings.screen.brightness36'; + let uriPrefix = 'dataability:///com.ohos.settingsdata.DataAbility' + let expectValue = uriPrefix + '/' + name; + try{ + settings.getURI(name, (data) =>{ + console.info("[settings_get_uri_036] uri is: " + data); + expect(data).assertEqual(expectValue); + done(); + }) + }catch(err){ + console.info("[settings_get_uri_036] error is: " + toString(error)); + expect(true).assertTrue(); + done(); + return; + } + }); + + it('settings_get_value_037',0,async function (done) { + var str ="settings.date.date_format" + expect(str).assertEqual(settings.date.DATE_FORMAT); + done(); + }); + + it('settings_get_value_038',0,async function (done) { + var str ="settings.date.time_format" + expect(str).assertEqual(settings.date.TIME_FORMAT); + done(); + }); + + it('settings_get_value_039',0,async function (done) { + var str ="settings.date.auto_gain_time" + expect(str).assertEqual(settings.date.AUTO_GAIN_TIME); + done(); + }); + + it('settings_get_value_040',0,async function (done) { + var str ="settings.date.auto_gain_time_zone" + expect(str).assertEqual(settings.date.AUTO_GAIN_TIME_ZONE); + done(); + }); + + it('settings_get_value_041',0,async function (done) { + var str ="settings.display.font_scale" + expect(str).assertEqual(settings.display.FONT_SCALE); + done(); + }); + + it('settings_get_value_042',0,async function (done) { + var str ="settings.display.screen_brightness_status" + expect(str).assertEqual(settings.display.SCREEN_BRIGHTNESS_STATUS); + done(); + }); + + it('settings_get_value_043',0,async function (done) { + var str ="settings.display.auto_screen_brightness" + expect(str).assertEqual(settings.display.AUTO_SCREEN_BRIGHTNESS); + done(); + }); + + it('settings_get_value_044',0,async function (done) { + var int = 1 + expect(int).assertEqual(settings.display.AUTO_SCREEN_BRIGHTNESS_MODE); + done(); + }); + + it('settings_get_value_045',0,async function (done) { + var int = 0 + expect(int).assertEqual(settings.display.MANUAL_SCREEN_BRIGHTNESS_MODE); + done(); + }); + + it('settings_get_value_046',0,async function (done) { + var str ="settings.display.screen_off_timeout" + expect(str).assertEqual(settings.display.SCREEN_OFF_TIMEOUT); + done(); + }); + + it('settings_get_value_047',0,async function (done) { + var str ="settings.display.default_screen_rotation" + expect(str).assertEqual(settings.display.DEFAULT_SCREEN_ROTATION); + done(); + }); + + it('settings_get_value_048',0,async function (done) { + var str ="settings.display.animator_duration_scale" + expect(str).assertEqual(settings.display.ANIMATOR_DURATION_SCALE); + done(); + }); + + it('settings_get_value_049',0,async function (done) { + var str ="settings.display.transition_animation_scale" + expect(str).assertEqual(settings.display.TRANSITION_ANIMATION_SCALE); + done(); + }); + + it('settings_get_value_050',0,async function (done) { + var str ="settings.display.window_animation_scale" + expect(str).assertEqual(settings.display.WINDOW_ANIMATION_SCALE); + done(); + }); + + it('settings_get_value_051',0,async function (done) { + var str = "settings.display.display_inversion_status" + expect(str).assertEqual(settings.display.DISPLAY_INVERSION_STATUS); + done(); + }); + + it('settings_get_value_052',0,async function (done) { + var str = "settings.general.setup_wizard_finished" + expect(str).assertEqual(settings.general.SETUP_WIZARD_FINISHED); + done(); + }); + + it('settings_get_value_053',0,async function (done) { + var str = "settings.general.end_button_action" + expect(str).assertEqual(settings.general.END_BUTTON_ACTION); + done(); + }); + + it('settings_get_value_054',0,async function (done) { + var str = "settings.general.airplane_mode_status" + expect(str).assertEqual(settings.general.AIRPLANE_MODE_STATUS); + done(); + }); + + it('settings_get_value_055',0,async function (done) { + var str = "settings.general.accelerometer_rotation_status" + expect(str).assertEqual(settings.general.ACCELEROMETER_ROTATION_STATUS); + done(); + }); + + it('settings_get_value_056',0,async function (done) { + var str = "settings.general.device_provision_status" + expect(str).assertEqual(settings.general.DEVICE_PROVISION_STATUS); + done(); + }); + + it('settings_get_value_057',0,async function (done) { + var str = "settings.general.hdc_status" + expect(str).assertEqual(settings.general.HDC_STATUS); + done(); + }); + + + + it('settings_get_value_058',0,async function (done) { + var str = "settings.general.boot_counting" + expect(str).assertEqual(settings.general.BOOT_COUNTING); + done(); + }); + + it('settings_get_value_059',0,async function (done) { + var str = "settings.general.contact_metadata_sync_status" + expect(str).assertEqual(settings.general.CONTACT_METADATA_SYNC_STATUS); + done(); + }); + + it('settings_get_value_060',0,async function (done) { + var str = "settings.general.development_settings_status" + expect(str).assertEqual(settings.general.DEVELOPMENT_SETTINGS_STATUS); + done(); + }); + + it('settings_get_value_061',0,async function (done) { + var str = "settings.general.device_name" + expect(str).assertEqual(settings.general.DEVICE_NAME); + done(); + }); + + it('settings_get_value_062',0,async function (done) { + var str = "settings.general.usb_storage_status" + expect(str).assertEqual(settings.general.USB_STORAGE_STATUS); + done(); + }); + + it('settings_get_value_063',0,async function (done) { + var str = "settings.general.debugger_waiting" + expect(str).assertEqual(settings.general.DEBUGGER_WAITING); + done(); + }); + + it('settings_get_value_064',0,async function (done) { + var str = "settings.general.debug_app_package" + expect(str).assertEqual(settings.general.DEBUG_APP_PACKAGE); + done(); + }); + + it('settings_get_value_065',0,async function (done) { + var str = "settings.general.accessibility_status" + expect(str).assertEqual(settings.general.ACCESSIBILITY_STATUS); + done(); + }); + + it('settings_get_value_066',0,async function (done) { + var str = "settings.general.activated_accessibility_services" + expect(str).assertEqual(settings.general.ACTIVATED_ACCESSIBILITY_SERVICES); + done(); + }); + + it('settings_get_value_067',0,async function (done) { + var str = "settings.general.geolocation_origins_allowed" + expect(str).assertEqual(settings.general.GEOLOCATION_ORIGINS_ALLOWED); + done(); + }); + + it('settings_get_value_068',0,async function (done) { + var str = "settings.general.skip_use_hints" + expect(str).assertEqual(settings.general.SKIP_USE_HINTS); + done(); + }); + + it('settings_get_value_069',0,async function (done) { + var str = "settings.general.touch_exploration_status" + expect(str).assertEqual(settings.general.TOUCH_EXPLORATION_STATUS); + done(); + }); + + it('settings_get_value_070',0,async function (done) { + var str = "settings.input.default_input_method" + expect(str).assertEqual(settings.input.DEFAULT_INPUT_METHOD); + done(); + }); + + it('settings_get_value_071',0,async function (done){ + var str = "settings.input.activated_input_method_submode" + let expectValue:string=settings.input.ACTIVATED_INPUT_METHOD_SUB_MODE; + expect(str).assertEqual(expectValue); + done(); + }); + + + it('settings_get_value_072',0,async function (done){ + var str = "settings.input.activated_input_methods" + expect(str).assertEqual(settings.input.ACTIVATED_INPUT_METHODS); + done(); + }); + + + it('settings_get_value_073',0,async function (done){ + var str = "settings.input.selector_visibility_for_input_method" + expect(str).assertEqual(settings.input.SELECTOR_VISIBILITY_FOR_INPUT_METHOD); + done(); + }); + + + it('settings_get_value_074',0,async function (done){ + var str = "settings.input.auto_caps_text_input" + expect(str).assertEqual(settings.input.AUTO_CAPS_TEXT_INPUT); + done(); + }); + + + it('settings_get_value_075',0,async function (done){ + var str = "settings.input.auto_punctuate_text_input" + expect(str).assertEqual(settings.input.AUTO_PUNCTUATE_TEXT_INPUT); + done(); + }); + + + it('settings_get_value_076',0,async function (done){ + var str = "settings.input.auto_replace_text_input" + expect(str).assertEqual(settings.input.AUTO_REPLACE_TEXT_INPUT); + done(); + }); + + + it('settings_get_value_077',0,async function (done){ + var str = "settings.input.show_password_text_input" + expect(str).assertEqual(settings.input.SHOW_PASSWORD_TEXT_INPUT); + done(); + }); + + + it('settings_get_value_078',0,async function (done){ + var str = "settings.network.data_roaming_status" + expect(str).assertEqual(settings.network.DATA_ROAMING_STATUS); + done(); + }); + + + it('settings_get_value_079',0,async function (done){ + var str = "settings.network.http_proxy_cfg" + expect(str).assertEqual(settings.network.HTTP_PROXY_CFG); + done(); + }); + + + it('settings_get_value_080',0,async function (done){ + var str = "settings.network.network_preference_usage" + expect(str).assertEqual(settings.network.NETWORK_PREFERENCE_USAGE); + done(); + }); + + + it('settings_get_value_081',0,async function (done){ + var str = "settings.phone.rtt_calling_status" + expect(str).assertEqual(settings.phone.RTT_CALLING_STATUS); + done(); + }); + + + it('settings_get_value_082',0,async function (done){ + var str = "settings.sound.vibrate_while_ringing" + expect(str).assertEqual(settings.sound.VIBRATE_WHILE_RINGING); + done(); + }); + + + it('settings_get_value_083',0,async function (done){ + var str = "settings.sound.default_alarm_alert" + expect(str).assertEqual(settings.sound.DEFAULT_ALARM_ALERT); + done(); + }); + + + it('settings_get_value_084',0,async function (done){ + var str = "settings.sound.dtmf_tone_type_while_dialing" + expect(str).assertEqual(settings.sound.DTMF_TONE_TYPE_WHILE_DIALING); + done(); + }); + + + it('settings_get_value_085',0,async function (done){ + var str = "settings.sound.dtmf_tone_while_dialing" + expect(str).assertEqual(settings.sound.DTMF_TONE_WHILE_DIALING); + done(); + }); + + + it('settings_get_value_086',0,async function (done){ + var str = "settings.sound.haptic_feedback_status" + expect(str).assertEqual(settings.sound.HAPTIC_FEEDBACK_STATUS); + done(); + }); + + + it('settings_get_value_087',0,async function (done){ + var str = "settings.sound.affected_mode_ringer_streams" + expect(str).assertEqual(settings.sound.AFFECTED_MODE_RINGER_STREAMS); + done(); + }); + + + it('settings_get_value_088',0,async function (done){ + var str = "settings.sound.affected_mute_streams" + expect(str).assertEqual(settings.sound.AFFECTED_MUTE_STREAMS); + done(); + }); + + + it('settings_get_value_089',0,async function (done){ + var str = "settings.sound.default_notification_sound" + expect(str).assertEqual(settings.sound.DEFAULT_NOTIFICATION_SOUND); + done(); + }); + + + it('settings_get_value_090',0,async function (done){ + var str = "settings.sound.default_ringtone" + expect(str).assertEqual(settings.sound.DEFAULT_RINGTONE); + done(); + }); + + it('settings_get_value_091',0,async function (done) { + var str ="settings.sound.sound_effects_status" + expect(str).assertEqual(settings.sound.SOUND_EFFECTS_STATUS); + done(); + }); + + it('settings_get_value_092',0,async function (done) { + var str ="settings.sound.vibrate_status" + expect(str).assertEqual(settings.sound.VIBRATE_STATUS); + done(); + }); + + it('settings_get_value_093',0,async function (done) { + var str ="settings.tts.default_tts_pitch" + expect(str).assertEqual(settings.tts.DEFAULT_TTS_PITCH); + done(); + }); + + it('settings_get_value_094',0,async function (done) { + var str ="settings.tts.default_tts_rate" + expect(str).assertEqual(settings.tts.DEFAULT_TTS_RATE); + done(); + }); + + it('settings_get_value_095',0,async function (done) { + var str ="settings.tts.default_tts_synth" + expect(str).assertEqual(settings.tts.DEFAULT_TTS_SYNTH); + done(); + }); + + it('settings_get_value_096',0,async function (done) { + var str ="settings.tts.enabled_tts_plugins" + expect(str).assertEqual(settings.tts.ENABLED_TTS_PLUGINS); + done(); + }); + + it('settings_get_value_097',0,async function (done) { + var str ="settings.wireless.bluetooth_radio" + expect(str).assertEqual(settings.wireless.BLUETOOTH_RADIO); + done(); + }); + + it('settings_get_value_098',0,async function (done) { + var str ="settings.wireless.cell_radio" + expect(str).assertEqual(settings.wireless.CELL_RADIO); + done(); + }); + + it('settings_get_value_099',0,async function (done) { + var str ="settings.wireless.nfc_radio" + expect(str).assertEqual(settings.wireless.NFC_RADIO); + done(); + }); + + it('settings_get_value_100',0,async function (done) { + var str ="settings.wireless.airplane_mode_radios" + expect(str).assertEqual(settings.wireless.AIRPLANE_MODE_RADIOS); + done(); + }); + + it('settings_get_value_101',0,async function (done) { + var str ="settings.wireless.bluetooth_status" + expect(str).assertEqual(settings.wireless.BLUETOOTH_STATUS); + done(); + }); + + it('settings_get_value_102',0,async function (done) { + var str ="settings.wireless.bluetooth_discoverability_status" + expect(str).assertEqual(settings.wireless.BLUETOOTH_DISCOVER_ABILITY_STATUS); + done(); + }); + + it('settings_get_value_103',0,async function (done) { + var str ="settings.wireless.bluetooth_discover_timeout" + expect(str).assertEqual(settings.wireless.BLUETOOTH_DISCOVER_TIMEOUT); + done(); + }); + + it('settings_get_value_104',0,async function (done) { + var str ="settings.wireless.wifi_dhcp_max_retry_count" + expect(str).assertEqual(settings.wireless.WIFI_DHCP_MAX_RETRY_COUNT); + done(); + }); + + it('settings_get_value_105',0,async function (done) { + var str ="settings.wireless.wifi_to_mobile_data_awake_timeout" + expect(str).assertEqual(settings.wireless.WIFI_TO_MOBILE_DATA_AWAKE_TIMEOUT); + done(); + }); + + it('settings_get_value_106',0,async function (done) { + var str ="settings.wireless.wifi_status" + expect(str).assertEqual(settings.wireless.WIFI_STATUS); + done(); + }); + + it('settings_get_value_107',0,async function (done) { + var str ="settings.wireless.wifi_watchdog_status" + expect(str).assertEqual(settings.wireless.WIFI_WATCHDOG_STATUS); + done(); + }); + + it('settings_get_value_108',0,async function (done) { + var str ="settings.wireless.wifi_radio" + expect(str).assertEqual(settings.wireless.WIFI_RADIO); + done(); + }); + + it('settings_get_value_109',0,async function (done) { + var str ="settings.wireless.owner_lockdown_wifi_cfg" + expect(str).assertEqual(settings.wireless.OWNER_LOCKDOWN_WIFI_CFG); + done(); + }); + + it('settings_get_value_110',0,async function (done) { + var str ="settings.wireless.owner_lockdown_wifi_cfg" + expect(str).assertEqual(settings.wireless.OWNER_LOCKDOWN_WIFI_CFG); + done(); + }); + + it('settings_get_value_111',0,async function (done) { + let uri = 'dataability:///com.ohos.settingsdata.DataAbility'; + let helper = featureAbility.acquireDataAbilityHelper(uri); + let name = 'settings.screen.brightness111';//关键字 + let value = 'brightness111'//值 + try{ + settings.setValue(helper, name, value,(data)=>{ + console.info("[settings_get_value_111] value is:" + data); + settings.getValue(helper, name).then(ret => { + console.info("[settings_get_value_111] value is:" + ret); + expect(ret).assertEqual(value); + done(); + }) + }); + }catch(err){ + console.info("[settings_get_value_111] error is:" + toString(error)); + expect(true).assertTrue(); + done(); + return; + } + }); + + it('settings_get_value_112',0,async function (done) { + let uri = 'dataability:///com.ohos.settingsdata.DataAbility'; + let helper = featureAbility.acquireDataAbilityHelper(uri); + let name = 'settings.screen.brightness112';//关键字 + let value = 'brightness112'//值 + try{ + settings.setValue(helper, name, value) + .then((data)=>{ + console.info("[settings_get_value_112] value is:" + data); + settings.getValue(helper, name).then(ret => { + console.info("[settings_get_value_112] value is:" + ret); + expect(ret).assertEqual(value); + done(); + }) + }) + .catch((err)=>{ + console.info("[settings_get_value_112] error is:" + toString(error)); + expect(true).assertTrue(); + done(); + return; + }) + }catch(err){ + console.info("[settings_get_value_112] error is:" + toString(error)); + expect(true).assertTrue(); + done(); + return; + } + }); + }) +} diff --git a/settingsdata/settings_ets/entry/src/main/resources/base/element/string.json b/applications/settingsdata/settings_ets/entry/src/main/resources/base/element/string.json similarity index 94% rename from settingsdata/settings_ets/entry/src/main/resources/base/element/string.json rename to applications/settingsdata/settings_ets/entry/src/main/resources/base/element/string.json index 281be4665..498677efb 100644 --- a/settingsdata/settings_ets/entry/src/main/resources/base/element/string.json +++ b/applications/settingsdata/settings_ets/entry/src/main/resources/base/element/string.json @@ -1,20 +1,20 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "entry_MainAbility" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - }, - { - "name": "TestAbility_desc", - "value": "description" - }, - { - "name": "TestAbility_label", - "value": "label" - } - ] +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] } \ No newline at end of file diff --git a/settingsdata/settings_ets/entry/src/main/resources/base/media/icon.png b/applications/settingsdata/settings_ets/entry/src/main/resources/base/media/icon.png similarity index 100% rename from settingsdata/settings_ets/entry/src/main/resources/base/media/icon.png rename to applications/settingsdata/settings_ets/entry/src/main/resources/base/media/icon.png diff --git a/settingsdata/settings_ets/signature/openharmony_sx.p7b b/applications/settingsdata/settings_ets/signature/openharmony_sx.p7b similarity index 100% rename from settingsdata/settings_ets/signature/openharmony_sx.p7b rename to applications/settingsdata/settings_ets/signature/openharmony_sx.p7b diff --git a/test_packages.gni b/test_packages.gni index b0d7aa0d3..e2c8be85f 100644 --- a/test_packages.gni +++ b/test_packages.gni @@ -46,6 +46,7 @@ _all_test_packages = [ "${ACTS_ROOT}/settingsdata:settingsdata", "${ACTS_ROOT}/barrierfree:barrierfree", "${ACTS_ROOT}/customization:customization", + "${ACTS_ROOT}/applications:applications", ] _all_test_packages_ivi = [ -- GitLab