diff --git a/settings/BUILD.gn b/settings/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..48d834c3c61f30219ce284a40c8f5d5fd0038d4f --- /dev/null +++ b/settings/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("settings") { + testonly = true + deps = [ "settings_ets:SettingsEtsTest" ] +} diff --git a/settings/settings_ets/Test.json b/settings/settings_ets/Test.json new file mode 100755 index 0000000000000000000000000000000000000000..44fa2d9b76705488b7ac5da4e2cfe7101615f70d --- /dev/null +++ b/settings/settings_ets/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for settings Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "600000", + "package": "com.open.harmony.settings", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "SettingsEtsTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/settings/settings_ets/entry/src/main/BUILD.gn b/settings/settings_ets/entry/src/main/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..fbc52811e474d4051c74b681f36bc54a1d9bdea8 --- /dev/null +++ b/settings/settings_ets/entry/src/main/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("SettingsEtsTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":settings_ets_assets", + ":settings_ets_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "SettingsEtsTest" +} +ohos_js_assets("settings_ets_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("settings_ets_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/settings/settings_ets/entry/src/main/config.json b/settings/settings_ets/entry/src/main/config.json new file mode 100755 index 0000000000000000000000000000000000000000..dffd13eea9281e9c66926a8d19795ff52755317d --- /dev/null +++ b/settings/settings_ets/entry/src/main/config.json @@ -0,0 +1,71 @@ +{ + "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", + "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" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} diff --git a/settings/settings_ets/entry/src/main/ets/MainAbility/app.ets b/settings/settings_ets/entry/src/main/ets/MainAbility/app.ets new file mode 100755 index 0000000000000000000000000000000000000000..5d603333c7bf5167e7d1d3ead6c9daa9c4b2862d --- /dev/null +++ b/settings/settings_ets/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('Application onCreate') + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/settings/settings_ets/entry/src/main/ets/MainAbility/pages/index.ets b/settings/settings_ets/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100755 index 0000000000000000000000000000000000000000..be66babbf8a365a8f98532cc558c9a5fea7b8204 --- /dev/null +++ b/settings/settings_ets/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,64 @@ +// @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 file from '@system.file'; + +import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets"; +import testsuite from "../test/List.test.ets"; +import featureAbility from "@ohos.ability.featureAbility"; + +@Entry +@Component +struct MyComponent { + aboutToAppear() { + console.info("start run testcase!!!!") + featureAbility.getWant() + .then((Want) => { + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + console.info('parameters---->' + JSON.stringify(Want.parameters)); + configService.setConfig(Want.parameters); + testsuite(); + core.execute(); + console.info('Operation successful. Data: ' + JSON.stringify(Want)); + }) + .catch((error) => { + console.error('Operation failed. Cause: ' + JSON.stringify(error)); + }) + } + + 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/settings/settings_ets/entry/src/main/ets/MainAbility/test/List.test.ets b/settings/settings_ets/entry/src/main/ets/MainAbility/test/List.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..1b296eaececa9b867473d634dea841f84722e231 --- /dev/null +++ b/settings/settings_ets/entry/src/main/ets/MainAbility/test/List.test.ets @@ -0,0 +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(); +} \ No newline at end of file diff --git a/settings/settings_ets/entry/src/main/ets/MainAbility/test/SettingUiJsunit.test.ets b/settings/settings_ets/entry/src/main/ets/MainAbility/test/SettingUiJsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..a5b9778cf07772eef49305d662c045794f1aac2f --- /dev/null +++ b/settings/settings_ets/entry/src/main/ets/MainAbility/test/SettingUiJsunit.test.ets @@ -0,0 +1,591 @@ +// @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 "deccjsunit/index.ets"; +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 () { + 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 type. String expected.") + .assertTrue(); + } + done(); + }); + + it('settings_get_value_007', 0, async function () { + 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 () { + 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(); + }); + }) +} diff --git a/settings/settings_ets/entry/src/main/resources/base/element/string.json b/settings/settings_ets/entry/src/main/resources/base/element/string.json new file mode 100755 index 0000000000000000000000000000000000000000..c3c18f1e4990cc72fba7f18b9fb3d3ad0b0a20e9 --- /dev/null +++ b/settings/settings_ets/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/settings/settings_ets/entry/src/main/resources/base/media/icon.png b/settings/settings_ets/entry/src/main/resources/base/media/icon.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/settings/settings_ets/entry/src/main/resources/base/media/icon.png differ diff --git a/settings/settings_ets/signature/openharmony_sx.p7b b/settings/settings_ets/signature/openharmony_sx.p7b new file mode 100755 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/settings/settings_ets/signature/openharmony_sx.p7b differ