未验证 提交 b8af5bd0 编写于 作者: O openharmony_ci 提交者: Gitee

!2080 add settings

Merge pull request !2080 from 安宁/master
# 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" ]
}
{
"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
}
]
}
# 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"
}
{
"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
}
}
]
}
}
/**
* 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
// @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%')
}
}
/**
* 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
// @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();
});
})
}
{
"string": [
{
"name": "entry_MainAbility",
"value": "entry_MainAbility"
},
{
"name": "description_mainability",
"value": "ETS_Empty Ability"
}
]
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册